Changeset 2165
- Timestamp:
- Mar 8, 2016 4:08:27 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r2161 r2165 87 87 ] = [wx.NewId() for item in range(2)] 88 88 89 [ wxID_LOADDIFFAX, 90 ] = [wx.NewId() for item in range( 1)]89 [ wxID_LOADDIFFAX,wxID_LAYERSIMULATE, 90 ] = [wx.NewId() for item in range(2)] 91 91 92 92 [ wxID_PAWLEYLOAD, wxID_PAWLEYESTIMATE, wxID_PAWLEYUPDATE, … … 1639 1639 self.LayerDataEdit.Append(id=wxID_LOADDIFFAX, kind=wx.ITEM_NORMAL,text='Load from DIFFaX file', 1640 1640 help='Load layer info from DIFFaX file') 1641 self.LayerDataEdit.Append(id=wxID_LAYERSIMULATE, kind=wx.ITEM_NORMAL,text='Simulate PWDR pattern', 1642 help='Simulate powder pattern from layer stacking') 1641 1643 self.PostfillDataMenu() 1642 1644 -
trunk/GSASIIphsGUI.py
r2163 r2165 411 411 elif generalData['Type'] == 'faulted': 412 412 G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadDIFFaX, id=G2gd.wxID_LOADDIFFAX) 413 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSimulate, id=G2gd.wxID_LAYERSIMULATE) 413 414 if 'Wave Data' in pages: 414 415 pass … … 2397 2398 transTypes = [wg.GRID_VALUE_FLOAT+':10,3',]+3*[wg.GRID_VALUE_FLOAT+':10,5',]+ \ 2398 2399 [wg.GRID_VALUE_CHOICE+": ,P,PX,PY,PZ,PXY,PXZ,PYZ,PXYZ,X,Y,Z,XY,XZ,YZ,XYZ",wg.GRID_VALUE_BOOL,] 2399 plotDefaults = {'oldxy':[0.,0.],'Quaternion':[0.,0.,0.,1.],'cameraPos':30.,'viewDir':[0,0,1],} 2400 plotDefaults = {'oldxy':[0.,0.],'Quaternion':[0.,0.,0.,1.],'cameraPos':30.,'viewDir':[0,0,1], 2401 'viewPoint':[[0.,0.,0.],[]],} 2400 2402 2401 2403 def OnLaue(event): … … 2852 2854 dlg.Destroy() 2853 2855 wx.CallAfter(UpdateLayerData) 2856 2857 def OnSimulate(event): 2858 print 'simulate PWDR pattern' 2854 2859 2855 2860 ################################################################################ … … 6972 6977 FillSelectPageMenu(TabSelectionIdDict, G2frame.dataFrame.WavesData) 6973 6978 G2frame.dataFrame.Bind(wx.EVT_MENU, OnWaveVary, id=G2gd.wxID_WAVEVARY) 6974 # Stacking faults 6979 # Stacking faults wxID_LAYERSIMULATE 6975 6980 if data['General']['Type'] == 'faulted': 6976 6981 FillSelectPageMenu(TabSelectionIdDict, G2frame.dataFrame.LayerData) 6977 6982 G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadDIFFaX, id=G2gd.wxID_LOADDIFFAX) 6983 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSimulate, id=G2gd.wxID_LAYERSIMULATE) 6978 6984 # Draw Options 6979 6985 FillSelectPageMenu(TabSelectionIdDict, G2frame.dataFrame.DataDrawOptions) -
trunk/GSASIIplot.py
r2163 r2165 66 66 GkDelta = unichr(0x0394) 67 67 Gkrho = unichr(0x03C1) 68 nxs = np.newaxis 68 69 69 70 class G2PlotMpl(wx.Panel): … … 5803 5804 AtInfo = Layers['AtInfo'] 5804 5805 Names = [layer['Name'] for layer in Layers['Layers']] 5805 atNames = []5806 atTypes = []5806 AtNames = [] 5807 AtTypes = [] 5807 5808 newXYZ = np.zeros((0,3)) 5808 5809 TX = np.zeros(3) 5809 for il,layer in enumerate(laySeq): 5810 for il in range(len(laySeq)): 5811 layer = laySeq[il] 5810 5812 if Layers['Layers'][layer]['SameAs']: 5811 layer = Names.index(Layers['Layers'][layer]['SameAs'])5812 atNames += [atom[0] for atom in Layers['Layers'][layer]['Atoms']]5813 atTypes += [atom[1] for atom in Layers['Layers'][layer]['Atoms']]5814 XYZ = np.array([atom[3:6] for atom in Layers['Layers'][layer]['Atoms']]) +TX5813 alayer = Names.index(Layers['Layers'][layer]['SameAs']) 5814 atNames = [atom[0] for atom in Layers['Layers'][layer]['Atoms']] 5815 atTypes = [atom[1] for atom in Layers['Layers'][layer]['Atoms']] 5816 XYZ = np.array([atom[3:6] for atom in Layers['Layers'][layer]['Atoms']]) 5815 5817 if '-1' in Layers['Layers'][layer]['Symm']: 5816 5818 atNames += atNames … … 5818 5820 XYZ = np.concatenate((XYZ,-XYZ)) 5819 5821 if il: 5820 TX = np.array(Trans[laySeq[il-1]][layer][1:4]) 5821 XYZ += TX 5822 TX += np.array(Trans[laySeq[il-1]][layer][1:4]) 5823 XYZ += TX 5824 XYZT = XYZ.T 5825 XYZT[0] = XYZT[0]%1. 5826 XYZT[1] = XYZT[1]%1. 5827 XYZ = XYZT.T 5828 AtNames += atNames 5829 AtTypes += atTypes 5822 5830 newXYZ = np.concatenate((newXYZ,XYZ)) 5823 5831 XYZ = newXYZ … … 5828 5836 indB = range(-nb,nb) 5829 5837 Units = np.array([[h,k,0] for h in indA for k in indB]) 5830 newXYZ = np. copy(XYZ)5838 newXYZ = np.zeros((0,3)) 5831 5839 for unit in Units: 5832 if np.any(unit): 5833 newXYZ = np.concatenate((newXYZ,unit+XYZ)) 5840 newXYZ = np.concatenate((newXYZ,unit+XYZ)) 5834 5841 if len(Units): 5835 atNames *= len(Units)5836 atTypes *= len(Units)5842 AtNames *= len(Units) 5843 AtTypes *= len(Units) 5837 5844 XYZ = newXYZ 5838 Bonds = FindBonds( atTypes,XYZ)5845 Bonds = FindBonds(AtTypes,XYZ) 5839 5846 5840 5847 def OnMouseDown(event): … … 5850 5857 Q = defaults['Quaternion'] 5851 5858 G2frame.G2plotNB.status.SetStatusText('New quaternion: %.2f+, %.2fi+ ,%.2fj+, %.2fk'%(Q[0],Q[1],Q[2],Q[3]),1) 5859 elif event.RightIsDown(): 5860 SetTranslation(newxy) 5861 Tx,Ty,Tz = defaults['viewPoint'][0] 5852 5862 elif event.MiddleIsDown(): 5853 5863 SetRotationZ(newxy) … … 5875 5885 glLightfv(GL_LIGHT0,GL_AMBIENT,[1,1,1,.8]) 5876 5886 glLightfv(GL_LIGHT0,GL_DIFFUSE,[1,1,1,1]) 5887 5888 def SetTranslation(newxy): 5889 #first get translation vector in screen coords. 5890 oldxy = defaults['oldxy'] 5891 if not len(oldxy): oldxy = list(newxy) 5892 dxy = newxy-oldxy 5893 defaults['oldxy'] = list(newxy) 5894 V = np.array([-dxy[0],dxy[1],0.]) 5895 #then transform to rotated crystal coordinates & apply to view point 5896 Q = defaults['Quaternion'] 5897 V = np.inner(Bmat,G2mth.prodQVQ(G2mth.invQ(Q),V)) 5898 Tx,Ty,Tz = defaults['viewPoint'][0] 5899 Tx += V[0]*0.1 5900 Ty += V[1]*0.1 5901 Tz += V[2]*0.1 5902 defaults['viewPoint'][0] = np.array([Tx,Ty,Tz]) 5877 5903 5878 5904 def SetRotation(newxy): … … 6007 6033 for iat,atom in enumerate(XYZ): 6008 6034 x,y,z = atom 6009 CL = AtInfo[ atTypes[iat]]['Color']6035 CL = AtInfo[AtTypes[iat]]['Color'] 6010 6036 color = np.array(CL)/255. 6011 6037 RenderSphere(x,y,z,radius,color) 6012 6038 RenderBonds(x,y,z,Bonds[iat],0.05,color) 6013 RenderLabel(x,y,z,' '+ atNames[iat],matRot)6039 RenderLabel(x,y,z,' '+AtNames[iat],matRot) 6014 6040 if Page.context: Page.canvas.SetCurrent(Page.context) # wx 2.9 fix 6015 6041 Page.canvas.SwapBuffers()
Note: See TracChangeset
for help on using the changeset viewer.