Changeset 4520 for trunk/GSASIImpsubs.py


Ignore:
Timestamp:
Jul 14, 2020 4:08:55 PM (17 months ago)
Author:
vondreele
Message:

some corrections for pink beam single peak fits
implement pink beam Rietveld refinement; function ok, but all bad derivatives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImpsubs.py

    r4021 r4520  
    115115    return sInt,resList
    116116       
     117def ComputeFobsSqPinkbatch(profList):
     118    sInt = 0
     119    resList = []
     120    for refl,iref in profList:
     121        icod = ComputeFobsSqPink(refl,iref)
     122        if type(icod) is tuple:
     123            resList.append((icod[0],iref))
     124            sInt += icod[1]
     125        elif icod == -1:
     126            resList.append((None,iref))
     127        elif icod == -2:
     128            break
     129    return sInt,resList
     130
    117131def ComputeFobsSqCW(refl,iref):
    118132    yp = np.zeros(len(x)) # not masked
     
    162176    refl8im = np.sum(np.where(ratio[iBeg:iFin]>0.,yp[iBeg:iFin]*ratio[iBeg:iFin]/refl[11+im],0.0))
    163177    return refl8im,refl[11+im]*refl[9+im]
     178
     179def ComputeFobsSqPink(refl,iref):
     180    yp = np.zeros(len(x)) # not masked
     181    refl8im = 0
     182    Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/100.,refl[7+im]/1.e4)
     183    iBeg = max(xB,np.searchsorted(x,refl[5+im]-fmin))
     184    iFin = max(xB,min(np.searchsorted(x,refl[5+im]+fmax),xF))
     185    if not iBeg+iFin:       #peak below low limit - skip peak
     186        return 0
     187    if ma.all(xMask[iBeg:iFin]):    #peak entirely masked - skip peak
     188        return -1
     189    elif not iBeg-iFin:     #peak above high limit - done
     190        return -2
     191    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    refl8im = np.sum(np.where(ratio[iBeg:iFin]>0.,yp[iBeg:iFin]*ratio[iBeg:iFin]/refl[11+im],0.0))
     195    return refl8im,refl[11+im]*refl[9+im]
     196
    164197################################################################################
    165198# Powder Profile computation
     
    195228    return yc
    196229   
     230def ComputePwdrProfPink(profList):
     231    'Compute the peaks profile for a set of TOF peaks and add into the yc array'
     232    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]
     235    return yc
Note: See TracChangeset for help on using the changeset viewer.