Changeset 4570 for trunk/GSASIIimage.py
- Timestamp:
- Sep 16, 2020 9:04:32 PM (3 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.