Changeset 1134
- Timestamp:
- Nov 2, 2013 9:26:50 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIimgGUI.py
r1131 r1134 200 200 keys = ['type','wavelength','calibrant','distance','center', 201 201 'tilt','rotation','azmthOff','fullIntegrate','LRazimuth', 202 'IOtth','outAzimuths' ]202 'IOtth','outAzimuths','invert_x','invert_y'] 203 203 for key in keys: 204 204 if key in ['rotation']: … … 211 211 212 212 def OnLoadControls(event): 213 cntlList = ['wavelength','distance','tilt','rotation',214 'fullIntegrate','outAzimuths','LRazimuth','IOtth' ]213 cntlList = 'wavelength','distance','tilt','invert_x','invert_y', 214 'fullIntegrate','outAzimuths','LRazimuth','IOtth','azmthOff'] 215 215 dlg = wx.FileDialog(G2frame, 'Choose image controls file', '.', '', 216 216 'image control files (*.imctrl)|*.imctrl',wx.OPEN|wx.CHANGE_DIR) -
trunk/GSASIIplot.py
r1131 r1134 243 243 to F, F**2, etc. as requested 244 244 ''' 245 from matplotlib.patches import Circle 245 from matplotlib.patches import Circle,CirclePolygon 246 246 global HKL,HKLF 247 247 … … 316 316 HKL = [] 317 317 HKLF = [] 318 time0 = time.time() 318 319 for refl in HKLref: 319 320 H = np.array(refl[:3]) … … 367 368 else: 368 369 Plot.add_artist(Circle(xy,radius=radius,ec='r',fc='r')) 370 # print 'plot time: %.3f'%(time.time()-time0) 369 371 HKL = np.array(HKL,dtype=np.int) 370 372 HKLF = np.array(HKLF) … … 2116 2118 Data = G2frame.PatternTree.GetItemPyData( 2117 2119 G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Image Controls')) 2120 # patch 2121 if 'invert_x' not in Data: 2122 Data['invert_x'] = False 2123 Data['invert_y'] = True 2124 # end patch 2118 2125 Masks = G2frame.PatternTree.GetItemPyData( 2119 2126 G2gd.GetPatternTreeItemId(G2frame,G2frame.Image, 'Masks')) … … 2172 2179 2173 2180 elif PickName == 'Image Controls': 2174 if event.key == 'c':2181 if event.key in ['c',]: 2175 2182 Xpos = event.xdata 2176 2183 if not Xpos: #got point out of frame … … 2191 2198 else: 2192 2199 G2frame.logPlot = True 2193 PlotImage(G2frame,newImage=True) 2200 elif event.key in ['x',]: 2201 if Data['invert_x']: 2202 Data['invert_x'] = False 2203 else: 2204 Data['invert_x'] = True 2205 elif event.key in ['y',]: 2206 if Data['invert_y']: 2207 Data['invert_y'] = False 2208 else: 2209 Data['invert_y'] = True 2210 PlotImage(G2frame,newPlot=True) 2194 2211 2195 2212 def OnKeyBox(event): … … 2197 2214 event.key = cb.GetValue()[0] 2198 2215 cb.SetValue(' key press') 2199 if event.key in 'l':2216 if event.key in ['l','s','a','r','p','x','y']: 2200 2217 wx.CallAfter(OnImPlotKeyPress,event) 2201 2218 Page.canvas.SetFocus() # redirect the Focus from the button back to the plot … … 2405 2422 try: 2406 2423 if G2frame.PatternTree.GetItemText(G2frame.PickId) in ['Image Controls',]: 2407 Page.Choice = (' key press','l: log(I) on', )2424 Page.Choice = (' key press','l: log(I) on','x: flip x','y: flip y',) 2408 2425 if G2frame.logPlot: 2409 2426 Page.Choice[1] = 'l: log(I) off' … … 2567 2584 Plot.set_xlim(xlim) 2568 2585 Plot.set_ylim(ylim) 2569 Plot.invert_yaxis() 2586 if Data['invert_x']: 2587 Plot.invert_xaxis() 2588 if Data['invert_y']: 2589 Plot.invert_yaxis() 2570 2590 if not newPlot and xylim: 2571 2591 Page.toolbar.push_current() -
trunk/GSASIIstrMath.py
r1125 r1134 647 647 refDict['ifNew'] = True 648 648 #reflection processing begins here - big arrays! 649 refl = refDict['RefList'] 650 H = refl.T[:3] 651 SQ = 1./(2.*refl.T[4])**2 652 SQfactor = 4.0*SQ*twopisq 653 Bab = np.repeat(parmDict[phfx+'BabA']*np.exp(-parmDict[phfx+'BabU']*SQfactor),len(SGT)) 654 if refDict['ifNew']: #no form factors - 1st time thru StructureFactor 655 for iref in range(len(refl)): 656 if 'X' in calcControls[hfx+'histType']: 657 dat = G2el.getFFvalues(FFtables,SQ[iref]) 658 refDict['FF']['FF'][iref] *= dat.values() 659 refDict['ifNew'] = False 660 Tindx = np.array([refDict['FF']['El'].index(El) for El in Tdata]) 661 FF = np.repeat(refDict['FF']['FF'].T[Tindx].T,len(SGT),axis=0) 662 Uniq = np.reshape(np.inner(H.T,SGMT),(-1,3)) 663 Phi = np.inner(H.T,SGT).flatten() 664 phase = twopi*(np.inner(Uniq,(dXdata+Xdata).T)+Phi[:,np.newaxis]) 665 sinp = np.sin(phase) 666 cosp = np.cos(phase) 667 biso = -SQfactor*Uisodata[:,np.newaxis] 668 Tiso = np.repeat(np.where(biso<1.,np.exp(biso),1.0),len(SGT),axis=1).T 669 HbH = -np.sum(Uniq.T*np.inner(bij,Uniq),axis=1) 670 Tuij = np.where(HbH<1.,np.exp(HbH),1.0).T 671 Tcorr = Tiso*Tuij*Mdata*Fdata/len(SGMT) 672 fa = np.array([((FF+FP).T-Bab).T*cosp*Tcorr,-FPP*sinp*Tcorr]) 673 fa = np.reshape(fa,(2,len(refl),len(SGT),len(Mdata))) 674 fas = np.sum(np.sum(fa,axis=2),axis=2) #real 675 fbs = np.zeros_like(fas) 676 if not SGData['SGInv']: 677 fb = np.array([((FF+FP).T-Bab).T*sinp*Tcorr,FPP*cosp*Tcorr]) 678 fb = np.reshape(fb,(2,len(refl),len(SGT),len(Mdata))) 679 fbs = np.sum(np.sum(fb,axis=2),axis=2) 680 fasq = fas**2 681 fbsq = fbs**2 #imaginary 649 try: 650 refl = refDict['RefList'] 651 H = refl.T[:3] 652 SQ = 1./(2.*refl.T[4])**2 653 SQfactor = 4.0*SQ*twopisq 654 Bab = np.repeat(parmDict[phfx+'BabA']*np.exp(-parmDict[phfx+'BabU']*SQfactor),len(SGT)) 655 if refDict['ifNew']: #no form factors - 1st time thru StructureFactor 656 for iref in range(len(refl)): 657 if 'X' in calcControls[hfx+'histType']: 658 dat = G2el.getFFvalues(FFtables,SQ[iref]) 659 refDict['FF']['FF'][iref] *= dat.values() 660 refDict['ifNew'] = False 661 Tindx = np.array([refDict['FF']['El'].index(El) for El in Tdata]) 662 FF = np.repeat(refDict['FF']['FF'].T[Tindx].T,len(SGT),axis=0) 663 Uniq = np.reshape(np.inner(H.T,SGMT),(-1,3)) 664 Phi = np.inner(H.T,SGT).flatten() 665 phase = twopi*(np.inner(Uniq,(dXdata+Xdata).T)+Phi[:,np.newaxis]) 666 sinp = np.sin(phase) 667 cosp = np.cos(phase) 668 biso = -SQfactor*Uisodata[:,np.newaxis] 669 Tiso = np.repeat(np.where(biso<1.,np.exp(biso),1.0),len(SGT),axis=1).T 670 HbH = -np.sum(Uniq.T*np.inner(bij,Uniq),axis=1) 671 Tuij = np.where(HbH<1.,np.exp(HbH),1.0).T 672 Tcorr = Tiso*Tuij*Mdata*Fdata/len(SGMT) 673 fa = np.array([((FF+FP).T-Bab).T*cosp*Tcorr,-FPP*sinp*Tcorr]) 674 fa = np.reshape(fa,(2,len(refl),len(SGT),len(Mdata))) 675 fas = np.sum(np.sum(fa,axis=2),axis=2) #real 676 fbs = np.zeros_like(fas) 677 if not SGData['SGInv']: 678 fb = np.array([((FF+FP).T-Bab).T*sinp*Tcorr,FPP*cosp*Tcorr]) 679 fb = np.reshape(fb,(2,len(refl),len(SGT),len(Mdata))) 680 fbs = np.sum(np.sum(fb,axis=2),axis=2) 681 fasq = fas**2 682 fbsq = fbs**2 #imaginary 683 except MemoryError: 684 print '**** ERROR - insufficient memory for this size problem; try 64-bit version of GSAS-II****' 685 return 682 686 refl.T[9] = np.sum(fasq,axis=0)+np.sum(fbsq,axis=0) 683 687 refl.T[10] = atan2d(fbs[0],fas[0])
Note: See TracChangeset
for help on using the changeset viewer.