Changeset 756
- Timestamp:
- Sep 11, 2012 2:28:29 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r755 r756 39 39 'rho':[],'rhoMax':0.,'mapSize':10.0,'cutOff':50.,'Flip':False} 40 40 # trig functions in degrees 41 sind = lambda x: math.sin(x*math.pi/180.) 42 tand = lambda x: math.tan(x*math.pi/180.) 43 cosd = lambda x: math.cos(x*math.pi/180.) 44 asind = lambda x: 180.*math.asin(x)/math.pi 41 sind = lambda x: np.sin(x*np.pi/180.) 42 tand = lambda x: np.tan(x*np.pi/180.) 43 cosd = lambda x: np.cos(x*np.pi/180.) 44 asind = lambda x: 180.*np.arcsin(x)/np.pi 45 acosd = lambda x: 180.*np.arccos(x)/np.pi 45 46 46 47 class SymOpDialog(wx.Dialog): … … 2581 2582 2582 2583 def OnViewDir(event): 2584 event.Skip() 2583 2585 Obj = event.GetEventObject() 2584 2586 viewDir = Obj.GetValue().split() 2585 2587 try: 2586 VD = [float(viewDir[i]) for i in range(3)] 2588 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 2589 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)) 2592 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) 2597 QV = G2mth.AVdeg2Q(A,VX) 2598 Q = drawingData['Quaternion'] 2599 drawingData['Quaternion'] = G2mth.prodQQ(Q,QV) 2587 2600 except (ValueError,IndexError): 2588 2601 VD = drawingData['viewDir'] 2589 2602 Obj.SetValue('%.3f %.3f %.3f'%(VD[0],VD[1],VD[2])) 2590 drawingData['viewDir'] = V P2603 drawingData['viewDir'] = VD 2591 2604 G2plt.PlotStructure(G2frame,data) 2592 2605 -
trunk/GSASIIplot.py
r755 r756 2391 2391 if key in ['C']: 2392 2392 drawingData['viewPoint'] = [[.5,.5,.5],[0,0]] 2393 VD = np.inner(Bmat,np.array([0,0,1])) 2394 VD /= np.sqrt(np.sum(VD**2)) 2395 drawingData['viewDir'] = VD 2393 drawingData['viewDir'] = [0.,0.,1] 2396 2394 drawingData['oldxy'] = [] 2397 2395 drawingData['Quaternion'] = [0.0,0.0,1.0,0.0] … … 2737 2735 glPopMatrix() 2738 2736 2737 def RenderDots(XYZ,RC): 2738 glEnable(GL_COLOR_MATERIAL) 2739 XYZ = np.array(XYZ) 2740 glPushMatrix() 2741 for xyz,rc in zip(XYZ,RC): 2742 x,y,z = xyz 2743 r,c = rc 2744 glColor3ubv(c) 2745 glPointSize(r*50) 2746 glBegin(GL_POINTS) 2747 glVertex3fv(xyz) 2748 glEnd() 2749 glPopMatrix() 2750 glColor4ubv([0,0,0,0]) 2751 glDisable(GL_COLOR_MATERIAL) 2752 2739 2753 def RenderSmallSphere(x,y,z,radius,color): 2740 2754 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,color) … … 2745 2759 gluSphere(q,radius,4,2) 2746 2760 glPopMatrix() 2747 2761 2748 2762 def RenderEllipsoid(x,y,z,ellipseProb,E,R4,color): 2749 2763 s1,s2,s3 = E … … 2849 2863 def RenderMap(rho,rhoXYZ,indx,Rok): 2850 2864 cLevel = drawingData['contourLevel'] 2865 XYZ = [] 2866 RC = [] 2851 2867 for i,xyz in enumerate(rhoXYZ): 2852 2868 if not Rok[i]: … … 2857 2873 alpha = (abs(rho[I,J,K])/mapData['rhoMax']-cLevel)/(1.-cLevel) 2858 2874 if rho[I,J,K] < 0.: 2859 RenderSmallSphere(x,y,z,0.1*alpha,Rd) 2875 XYZ.append(xyz) 2876 RC.append([0.1*alpha,Rd]) 2860 2877 else: 2861 RenderSmallSphere(x,y,z,0.1*alpha,Gr) 2878 XYZ.append(xyz) 2879 RC.append([0.1*alpha,Gr]) 2880 RenderDots(XYZ,RC) 2862 2881 2863 2882 def Draw(): … … 3052 3071 Page.SetFocus() 3053 3072 if mapData['Flip']: 3073 choice = [' save as/key:','jpeg','tiff','bmp','u: roll up','d: roll down','l: roll left','r: roll right'] 3074 else: 3054 3075 choice = [' save as/key:','jpeg','tiff','bmp','c: center on 1/2,1/2,1/2','n: next','p: previous'] 3055 else:3056 choice = [' save as/key:','jpeg','tiff','bmp','u: roll up','d: roll down','l: roll left','r: roll right']3057 3076 cb = wx.ComboBox(G2frame.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY,choices=choice) 3058 3077 cb.Bind(wx.EVT_COMBOBOX, OnKeyBox)
Note: See TracChangeset
for help on using the changeset viewer.