Changeset 757


Ignore:
Timestamp:
Sep 13, 2012 8:53:46 AM (11 years ago)
Author:
vondreele
Message:

remove inverse check from peak search - didn't work
implement Zshift in structure plot
fix (mostly) the view direction

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r755 r757  
    934934        rho[rMM[0]:rMP[0],rMM[1]:rMP[1],rMM[2]:rMP[2]] = peakFunc(x1,rX,rY,rZ,rhoPeak,res,SGData['SGLaue'])
    935935        rho = np.roll(np.roll(np.roll(rho,-rMI[2],axis=2),-rMI[1],axis=1),-rMI[0],axis=0)
    936     if SGData['SGInv']:                 #check origin location & fix it if needed - centrosymmetric only
    937         Ocheck = np.zeros_like(rho)
    938         for ipeak in peaks:
    939             for opeak in peaks:           
    940                 dx = ((opeak-ipeak)*incre)%incre
    941                 if np.any(dx):      #avoid self vector
    942                     Ocheck[dx[0],dx[1],dx[2]] += 1
    943         dxMax = np.unravel_index(np.argmax(Ocheck),rho.shape)
    944         print ' Inversion at:',dxMax,' shift by ;',dxMax-mapHalf
    945         rho = np.roll(np.roll(np.roll(rho,dxMax[2],axis=2),dxMax[1],axis=1),dxMax[0],axis=0)
    946         for peak in peaks:
    947             peak = (peak-(dxMax+mapHalf)/incre)%1.0
     936#    if SGData['SGInv']:                 #check origin location & fix it if needed - centrosymmetric only
     937#        Ocheck = np.zeros_like(rho)
     938#        for ipeak in peaks:
     939#            for opeak in peaks:           
     940#                dx = ((opeak-ipeak)*incre)%incre
     941#                if np.any(dx):      #avoid self vector
     942#                    Ocheck[dx[0],dx[1],dx[2]] += 1
     943#        dxMax = np.unravel_index(np.argmax(Ocheck),rho.shape)
     944#        print ' Inversion at:',dxMax,' shift by ;',dxMax-mapHalf
     945#        rho = np.roll(np.roll(np.roll(rho,dxMax[2],axis=2),dxMax[1],axis=1),dxMax[0],axis=0)
     946#        for peak in peaks:
     947#            peak = (peak-(dxMax+mapHalf)/incre)%1.0
    948948       
    949949    return np.array(peaks),np.array([mags,]).T,np.array([dzeros,]).T
  • trunk/GSASIIphsGUI.py

    r756 r757  
    15551555    def SetupDrawingData():
    15561556        generalData = data['General']
     1557        Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7])
    15571558        atomData = data['Atoms']
    15581559        AA3letter = ['ALA','ARG','ASN','ASP','CYS','GLN','GLU','GLY','HIS','ILE',
     
    15611562            'L','K','M','F','P','S','T','W','Y','V','M',' ',' ',' ']
    15621563        defaultDrawing = {'Atoms':[],'viewPoint':[[0.5,0.5,0.5],[]],'showHydrogen':True,
    1563             'backColor':[0,0,0],'depthFog':False,'Zclip':50.0,'cameraPos':50.,
     1564            'backColor':[0,0,0],'depthFog':False,'Zclip':50.0,'cameraPos':50.,'Zstep':0.5,
    15641565            'radiusFactor':0.85,'contourLevel':1.,'bondRadius':0.1,'ballScale':0.33,
    15651566            'vdwScale':0.67,'ellipseProb':50,'sizeH':0.50,'unitCellBox':False,
    15661567            'showABC':True,'selectedAtoms':[],'Atoms':[],'oldxy':[],
    1567             'Quaternion':[1.0,0.0,0.0,0.0],'bondList':{},'viewDir':[0,0,1]}
     1568            'bondList':{},'viewDir':[0,0,1]}
     1569        defaultDrawing['Quaternion'] = G2mth.AV2Q(2*np.pi,np.inner(Amat,[0,0,1]))
    15681570        try:
    15691571            drawingData = data['Drawing']
     
    15731575        if not drawingData:                 #fill with defaults if empty
    15741576            drawingData.update(defaultDrawing)
     1577        if 'Zstep' not in drawingData:
     1578            drawingData['Zstep'] = 0.5
    15751579        if 'contourLevel' not in drawingData:
    15761580            drawingData['contourLevel'] = 1.
     
    15781582            drawingData['viewDir'] = [0,0,1]
    15791583        if 'Quaternion' not in drawingData:
    1580             drawingData['Quaternion'] = [1.0,0.0,0.0,0.0]
     1584            drawingData['Quaternion'] = G2mth.AV2Q(2*np.pi,np.inner(Amat,[0,0,1]))
    15811585        cx,ct,cs,ci = [0,0,0,0]
    15821586        if generalData['Type'] == 'nuclear':
     
    24362440        import wx.lib.colourselect as wcs
    24372441        generalData = data['General']
     2442        Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7])
    24382443        SetupDrawingData()
    24392444        drawingData = data['Drawing']
     
    24542459                drawingData['Zclip'] = Zclip.GetValue()
    24552460                ZclipTxt.SetLabel(' Z clipping: '+'%.2fA'%(drawingData['Zclip']*drawingData['cameraPos']/100.))
     2461                G2plt.PlotStructure(G2frame,data)
     2462               
     2463            def OnZstep(event):
     2464                try:
     2465                    step = float(Zstep.GetValue())
     2466                    if not (0.01 <= step <= 1.0):
     2467                        raise ValueError
     2468                except ValueError:
     2469                    step = drawingData['Zstep']
     2470                drawingData['Zstep'] = step
     2471                Zstep.SetValue('%.2fA'%(drawingData['Zstep']))
     2472               
     2473            def OnMoveZ(event):
     2474                move = MoveZ.GetValue()*drawingData['Zstep']
     2475                MoveZ.SetValue(0)
     2476                VP = np.inner(Amat,np.array(drawingData['viewPoint'][0]))
     2477                VD = np.inner(Amat,np.array(drawingData['viewDir']))
     2478                VD /= np.sqrt(np.sum(VD**2))
     2479                VP += move*VD
     2480                VP = np.inner(Bmat,VP)
     2481                drawingData['viewPoint'][0] = VP
     2482                panel = dataDisplay.GetChildren()
     2483                names = [child.GetName() for child in panel]
     2484                panel[names.index('viewPoint')].SetValue('%.3f %.3f %.3f'%(VP[0],VP[1],VP[2]))               
    24562485                G2plt.PlotStructure(G2frame,data)
    24572486               
     
    25052534            Zclip.Bind(wx.EVT_SLIDER, OnZclip)
    25062535            slideSizer.Add(Zclip,1,wx.EXPAND|wx.RIGHT)
     2536           
     2537            ZstepSizer = wx.BoxSizer(wx.HORIZONTAL)
     2538            ZstepSizer.Add(wx.StaticText(dataDisplay,-1,' Z step:'),0,wx.ALIGN_CENTER_VERTICAL)
     2539            Zstep = wx.TextCtrl(dataDisplay,value='%.2f'%(drawingData['Zstep']),
     2540                style=wx.TE_PROCESS_ENTER)
     2541            Zstep.Bind(wx.EVT_TEXT_ENTER,OnZstep)
     2542            Zstep.Bind(wx.EVT_KILL_FOCUS,OnZstep)
     2543            ZstepSizer.Add(Zstep,0,wx.ALIGN_CENTER_VERTICAL)
     2544            slideSizer.Add(ZstepSizer)
     2545            MoveSizer = wx.BoxSizer(wx.HORIZONTAL)
     2546            MoveSizer.Add(wx.StaticText(dataDisplay,-1,'   Press to step:'),0,wx.ALIGN_CENTER_VERTICAL)
     2547            MoveZ = wx.SpinButton(dataDisplay,style=wx.SP_HORIZONTAL,size=wx.Size(100,20))
     2548            MoveZ.SetValue(0)
     2549            MoveZ.SetRange(-1,1)
     2550            MoveZ.Bind(wx.EVT_SPIN, OnMoveZ)
     2551            MoveSizer.Add(MoveZ)
     2552            slideSizer.Add(MoveSizer,1,wx.EXPAND|wx.RIGHT)
    25072553           
    25082554            vdwScaleTxt = wx.StaticText(dataDisplay,-1,' van der Waals scale: '+'%.2f'%(drawingData['vdwScale']))
     
    25822628               
    25832629            def OnViewDir(event):
    2584                 event.Skip()
    25852630                Obj = event.GetEventObject()
    25862631                viewDir = Obj.GetValue().split()
     
    25882633                    Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7])
    25892634                    VD = np.array([float(viewDir[i]) for i in range(3)])
    2590 #                    VD = np.inner(Amat,VD)
    2591                     VD /= np.sqrt(np.sum(VD**2))
     2635                    VC = np.inner(Amat,VD)
     2636                    VC /= np.sqrt(np.sum(VC**2))
    25922637                    V = np.array(drawingData['viewDir'])
    2593 #                    V = np.inner(Amat,V)
    2594                     V /= np.sqrt(np.sum(V**2))
    2595                     A = acosd(np.sum(V*VD))
    2596                     VX = np.cross(V,VD)
     2638                    VB = np.inner(Amat,V)
     2639                    VB /= np.sqrt(np.sum(VB**2))
     2640                    VX = np.cross(VC,VB)
     2641                    A = acosd(max((2.-np.sum((VB-VC)**2))/2.,-1.))
    25972642                    QV = G2mth.AVdeg2Q(A,VX)
    25982643                    Q = drawingData['Quaternion']
  • trunk/GSASIIplot.py

    r756 r757  
    25362536                panel = G2frame.dataDisplay.GetPage(page).GetChildren()[0].GetChildren()
    25372537                names = [child.GetName() for child in panel]
    2538                 panel[names.index('viewPoint')].SetValue('%.3f, %.3f, %.3f'%(VP[0],VP[1],VP[2]))
     2538                panel[names.index('viewPoint')].SetValue('%.3f %.3f %.3f'%(VP[0],VP[1],VP[2]))
    25392539               
    25402540    def SetViewDirText(VD):
     
    25442544                panel = G2frame.dataDisplay.GetPage(page).GetChildren()[0].GetChildren()
    25452545                names = [child.GetName() for child in panel]
    2546                 panel[names.index('viewDir')].SetValue('%.3f, %.3f, %.3f'%(VD[0],VD[1],VD[2]))
     2546                panel[names.index('viewDir')].SetValue('%.3f %.3f %.3f'%(VD[0],VD[1],VD[2]))
    25472547               
    25482548    def SetMapPeaksText(mapPeaks):
Note: See TracChangeset for help on using the changeset viewer.