Changeset 4570
- Timestamp:
- Sep 16, 2020 9:04:32 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIimage.py
r4569 r4570 1507 1507 break 1508 1508 return mask 1509 1510 def DoPolaCalib(ImageZ,imageData,arcTth): 1511 ''' Determine image polarization by successive integrations with & without preset arc mask. 1512 ''' 1513 from scipy.optimize import minimize_scalar 1514 Arc = [arcTth,[45.,135.],2.0] 1515 Masks = {'Points':[],'Rings':[],'Arcs':[],'Polygons':[],'Frames':[], 1516 'Thresholds':imageData['range'],'SpotMask':{'esdMul':3.,'spotMask':None}} 1517 AMasks = {'Points':[],'Rings':[],'Arcs':[Arc,],'Polygons':[],'Frames':[], 1518 'Thresholds':imageData['range'],'SpotMask':{'esdMul':3.,'spotMask':None}} 1519 data = copy.deepcopy(imageData) 1520 1521 def func(p): 1522 p = min(1.0,max(p,0.0)) 1523 data['PolaVal'][0] = p 1524 H0 = ImageIntegrate(ImageZ,data,Masks)[0] 1525 H0A = ImageIntegrate(ImageZ,data,AMasks)[0] 1526 M = np.sum(H0-H0A) 1527 print('polarization %.4f, fxn: %.1f'%(p,M)) 1528 return M**2 1529 1530 res = minimize_scalar(func,bracket=[1.,.999],tol=.0001) 1531 print(res) 1532 pola = min(1.0,max(res.x,.0)) 1533 imageData['PolaVal'][0] = pola -
trunk/GSASIIimgGUI.py
r4546 r4570 136 136 G2plt.PlotExposedImage(G2frame,newPlot=True,event=tc.event) 137 137 138 #G2frame.dataWindow.ClearData() 138 def OnPolaCalib(event): 139 IOtth = [data['IOtth'][0]+2.,data['IOtth'][1]-2.] 140 dlg = G2G.SingleFloatDialog(G2frame,'Polarization test arc mask', 141 ''' Do not use if pattern has uneven absorption 142 Set 2-theta max in image controls to be fully inside image 143 Enter 2-theta position for arc mask (%.1f-%.1f) '''%(IOtth[0],IOtth[1]),IOtth[1],IOtth,format='%.2f') 144 if dlg.ShowModal() == wx.ID_OK: 145 arcTth = dlg.GetValue() 146 G2fil.G2SetPrintLevel('none') 147 G2img.DoPolaCalib(G2frame.ImageZ,data,arcTth) 148 G2fil.G2SetPrintLevel('all') 149 UpdateImageData(G2frame,data) 150 dlg.Destroy() 151 152 G2frame.dataWindow.ClearData() 139 153 G2frame.ImageZ = GetImageZ(G2frame,data) 140 154 mainSizer = G2frame.dataWindow.GetSizer() … … 161 175 distSizer.Add(G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['PolaVal'],0,nDig=(10,4), 162 176 xmin=0.,xmax=1.,typeHint=float),0,WACV) 177 polaCalib = wx.Button(G2frame.dataWindow,label='Calibrate?') 178 polaCalib.Bind(wx.EVT_BUTTON,OnPolaCalib) 179 distSizer.Add(polaCalib,0,WACV) 163 180 mainSizer.Add(distSizer,0) 164 181 if 'samplechangerpos' not in data or data['samplechangerpos'] is None: 165 182 data['samplechangerpos'] = 0.0 166 183 mainSizer.Add(wx.StaticText(G2frame.dataWindow,label='Sample changer position %.2f mm'%data['samplechangerpos']),0,WACV) 184 G2frame.dataWindow.SetDataSize() 167 185 168 186 ################################################################################ -
trunk/GSASIIphsGUI.py
r4568 r4570 11728 11728 const = 9.e-2/(np.pi*Sample['Gonio. radius']) #shifts in microns 11729 11729 gconst = 2.35482 # sqrt(8 ln 2) 11730 dx = (xdata[0][1]-xdata[0][0])*20. #this ian approximation - not correct, but CW seems to be needed 11731 gconst *= dx 11730 11732 11731 11733 wx.BeginBusyCursor()
Note: See TracChangeset
for help on using the changeset viewer.