Changeset 4571


Ignore:
Timestamp:
Sep 17, 2020 3:50:24 PM (3 years ago)
Author:
vondreele
Message:

Improvements to polarization stuff

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r4570 r4571  
    12171217    #prepare masked arrays of bins with pixels for interpolation setup
    12181218    H2msk = [ma.array(H2[:-1],mask=np.logical_not(nst)) for nst in NST]
    1219     H0msk = [ma.array(np.divide(h0,nst),mask=np.logical_not(nst)) for nst,h0 in zip(NST,H0)]
     1219#    H0msk = [ma.array(np.divide(h0,nst),mask=np.logical_not(nst)) for nst,h0 in zip(NST,H0)]
     1220    H0msk = [ma.array(h0/nst,mask=np.logical_not(nst)) for nst,h0 in zip(NST,H0)]
    12201221    #make linear interpolators; outside limits give NaN
    12211222    H0 = []
     
    15121513    '''
    15131514    from scipy.optimize import minimize_scalar
    1514     Arc = [arcTth,[45.,135.],2.0]
     1515    print(' Polarization fit for mask at %.1f deg 2-theta'%arcTth)
     1516    data = copy.deepcopy(imageData)
     1517    data['IOtth'] = [arcTth-2.,arcTth+2.]
     1518    data['fullIntegrate'] = True
     1519    data['LRazimuth'] = [0.,360.]
     1520    data['outChannels'] = 200
     1521    data['outAzimuths'] = 1
     1522    Arc = [arcTth,[85.,95.],2.0]
     1523    print(' Integration 2-theta test range %.1f - %.1f in 200 steps'%(data['IOtth'][0],data['IOtth'][1]))
    15151524    Masks = {'Points':[],'Rings':[],'Arcs':[],'Polygons':[],'Frames':[],
    15161525        'Thresholds':imageData['range'],'SpotMask':{'esdMul':3.,'spotMask':None}}
    15171526    AMasks = {'Points':[],'Rings':[],'Arcs':[Arc,],'Polygons':[],'Frames':[],
    15181527        'Thresholds':imageData['range'],'SpotMask':{'esdMul':3.,'spotMask':None}}
    1519     data = copy.deepcopy(imageData)
    15201528   
    15211529    def func(p):
     
    15241532        H0 = ImageIntegrate(ImageZ,data,Masks)[0]
    15251533        H0A = ImageIntegrate(ImageZ,data,AMasks)[0]
    1526         M = np.sum(H0-H0A)
    1527         print('polarization %.4f, fxn: %.1f'%(p,M))
     1534        M = np.sum(H0)-np.sum(H0A)
     1535        print(' Polarization %.4f, fxn: %.1f'%(p,M))
    15281536        return M**2
    15291537   
  • trunk/GSASIIimgGUI.py

    r4570 r4571  
    137137       
    138138    def OnPolaCalib(event):
    139         IOtth = [data['IOtth'][0]+2.,data['IOtth'][1]-2.]
     139        if data['IOtth'][1] < 34.:
     140            G2G.G2MessageBox(G2frame,'Maximum 2-theta not greater than 34 deg',
     141                    'Polarization Calibration Error')
     142            return
     143        IOtth = [32.,data['IOtth'][1]-2.]
    140144        dlg = G2G.SingleFloatDialog(G2frame,'Polarization test arc mask',
    141145''' 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')
     146 Set 2-theta max in image controls to be fully inside image
     147 Enter 2-theta position for arc mask (32-%.1f) '''%IOtth[1],IOtth[1],IOtth,format='%.2f')
    144148        if dlg.ShowModal() == wx.ID_OK:
    145149            arcTth = dlg.GetValue()
  • trunk/GSASIIpwd.py

    r4536 r4571  
    237237
    238238    """
    239     cazm = npcosd(Azm)
    240     sazm = npsind(Azm)
    241     pola = ((1.0-Pola)*cazm**2+Pola*npsind(Azm)**2)*npcosd(Tth)**2+   \
    242         (1.0-Pola)*sazm**2+Pola*cazm**2
    243     dpdPola = -npsind(Tth)**2*(sazm**2-cazm**2)
     239    cazm = npcosd(Azm)**2
     240    sazm = npsind(Azm)**2
     241    pola = ((1.0-Pola)*cazm+Pola*sazm)*npcosd(Tth)**2+(1.0-Pola)*sazm+Pola*cazm
     242    dpdPola = -npsind(Tth)**2*(sazm-cazm)
    244243    return pola,dpdPola
    245244   
Note: See TracChangeset for help on using the changeset viewer.