Changeset 1991


Ignore:
Timestamp:
Oct 7, 2015 1:26:11 PM (6 years ago)
Author:
vondreele
Message:

fix 3D plot zone p/n key problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r1986 r1991  
    575575        global ifBox
    576576        Choice = {'F':'Fo','S':'Fosq','U':'Unit','D':'dFsq','W':'dFsq/sig'}
    577         viewChoice = {'L':[[0,0,1],[1,0,0],[0,1,0]],'K':[[0,1,0],[0,0,1],[1,0,0]],'H':[[1,0,0],[0,0,1],[0,1,0]]}
     577        viewChoice = {'L':np.array([[0,0,1],[1,0,0],[0,1,0]]),'K':np.array([[0,1,0],[0,0,1],[1,0,0]]),'H':np.array([[1,0,0],[0,0,1],[0,1,0]])}
    578578        try:
    579579            keyCode = event.GetKeyCode()
     
    588588                key = 'L'
    589589            Data['viewKey'] = key
    590             drawingData['viewPoint'][0] = drawingData['default']
    591             drawingData['viewDir'] = np.array(viewChoice[key][0])
    592             drawingData['viewUp'] = np.array(viewChoice[key][1])
     590            drawingData['viewPoint'][0] = np.array(drawingData['default'])
     591            drawingData['viewDir'] = viewChoice[key][0]
     592            drawingData['viewUp'] = viewChoice[key][1]
    593593            drawingData['oldxy'] = []
    594594            if Data['Zone']:
     
    596596                    Q = [-1,0,0,0]
    597597                else:
    598                     V0 = np.array(viewChoice[key][0])
    599                     V1 = np.array(viewChoice[key][1])
     598                    V0 = viewChoice[key][0]
     599                    V1 = viewChoice[key][1]
    600600                    V0 = np.inner(Amat,V0)
    601601                    V1 = np.inner(Amat,V1)
     
    604604                    A = np.arccos(np.sum(V1*V0))
    605605                    Q = G2mth.AV2Q(-A,viewChoice[key][2])
    606                 G2frame.G2plotNB.status.SetStatusText('zone = %s'%(str(viewChoice[key][0])),1)
     606                G2frame.G2plotNB.status.SetStatusText('zone = %s'%(str(list(viewChoice[key][0]))),1)
    607607            else:
    608                 V0 = np.array(viewChoice[key][0])
     608                V0 = viewChoice[key][0]
    609609                V = np.inner(Bmat,V0)
    610610                V /= np.sqrt(np.sum(V**2))
     
    628628            drawingData['viewPoint'][0] += vec
    629629        elif key == '0':
    630             drawingData['viewPoint'][0] = [0,0,0]
     630            drawingData['viewPoint'][0] = np.array([0,0,0])
    631631            Data['Scale'] = 1.0
    632632        elif key == 'I':
     
    758758        Ty += V[1]*0.1
    759759        Tz += V[2]*0.1
    760         drawingData['viewPoint'][0] =  Tx,Ty,Tz
     760        drawingData['viewPoint'][0] =  np.array([Tx,Ty,Tz])
    761761       
    762762    def SetRotation(newxy):
     
    43944394        cx,ct = drawingData['atomPtrs'][:2]
    43954395        if key in ['C']:
    4396             drawingData['viewPoint'] = [[.5,.5,.5],[0,0]]
     4396            drawingData['viewPoint'] = [np.array([.5,.5,.5]),[0,0]]
    43974397            drawingData['viewDir'] = [0,0,1]
    43984398            drawingData['oldxy'] = []
     
    44254425                if pI[0] >= len(drawAtoms):
    44264426                    pI[0] = 0
    4427             drawingData['viewPoint'] = [[Tx,Ty,Tz],pI]
     4427            drawingData['viewPoint'] = [np.array([Tx,Ty,Tz]),pI]
    44284428            SetViewPointText(drawingData['viewPoint'][0])
    44294429            G2frame.G2plotNB.status.SetStatusText('View point at atom '+drawAtoms[pI[0]][ct-1]+str(pI),1)
     
    44474447                if pI[0] < 0:
    44484448                    pI[0] = len(drawAtoms)-1
    4449             drawingData['viewPoint'] = [[Tx,Ty,Tz],pI]
     4449            drawingData['viewPoint'] = [np.array([Tx,Ty,Tz]),pI]
    44504450            SetViewPointText(drawingData['viewPoint'][0])           
    44514451            G2frame.G2plotNB.status.SetStatusText('View point at atom '+drawAtoms[pI[0]][ct-1]+str(pI),1)
     
    47364736        Ty += V[1]*0.01
    47374737        Tz += V[2]*0.01
    4738         drawingData['viewPoint'][0] =  Tx,Ty,Tz
     4738        drawingData['viewPoint'][0] =  np.array([Tx,Ty,Tz])
    47394739        SetViewPointText([Tx,Ty,Tz])
    47404740       
     
    50625062        rhoXYZ = []
    50635063        if len(mapData['rho']):
    5064             VP = np.array(drawingData['viewPoint'][0])-np.array([.5,.5,.5])
     5064            VP = drawingData['viewPoint'][0]-np.array([.5,.5,.5])
    50655065            contLevel = drawingData['contourLevel']*mapData['rhoMax']
    50665066            if 'delt-F' in mapData['MapType'] or 'N' in mapData.get('Type',''):
     
    50785078            rmax = math.exp(math.log(rcube)/3.)**2
    50795079            radius = min(drawingData['mapSize']**2,rmax)
    5080             view = np.array(drawingData['viewPoint'][0])
     5080            view = drawingData['viewPoint'][0]
    50815081            Rok = np.sum(np.inner(Amat,rhoXYZ-view).T**2,axis=1)>radius
    50825082        Ind = GetSelectedAtoms()
Note: See TracChangeset for help on using the changeset viewer.