Changeset 4919 for trunk/GSASIImpsubs.py


Ignore:
Timestamp:
Jun 3, 2021 10:12:41 AM (5 months ago)
Author:
vondreele
Message:

change powder peak shape functions to include effect of varying step size.
Impacts scale factors & peak intensities.
New notification system invoked to let users know of change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImpsubs.py

    r4800 r4919  
    7575    Puts lots of junk into the global namespace in this module.
    7676    '''
    77     global x,ratio,shl,xB,xF,im,lamRatio,kRatio,xMask,Ka2
     77    global x,ratio,shl,xB,xF,im,lamRatio,kRatio,xMask,Ka2,cw
    7878    x = ma.getdata(x1)
     79    cw = np.diff(x)
     80    cw = np.append(cw,cw[-1])
    7981    ratio = ratio1
    8082    shl = shl1
     
    144146        return -2
    145147    elif iBeg < iFin:
    146         yp[iBeg:iFin] = refl[11+im]*refl[9+im]*G2pwd.getFCJVoigt3(
    147             refl[5+im],refl[6+im],refl[7+im],shl,x[iBeg:iFin])
     148        fp,sumfp = G2pwd.getFCJVoigt3(refl[5+im],refl[6+im],refl[7+im],shl,x[iBeg:iFin])
     149        yp[iBeg:iFin] = 100.*refl[11+im]*refl[9+im]*fp*cw[iBeg:iFin]/sumfp
    148150        sInt = refl[11+im]*refl[9+im]
    149151        if Ka2:
     
    152154            iBeg2 = max(xB,np.searchsorted(x,pos2-fmin))
    153155            iFin2 = min(np.searchsorted(x,pos2+fmax),xF)
    154             if iFin2 > iBeg2: 
    155                 yp[iBeg2:iFin2] += refl[11+im]*refl[9+im]*kRatio*G2pwd.getFCJVoigt3(
    156                     pos2,refl[6+im],refl[7+im],shl,x[iBeg2:iFin2])
     156            if iFin2 > iBeg2:
     157                fp2,sumfp2 = G2pwd.getFCJVoigt3(pos2,refl[6+im],refl[7+im],shl,x[iBeg2:iFin2])
     158                yp[iBeg2:iFin2] += 100.*refl[11+im]*refl[9+im]*kRatio*fp2*cw[iBeg2:iFin2]/sumfp2
    157159                sInt *= 1.+kRatio
    158160    refl8im = np.sum(np.where(ratio[iBeg:iFin2]>0.,yp[iBeg:iFin2]*ratio[iBeg:iFin2]/(refl[11+im]*(1.+kRatio)),0.0))
     
    172174        return -2
    173175    if iBeg < iFin:
    174         yp[iBeg:iFin] = refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(
    175             refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im],x[iBeg:iFin])
     176        fp,sumfp = G2pwd.getEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im],x[iBeg:iFin])
     177        yp[iBeg:iFin] = refl[11+im]*refl[9+im]*fp*cw[iBeg:iFin]/sumfp
    176178    refl8im = np.sum(np.where(ratio[iBeg:iFin]>0.,yp[iBeg:iFin]*ratio[iBeg:iFin]/refl[11+im],0.0))
    177179    return refl8im,refl[11+im]*refl[9+im]
     
    190192        return -2
    191193    if iBeg < iFin:
    192         yp[iBeg:iFin] = refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(
    193             refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,x[iBeg:iFin])
     194        fp,sumfp = G2pwd.getEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,x[iBeg:iFin])
     195        yp[iBeg:iFin] = refl[11+im]*refl[9+im]*fp*cw[iBeg:iFin]/sumfp
    194196    refl8im = np.sum(np.where(ratio[iBeg:iFin]>0.,yp[iBeg:iFin]*ratio[iBeg:iFin]/refl[11+im],0.0))
    195197    return refl8im,refl[11+im]*refl[9+im]
     
    202204    Puts lots of junk into the global namespace in this module.
    203205    '''
    204     global im,shl,x
     206    global im,shl,x,cw,yc
    205207    im = im1
    206208    shl = shl1
    207209    x = ma.getdata(x1)
    208     global cw
    209210    cw = np.diff(x)
    210211    cw = np.append(cw,cw[-1])
    211212    # create local copies of ycalc array
    212     global yc
    213213    yc = np.zeros_like(x)
    214 
    215214
    216215def ComputePwdrProfCW(profList):
    217216    'Compute the peaks profile for a set of CW peaks and add into the yc array'
    218217    for pos,refl,iBeg,iFin,kRatio in profList:
    219         yc[iBeg:iFin] += refl[11+im]*refl[9+im]*kRatio*G2pwd.getFCJVoigt3(
    220             pos,refl[6+im],refl[7+im],shl,x[iBeg:iFin])
     218        fp = G2pwd.getFCJVoigt3(pos,refl[6+im],refl[7+im],shl,x[iBeg:iFin])[0]
     219        yc[iBeg:iFin] += refl[11+im]*refl[9+im]*kRatio*fp/cw[iBeg:iFin]
    221220    return yc
    222221
     
    224223    'Compute the peaks profile for a set of TOF peaks and add into the yc array'
    225224    for pos,refl,iBeg,iFin in profList:
    226         yc[iBeg:iFin] += refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(
    227             pos,refl[12+im],refl[13+im],refl[6+im],refl[7+im],x[iBeg:iFin])/cw[iBeg:iFin]
    228     return yc
     225        fp = G2pwd.getEpsVoigt(pos,refl[12+im],refl[13+im],refl[6+im],refl[7+im],x[iBeg:iFin])[0]
     226        yc[iBeg:iFin] += refl[11+im]*refl[9+im]*fp*cw[iBeg:iFin]
    229227   
    230228def ComputePwdrProfPink(profList):
    231229    'Compute the peaks profile for a set of TOF peaks and add into the yc array'
    232230    for pos,refl,iBeg,iFin in profList:
    233         yc[iBeg:iFin] += refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(
    234             pos,refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,x[iBeg:iFin])/cw[iBeg:iFin]
     231        fp = G2pwd.getEpsVoigt(pos,refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,x[iBeg:iFin])[0]
     232        yc[iBeg:iFin] += refl[11+im]*refl[9+im]*fp
    235233    return yc
Note: See TracChangeset for help on using the changeset viewer.