Changeset 1459 for trunk/GSASIIpwd.py


Ignore:
Timestamp:
Aug 8, 2014 2:59:09 PM (7 years ago)
Author:
vondreele
Message:

add instrument parameters (flight path & detector 2-theta) needed for TOF
rework reflection list for TOF
change default diff curve & reflection marker offsets
change weighting to instrument constants calibration to be 1/esd2 from peak fit positions - works a lot better
1st shot at TOF Rietveld refinement with derivatives - need to be checked for correctness (some are wrong)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r1443 r1459  
    561561            bakInt = si.interp1d(bakPos,bakVals,'linear')
    562562            yb = bakInt(xdata)
    563     if 'difC' in parmDict:
     563    if pfx+'difC' in parmDict:
    564564        ff = 1.
    565565    else:       
     
    602602    return yb
    603603   
    604 def getBackgroundDerv(pfx,parmDict,bakType,xdata):
     604def getBackgroundDerv(hfx,parmDict,bakType,xdata):
    605605    'needs a doc string'
    606606    nBak = 0
    607607    while True:
    608         key = pfx+'Back:'+str(nBak)
     608        key = hfx+'Back:'+str(nBak)
    609609        if key in parmDict:
    610610            nBak += 1
     
    612612            break
    613613    dydb = np.zeros(shape=(nBak,len(xdata)))
    614     dyddb = np.zeros(shape=(3*parmDict[pfx+'nDebye'],len(xdata)))
    615     dydpk = np.zeros(shape=(4*parmDict[pfx+'nPeaks'],len(xdata)))
     614    dyddb = np.zeros(shape=(3*parmDict[hfx+'nDebye'],len(xdata)))
     615    dydpk = np.zeros(shape=(4*parmDict[hfx+'nPeaks'],len(xdata)))
    616616    cw = np.diff(xdata)
    617617    cw = np.append(cw,cw[-1])
     
    650650                        np.where(xdata<bakPos[i+1],(bakPos[i+1]-xdata)/(bakPos[i+1]-bakPos[i]),0.),
    651651                        np.where(xdata>bakPos[i-1],(xdata-bakPos[i-1])/(bakPos[i]-bakPos[i-1]),0.))
    652     if 'difC' in parmDict:
     652    if hfx+'difC' in parmDict:
    653653        ff = 1.
    654654    else:
    655655        try:
    656             wave = parmDict[pfx+'Lam']
     656            wave = parmDict[hfx+'Lam']
    657657        except KeyError:
    658             wave = parmDict[pfx+'Lam1']
     658            wave = parmDict[hfx+'Lam1']
    659659        q = 4.0*np.pi*npsind(xdata/2.0)/wave
    660660        SQ = (q/(4*np.pi))**2
     
    664664    while True:
    665665        try:
    666             dbA = parmDict[pfx+'DebyeA:'+str(iD)]
    667             dbR = parmDict[pfx+'DebyeR:'+str(iD)]
    668             dbU = parmDict[pfx+'DebyeU:'+str(iD)]
     666            if hfx+'difC' in parmDict:
     667                q = 2*np.pi*parmDict[hfx+'difC']/xdata
     668            dbA = parmDict[hfx+'DebyeA:'+str(iD)]
     669            dbR = parmDict[hfx+'DebyeR:'+str(iD)]
     670            dbU = parmDict[hfx+'DebyeU:'+str(iD)]
    669671            sqr = np.sin(q*dbR)/(q*dbR)
    670672            cqr = np.cos(q*dbR)
     
    679681    while True:
    680682        try:
    681             pkP = parmDict[pfx+'BkPkpos;'+str(iD)]
    682             pkI = parmDict[pfx+'BkPkint;'+str(iD)]
    683             pkS = parmDict[pfx+'BkPksig;'+str(iD)]
    684             pkG = parmDict[pfx+'BkPkgam;'+str(iD)]
     683            pkP = parmDict[hfx+'BkPkpos;'+str(iD)]
     684            pkI = parmDict[hfx+'BkPkint;'+str(iD)]
     685            pkS = parmDict[hfx+'BkPksig;'+str(iD)]
     686            pkG = parmDict[hfx+'BkPkgam;'+str(iD)]
    685687            shl = 0.002
    686688            Wd,fmin,fmax = getWidthsCW(pkP,pkS,pkG,shl)
     
    11721174    peakDsp = []
    11731175    peakWt = []
    1174     for peak in IndexPeaks:
     1176    for peak,sig in zip(IndexPeaks[0],IndexPeaks[1]):
    11751177        if peak[2] and peak[3]:
    11761178            peakPos.append(peak[0])
    11771179            peakDsp.append(peak[8])
    1178             peakWt.append(1/peak[1])
     1180            peakWt.append(1/sig**2)
    11791181    peakPos = np.array(peakPos)
    11801182    peakDsp = np.array(peakDsp)
Note: See TracChangeset for help on using the changeset viewer.