Changeset 4572 for trunk/GSASIIimage.py


Ignore:
Timestamp:
Sep 18, 2020 3:22:51 PM (3 years ago)
Author:
vondreele
Message:

Further enhancements to polarization analysis - now automatic & makes mean(std) estimates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r4571 r4572  
    15111511def DoPolaCalib(ImageZ,imageData,arcTth):
    15121512    ''' Determine image polarization by successive integrations with & without preset arc mask.
     1513    After initial search, does a set of five with offset azimuth to get mean(std) result.
    15131514    '''
    15141515    from scipy.optimize import minimize_scalar
     
    15221523    Arc = [arcTth,[85.,95.],2.0]
    15231524    print(' Integration 2-theta test range %.1f - %.1f in 200 steps'%(data['IOtth'][0],data['IOtth'][1]))
     1525    print(' Mask azimuth range: %.1f - %.1f'%(Arc[1][0],Arc[1][1]))
    15241526    Masks = {'Points':[],'Rings':[],'Arcs':[],'Polygons':[],'Frames':[],
    15251527        'Thresholds':imageData['range'],'SpotMask':{'esdMul':3.,'spotMask':None}}
     
    15351537        print(' Polarization %.4f, fxn: %.1f'%(p,M))
    15361538        return M**2
    1537    
     1539    time0 = time.time()
    15381540    res = minimize_scalar(func,bracket=[1.,.999],tol=.0001)
    15391541    print(res)
    15401542    pola = min(1.0,max(res.x,.0))
    1541     imageData['PolaVal'][0] = pola
     1543   
     1544    Pola = []
     1545    for arc in [75,80,85,90,95]:
     1546        Arc = [arcTth,[arc,arc+10.],2.0]
     1547        AMasks = {'Points':[],'Rings':[],'Arcs':[Arc,],'Polygons':[],'Frames':[],
     1548            'Thresholds':imageData['range'],'SpotMask':{'esdMul':3.,'spotMask':None}}
     1549        res = minimize_scalar(func,bracket=[pola-.001,pola],tol=.0001)
     1550        print(' Mask azimuth range: %.1f - %.1f'%(Arc[1][0],Arc[1][1]))
     1551        print(' pola: %.5f'%res.x)
     1552        Pola.append(res.x)
     1553    Pola = np.array(Pola)
     1554    mean = np.mean(Pola)
     1555    std = int(10000*np.std(Pola))
     1556    print(' Polarization: %.4f(%d)'%(mean,std))
     1557    print(' time: %.2fs'%(time.time()-time0))
     1558    imageData['PolaVal'][0] = mean
     1559   
Note: See TracChangeset for help on using the changeset viewer.