Changeset 1465


Ignore:
Timestamp:
Aug 18, 2014 10:06:22 AM (9 years ago)
Author:
vondreele
Message:

added mod to ImageIntegrate? requested by Steven Weigand - return NST array if requested.
Powder extinction now correct for TOF - not same as for GSAS; that code has an error!

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r1405 r1465  
    822822    return tax,tay,taz,tad,tabs
    823823   
    824 def ImageIntegrate(image,data,masks,blkSize=128,dlg=None):
     824def ImageIntegrate(image,data,masks,blkSize=128,dlg=None,returnN=False):
    825825    'Needs a doc string'    #for q, log(q) bins need data['binType']
    826826    import histogram2d as h2d
     
    896896    H0 = np.divide(H0,NST)
    897897    H0 = np.nan_to_num(H0)
    898     del NST
    899898    H2 = np.array([tth for tth in np.linspace(lutth[0],lutth[1],numChans+1)])
    900899    if 'log(q)' in data['binType']:
     
    922921    print "Elapsed time:","%8.3fs"%(time.time()-tbeg)
    923922    print 'Integration complete'
    924     return H0,H1,H2
     923    if returnN:     #As requested by Steven Weigand
     924        return H0,H1,H2,NST
     925    else:
     926        return H0,H1,H2
    925927   
    926928def MakeStrStaRing(ring,Image,Controls):
  • trunk/GSASIIstrMath.py

    r1464 r1465  
    799799   
    800800def SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varyList):
    801     ''' Single crystal extinction function; puts correction in ref[11] and returns
    802     corrections needed for derivatives
     801    ''' Single crystal extinction function; returns extinction & derivative
    803802    '''
    804803    extCor = 1.0
     
    10741073    'Needs a doc string'
    10751074    coef = np.array([-0.5,0.25,-0.10416667,0.036458333,-0.0109375,2.8497409E-3])
    1076     pi2 = np.sqrt(np.pi/2.)
     1075    pi2 = np.sqrt(2./np.pi)
    10771076    if 'T' in calcControls[hfx+'histType']:
    10781077        sth2 = sind(parmDict[hfx+'2-theta']/2.)**2
    1079         wave = refl[12]
     1078        wave = refl[14]
    10801079    else:   #'C'W
    10811080        sth2 = sind(refl[5]/2.)**2
     
    11001099def GetPwdrExtDerv(refl,pfx,phfx,hfx,calcControls,parmDict):
    11011100    'Needs a doc string'
    1102     coef = np.array([-0.5,0.25,-0.10416667,0.036458333,-0.0109375,2.8497409E-3])
    1103     pi2 = np.sqrt(np.pi/2.)
    1104     if 'T' in calcControls[hfx+'histType']:
    1105         sth2 = sind(parmDict[hfx+'2-theta']/2.)**2
    1106         wave = refl[12]
    1107     else:   #'C'W
    1108         sth2 = sind(refl[5]/2.)**2
    1109         wave = parmDict.get(hfx+'Lam',parmDict.get(hfx+'Lam1',1.0))
    1110     c2th = 1.-2.0*sth2
    1111     flv2 = refl[9]*(wave/parmDict[pfx+'Vol'])**2
    1112     return 0.
    1113 #
    1114 #      STH2 = STHETA**2
    1115 #      C2TH = 1-2.0*STH2
    1116 #      FLV2 = FCSQ*(LAM/VOL(IPHAS))**2
    1117 #      IF ( HTYPE(2:2).EQ.'X' ) FLV2 = 0.079411*FLV2*(1.0+C2TH**2)/2.0
    1118 #      XFAC = FLV2*EXTPOWD(IHST,IPHAS)
    1119 #      IF ( XFAC.LE.-1.0 ) THEN
    1120 #        EXB = 1.0
    1121 #        DBDE = -500.0*FLV2
    1122 #      ELSE
    1123 #        EXB = 1.0/SQRT(1.0+XFAC)
    1124 #        DBDE = -0.5*FLV2*EXB**3
    1125 #      END IF
    1126 #      IF ( XFAC.LE.0.0 ) THEN
    1127 #        EXL = 1.0
    1128 #        DLDE = 0.0
    1129 #      ELSE IF ( XFAC.LE.1.0 ) THEN
    1130 #        EXL = 1.0
    1131 #        DLDE = 0.0
    1132 #        DO I=1,6
    1133 #          XN =XFAC**I
    1134 #          EXL = EXL+COEF(I)*XN
    1135 #          DLDE = DLDE+FLOAT(I)*FLV2*COEF(I)*XN/XFAC
    1136 #        END DO
    1137 #      ELSE
    1138 #        XFAC2 = 1.0/SQRT(XFAC)
    1139 #        EXL = PI2*(1.0-0.125/XFAC)*XFAC2
    1140 #        DLDE = 0.5*FLV2*PI2*XFAC2*(-1.0/XFAC+0.375/XFAC**2)
    1141 #      END IF
    1142 #      EXTCOR = EXB*STH2+EXL*(1.0-STH2)
    1143 #      DFDEX = DBDE*STH2+DLDE*(1.0-STH2)
     1101    delt = 0.001
     1102    parmDict[phfx+'Extinction'] += delt
     1103    plus = GetPwdrExt(refl,pfx,phfx,hfx,calcControls,parmDict)
     1104    parmDict[phfx+'Extinction'] -= 2.*delt
     1105    minus = GetPwdrExt(refl,pfx,phfx,hfx,calcControls,parmDict)
     1106    parmDict[phfx+'Extinction'] += delt
     1107    return (plus-minus)/(2.*delt)   
    11441108   
    11451109def GetIntensityCorr(refl,uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict):
     
    11861150            dIdPO[iPO] /= POcorr
    11871151    dFdAb = GetAbsorbDerv(refl,hfx,calcControls,parmDict)*refl[14]/refl[16] #wave/abs corr
    1188     dFdEx = GetPwdrExtDerv(refl,pfx,phfx,hfx,calcControls,parmDict)
     1152    dFdEx = GetPwdrExtDerv(refl,pfx,phfx,hfx,calcControls,parmDict)/refl[17]    #/ext corr
    11891153    return dIdsh,dIdsp,dIdPola,dIdPO,dFdODF,dFdSA,dFdAb,dFdEx
    11901154       
     
    18851849                    hfx+'beta-q':[1./refl[4]**2,'bet'],hfx+'sig-0':[1.0,'sig'],hfx+'sig-1':[refl[4]**2,'sig'],
    18861850                    hfx+'sig-2':[refl[4]**4,'sig'],hfx+'sig-q':[1./refl[4]**2,'sig'],
    1887                     hfx+'Absorption':[dFdAb,'int'],hfx+'Extinction':[dFdEx,'int'],}
     1851                    hfx+'Absorption':[dFdAb,'int'],phfx+'Extinction':[dFdEx,'int'],}
    18881852            for name in names:
    18891853                item = names[name]
Note: See TracChangeset for help on using the changeset viewer.