Changeset 4520


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

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

Location:
trunk
Files:
5 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
  • trunk/GSASIIpwd.py

    r4519 r4520  
    801801    alpTOF = lambda dsp,alp: alp/dsp
    802802    betTOF = lambda dsp,bet0,bet1,betq: bet0+bet1/dsp**4+betq/dsp**2
     803    alpPink = lambda pos,alp0,alp1: alp0+alp1*tand(pos/2.)
     804    betPink = lambda pos,bet0,bet1: bet0+bet1*tand(pos/2.)
    803805    if 'T' in Inst['Type'][0]:
    804         dsp = pos/Inst['difC'][0]
    805         alp = alpTOF(dsp,Inst['alpha'][0])
    806         bet = betTOF(dsp,Inst['beta-0'][0],Inst['beta-1'][0],Inst['beta-q'][0])
     806        dsp = pos/Inst['difC'][1]
     807        alp = alpTOF(dsp,Inst['alpha'][1])
     808        bet = betTOF(dsp,Inst['beta-0'][1],Inst['beta-1'][1],Inst['beta-q'][1])
    807809        s = sigTOF(dsp,Inst['sig-0'][1],Inst['sig-1'][1],Inst['sig-2'][1],Inst['sig-q'][1])
    808810        g = gamTOF(dsp,Inst['X'][1],Inst['Y'][1],Inst['Z'][1])
    809811        return getgamFW(g,s)+np.log(2.0)*(alp+bet)/(alp*bet)
    810     else:
     812    elif 'C' in Inst['Type'][0]:
    811813        s = sig(pos/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1])
    812814        g = gam(pos/2.,Inst['X'][1],Inst['Y'][1],Inst['Z'][1])
    813815        return getgamFW(g,s)/100.  #returns FWHM in deg
     816    else:   #'B'
     817        alp = alpPink(pos,Inst['alpha-0'][1],Inst['alpha-1'][1])
     818        bet = betPink(pos,Inst['beta-0'][1],Inst['beta-1'][1])
     819        s = sig(pos/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1])
     820        g = gam(pos/2.,Inst['X'][1],Inst['Y'][1],Inst['Z'][1])
     821        return getgamFW(g,s)/100.+np.log(2.0)*(alp+bet)/(alp*bet)  #returns FWHM in deg
    814822   
    815823def getgamFW(g,s):
     
    965973                ybi = pkI*getFCJVoigt3(pkP,pkS,pkG,0.002,xdata[iBeg:iFin])
    966974                yb[iBeg:iFin] += ybi
    967             else:   #'T'OF
     975            elif 'T' in dataType:
    968976                ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS,pkG,xdata[iBeg:iFin])
     977                yb[iBeg:iFin] += ybi
     978            elif 'B' in dataType:
     979                ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS/100.,pkG/1.e4,xdata[iBeg:iFin])
    969980                yb[iBeg:iFin] += ybi
    970981            sumBk[2] += np.sum(ybi)
     
    17761787    def InstPrint(Inst,sigDict):
    17771788        print ('Instrument Parameters:')
    1778         if 'C' in Inst['Type'][0]:
     1789        if 'C' in Inst['Type'][0] or 'B' in Inst['Type'][0]:
    17791790            ptfmt = "%12.6f"
    17801791        else:
     
    20872098        if 'C' in dataType:
    20882099            ptfmt = {'pos':"%10.5f",'int':"%10.1f",'sig':"%10.3f",'gam':"%10.3f"}
    2089         else:   #'T' & 'B'
     2100        elif 'T' in dataType:
    20902101            ptfmt = {'pos':"%10.2f",'int':"%10.4f",'alp':"%8.3f",'bet':"%8.5f",'sig':"%10.3f",'gam':"%10.3f"}
     2102        else: #'B'
     2103            ptfmt = {'pos':"%10.5f",'int':"%10.1f",'alp':"%8.2f",'bet':"%8.4f",'sig':"%10.3f",'gam':"%10.3f"}
    20912104        for i,peak in enumerate(Peaks):
    20922105            ptstr =  ':'
  • trunk/GSASIIpwdGUI.py

    r4519 r4520  
    48124812            elif 'T' in Inst['Type'][0]:
    48134813                refs = np.vstack((refList.T[:18+Super],I100,MuStr,CrSize)).T
     4814            elif 'B' in Inst['Type'][0]:
     4815                refs = np.vstack((refList.T[:17+Super],I100,MuStr,CrSize)).T
    48144816        rowLabels = [str(i) for i in range(len(refs))]
    48154817        Types = (4+Super)*[wg.GRID_VALUE_LONG,]+4*[wg.GRID_VALUE_FLOAT+':10,4',]+ \
     
    48274829                colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','Prfo','Trans','ExtP','I100','mustrain','Size']
    48284830                Types += 6*[wg.GRID_VALUE_FLOAT+':10,3',]
    4829             else:
     4831            elif 'T' in Inst['Type'][0]:
    48304832                colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','alp','bet','wave','Prfo','Abs','Ext','I100','mustrain','Size']
    48314833                Types += 9*[wg.GRID_VALUE_FLOAT+':10,3',]
     4834            elif 'B' in Inst['Type'][0]:
     4835                colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','alp','bet','Prfo','Abs','Ext','I100','mustrain','Size']
     4836                Types += 8*[wg.GRID_VALUE_FLOAT+':10,3',]
    48324837            if Super:
    48334838                colLabels.insert(3,'M')
  • trunk/GSASIIstrIO.py

    r4509 r4520  
    25522552                elif 'T' in inst['Type'][0]:
    25532553                    dmin = limits[0]/inst['difC'][1]
     2554                else:
     2555                    wave = inst['Lam'][1]
     2556                    dmin = wave/(2.0*sind(limits[1]/2.0))
    25542557                pfx = str(pId)+':'+str(hId)+':'
    25552558                if Phases[phase]['General']['doPawley']:
     
    25572560                    hapDict[pfx+'newLeBail'] = True
    25582561                    Tmin = G2lat.Dsp2pos(inst,dmin)
    2559                     if 'C' in inst['Type'][1]:
     2562                    if 'T' in inst['Type'][1]:
     2563                        limits[0] = max(limits[0],Tmin)
     2564                    else:
    25602565                        limits[1] = min(limits[1],Tmin)
    2561                     else:
    2562                         limits[0] = max(limits[0],Tmin)
    25632566                else:
    25642567                    hapDict[pfx+'LeBail'] = hapData.get('LeBail',False)
     
    26952698#                                        Uniq.append(uniq)
    26962699#                                        Phi.append(phi)
     2700                                elif 'B' in inst['Type'][0]:
     2701                                    pos = G2lat.Dsp2pos(inst,d)
     2702                                    if limits[0] < pos < limits[1]:
     2703                                        refList.append([h,k,l,m,mul,d, pos,0.0,0.0,0.0,1., 0.0,0.0,0.0,0.0, 1.0,1.0,1.0])
     2704                                        # ... sig,gam,fotsq,fctsq, phase,icorr,alp,bet, prfo,abs,ext
    26972705                    else:
    26982706                        ifSuper = False
     
    27212729#                                    Uniq.append(uniq)
    27222730#                                    Phi.append(phi)
     2731                            elif 'B' in inst['Type'][0]:
     2732                                pos = G2lat.Dsp2pos(inst,d)
     2733                                if limits[0] < pos < limits[1]:
     2734                                    refList.append([h,k,l,mul,d, pos,0.0,0.0,0.0,1., 0.0,0.0,0.0,0.0, 1.0,1.0,1.0])
     2735                                    # ... sig,gam,fotsq,fctsq, phase,icorr,alp,bet, prfo,abs,ext
    27232736                    Histogram['Reflection Lists'][phase] = {'RefList':np.array(refList),'FF':{},'Type':inst['Type'][0],'Super':ifSuper}
    27242737            elif 'HKLF' in histogram:
     
    32463259            if not instDict[pfx+'beta-0'] and not instDict[pfx+'beta-1']:
    32473260                instDict[pfx+'beta-1'] = 1.0
     3261        elif 'B' in dataType:   #trap zero alp, bet coeff.
     3262            if not instDict[pfx+'alpha-0'] and not instDict[pfx+'alpha-1']:
     3263                instDict[pfx+'alpha-1'] = 1.0
     3264            if not instDict[pfx+'beta-0'] and not instDict[pfx+'beta-1']:
     3265                instDict[pfx+'beta-1'] = 1.0
    32483266        return dataType,instDict,insVary
    32493267       
     
    33833401            Type,instDict,insVary = GetInstParms(hId,Inst[0])
    33843402            controlDict[pfx+'histType'] = Type
    3385             if 'XC' in Type:
     3403            if 'XC' in Type or 'XB' in Type:
    33863404                if pfx+'Lam1' in instDict:
    33873405                    controlDict[pfx+'keV'] = 12.397639/instDict[pfx+'Lam1']
     
    34013419                pFile.write('\n Histogram: %s histogram Id: %d\n'%(histogram,hId))
    34023420                pFile.write(135*'='+'\n')
    3403                 Units = {'C':' deg','T':' msec'}
     3421                Units = {'C':' deg','T':' msec','B':' deg'}
    34043422                units = Units[controlDict[pfx+'histType'][2]]
    34053423                Limits = controlDict[pfx+'Limits']
     
    34233441                histDict[pfx+'Lam'] = Inst['Lam'][1]
    34243442                controlDict[pfx+'keV'] = 12.397639/histDict[pfx+'Lam']
    3425             elif 'NC' in Inst['Type'][0]:                   
     3443            elif 'NC' in Inst['Type'][0] or 'NB' in Inst['Type'][0]:                   
    34263444                histDict[pfx+'Lam'] = Inst['Lam'][1]
    34273445    return histVary,histDict,controlDict
  • trunk/GSASIIstrMath.py

    r4519 r4520  
    758758    if not Xdata.size:          #no atoms in phase!
    759759        return
    760     if 'NC' in calcControls[hfx+'histType']:
     760    if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']:
    761761        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    762762    elif 'X' in calcControls[hfx+'histType']:
     
    876876    mSize = len(Mdata)
    877877    FF = np.zeros(len(Tdata))
    878     if 'NC' in calcControls[hfx+'histType']:
     878    if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']:
    879879        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    880880    elif 'X' in calcControls[hfx+'histType']:
     
    13421342    mSize = len(Mdata)
    13431343    FF = np.zeros(len(Tdata))
    1344     if 'NC' in calcControls[hfx+'histType']:
     1344    if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']:
    13451345        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    13461346    elif 'X' in calcControls[hfx+'histType']:
     
    15341534       
    15351535    FF = np.zeros(len(Tdata))
    1536     if 'NC' in calcControls[hfx+'histType']:
     1536    if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']:
    15371537        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    15381538    elif 'X' in calcControls[hfx+'histType']:
     
    17161716    modQ = np.array([parmDict[pfx+'mV0'],parmDict[pfx+'mV1'],parmDict[pfx+'mV2']])
    17171717    FF = np.zeros(len(Tdata))
    1718     if 'NC' in calcControls[hfx+'histType']:
     1718    if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']:
    17191719        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    17201720    elif 'X' in calcControls[hfx+'histType']:
     
    18491849    modQ = np.array([parmDict[pfx+'mV0'],parmDict[pfx+'mV1'],parmDict[pfx+'mV2']])
    18501850    FF = np.zeros(len(Tdata))
    1851     if 'NC' in calcControls[hfx+'histType']:
     1851    if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']:
    18521852        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    18531853    elif 'X' in calcControls[hfx+'histType']:
     
    20942094    modQ = np.array([parmDict[pfx+'mV0'],parmDict[pfx+'mV1'],parmDict[pfx+'mV2']])
    20952095    FF = np.zeros(len(Tdata))
    2096     if 'NC' in calcControls[hfx+'histType']:
     2096    if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']:
    20972097        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    20982098    elif 'X' in calcControls[hfx+'histType']:
     
    26502650def GetSampleSigGam(refl,im,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict):
    26512651    'Needs a doc string'
    2652     if 'C' in calcControls[hfx+'histType']:     #All checked & OK
     2652    if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']:     #All checked & OK
    26532653        costh = cosd(refl[5+im]/2.)
    26542654        #crystallite size
     
    27232723    gamDict = {}
    27242724    sigDict = {}
    2725     if 'C' in calcControls[hfx+'histType']:         #All checked & OK
     2725    if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']:         #All checked & OK
    27262726        costh = cosd(refl[5+im]/2.)
    27272727        tanth = tand(refl[5+im]/2.)
     
    28722872        d = 1./np.sqrt(G2lat.calc_rDsq(np.array([h,k,l]),A))
    28732873    refl[4+im] = d
    2874     if 'C' in calcControls[hfx+'histType']:
     2874    if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']:
    28752875        pos = 2.0*asind(wave/(2.0*d))+parmDict[hfx+'Zero']
    28762876        const = 9.e-2/(np.pi*parmDict[hfx+'Gonio. radius'])                  #shifts in microns
     
    28992899    dst = np.sqrt(dstsq)
    29002900    dsp = 1./dst
    2901     if 'C' in calcControls[hfx+'histType']:
     2901    if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']:
    29022902        pos = refl[5+im]-parmDict[hfx+'Zero']
    29032903        const = dpr/np.sqrt(1.0-wave**2*dstsq/4.0)
     
    29532953        Dij = parmDict[phfx+'D11']*h**2+parmDict[phfx+'D22']*k**2+parmDict[phfx+'D33']*l**2+ \
    29542954            parmDict[phfx+'D12']*h*k+parmDict[phfx+'D13']*h*l+parmDict[phfx+'D23']*k*l
    2955     if 'C' in calcControls[hfx+'histType']:
     2955    if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']:
    29562956        return -180.*Dij*refl[4+im]**2*tand(refl[5+im]/2.0)/np.pi
    29572957    else:
     
    29852985        dDijDict = {phfx+'D11':h**2,phfx+'D22':k**2,phfx+'D33':l**2,
    29862986            phfx+'D12':h*k,phfx+'D13':h*l,phfx+'D23':k*l}
    2987     if 'C' in calcControls[hfx+'histType']:
     2987    if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']:
    29882988        for item in dDijDict:
    29892989            dDijDict[item] *= 180.0*refl[4+im]**2*tand(refl[5+im]/2.0)/np.pi
     
    31093109                                    if parmDict[phfx+'LeBail']:
    31103110                                        refDict['RefList'][irefl][9+im] = refDict['RefList'][irefl][8+im]
     3111                elif 'B' in calcControls[hfx+'histType']:
     3112                    for iref,refl in enumerate(refDict['RefList']):
     3113                        if useMP:
     3114                            profArgs[iref%G2mp.ncores].append((refl,iref))
     3115                        else:
     3116                            icod= G2mp.ComputeFobsSqPink(refl,iref)
     3117                            if type(icod) is tuple:
     3118                                refl[8+im] = icod[0]
     3119                                sumInt += icod[1]
     3120                                if parmDict[phfx+'LeBail']: refl[9+im] = refl[8+im]
     3121                            elif icod == -1:
     3122                                refl[3+im] *= -1
     3123                                nExcl += 1
     3124                            elif icod == -2:
     3125                                break
     3126                    if useMP:
     3127                        for sInt,resList in MPpool.imap_unordered(G2mp.ComputeFobsSqPinkbatch,profArgs):
     3128                            sumInt += sInt
     3129                            for refl8im,irefl in resList:
     3130                                if refl8im is None:
     3131                                    refDict['RefList'][irefl][3+im] *= -1
     3132                                    nExcl += 1
     3133                                else:
     3134                                    refDict['RefList'][irefl][8+im] = refl8im
     3135                                    if parmDict[phfx+'LeBail']:
     3136                                        refDict['RefList'][irefl][9+im] = refDict['RefList'][irefl][8+im]
    31113137                if useMP: MPpool.terminate()
    31123138                sumFo = 0.0
     
    31693195        return alp,bet
    31703196       
     3197    def GetPinkReflAlpBet(refl,im,hfx,parmDict):
     3198        tanPos = tand(refl[5+im]/2.0)
     3199        alp = parmDict[hfx+'alpha-0']+parmDict[hfx+'alpha-0']*tanPos
     3200        bet = parmDict[hfx+'beta-0']+parmDict[hfx+'beta-1']*tanPos
     3201        return alp,bet
     3202
    31713203    hId = Histogram['hId']
    31723204    hfx = ':%d:'%(hId)
     
    31873219            kRatio = parmDict[hfx+'I(L2)/I(L1)']
    31883220        else:
     3221            wave = parmDict[hfx+'Lam']
     3222    elif 'B' in calcControls[hfx+'histType']:
    31893223            wave = parmDict[hfx+'Lam']
    31903224    else:
     
    32813315                    else:
    32823316                        yc[iBeg:iFin] += refl[11+im]*refl[9+im]*kRatio*G2pwd.getFCJVoigt3(pos2,refl[6+im],refl[7+im],shl,ma.getdata(x[iBeg:iFin]))        #and here
     3317        elif 'B' in calcControls[hfx+'histType']:
     3318            for iref,refl in enumerate(refDict['RefList']):
     3319                if im:
     3320                    h,k,l,m = refl[:4]
     3321                else:
     3322                    h,k,l = refl[:3]
     3323                Uniq = np.inner(refl[:3],SGMT)
     3324                refl[5+im] = GetReflPos(refl,im,wave,A,pfx,hfx,phfx,calcControls,parmDict)         #corrected reflection position
     3325                Lorenz = 1./(2.*sind(refl[5+im]/2.)**2*cosd(refl[5+im]/2.))           #Lorentz correction
     3326                refl[6+im:8+im] = GetReflSigGamCW(refl,im,wave,G,GB,phfx,calcControls,parmDict)    #peak sig & gam
     3327                refl[12+im:14+im] = GetPinkReflAlpBet(refl,im,hfx,parmDict)             #TODO - skip if alp, bet tabulated?
     3328                refl[11+im],refl[14+im],refl[15+im],refl[16+im] = GetIntensityCorr(refl,im,Uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict)
     3329                refl[11+im] *= Vst*Lorenz
     3330                 
     3331                if Phase['General'].get('doPawley'):
     3332                    try:
     3333                        if im:
     3334                            pInd = pfx+'PWLref:%d'%(pawleyLookup[pfx+'%d,%d,%d,%d'%(h,k,l,m)])
     3335                        else:
     3336                            pInd = pfx+'PWLref:%d'%(pawleyLookup[pfx+'%d,%d,%d'%(h,k,l)])
     3337                        refl[9+im] = parmDict[pInd]
     3338                    except KeyError:
     3339#                        print ' ***Error %d,%d,%d missing from Pawley reflection list ***'%(h,k,l)
     3340                        continue
     3341                Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/100.,refl[7+im]/1.e4)
     3342                iBeg = np.searchsorted(x,refl[5+im]-fmin)
     3343                iFin = np.searchsorted(x,refl[5+im]+fmax)
     3344                if not iBeg+iFin:       #peak below low limit - skip peak
     3345                    continue
     3346                elif not iBeg-iFin:     #peak above high limit - done
     3347                    break
     3348                elif iBeg > iFin:   #bad peak coeff - skip
     3349                    badPeak = True
     3350                    continue
     3351                if useMP:
     3352                    profArgs[iref%ncores].append((refl[5+im],refl,iBeg,iFin,1.))
     3353                else:
     3354                    yc[iBeg:iFin] += refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,ma.getdata(x[iBeg:iFin]))
    32833355        elif 'T' in calcControls[hfx+'histType']:
    32843356            for iref,refl in enumerate(refDict['RefList']):
     
    33243396                yc += y
    33253397            MPpool.terminate()
    3326         elif useMP:
     3398        elif useMP and 'T' in calcControls[hfx+'histType']:
    33273399            for y in MPpool.imap_unordered(G2mp.ComputePwdrProfTOF,profArgs):
     3400                yc += y
     3401            MPpool.terminate()
     3402        elif useMP and 'B' in calcControls[hfx+'histType']:
     3403            for y in MPpool.imap_unordered(G2mp.ComputePwdrProfPink,profArgs):
    33283404                yc += y
    33293405            MPpool.terminate()
     
    34093485        else:
    34103486            wave = parmDict[hfx+'Lam']
     3487    elif 'B' in calcControls[hfx+'histType']:
     3488        wave = parmDict[hfx+'Lam']
    34113489    for phase in Histogram['Reflection Lists']:
    34123490        refDict = Histogram['Reflection Lists'][phase]
     
    34763554            if 'C' in calcControls[hfx+'histType']:        #CW powder
    34773555                Wd,fmin,fmax = G2pwd.getWidthsCW(refl[5+im],refl[6+im],refl[7+im],shl)
    3478             else: #'T'OF
     3556            elif 'T' in calcControls[hfx+'histType']:
    34793557                Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im])
     3558            elif 'B' in calcControls[hfx+'histType']:
     3559                Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im]/100.,refl[13+im]/1.e4,refl[6+im],refl[7+im])
    34803560            iBeg = np.searchsorted(x,refl[5+im]-fmin)
    34813561            iFin = np.searchsorted(x,refl[5+im]+fmax)
     
    35063586                        dMdpk2[5] = 100.*cw[iBeg2:iFin2]*refl[11+im]*dMdipk2[0]
    35073587                        dervDict2 = {'int':dMdpk2[0],'pos':dMdpk2[1],'sig':dMdpk2[2],'gam':dMdpk2[3],'shl':dMdpk2[4],'L1/L2':dMdpk2[5]*refl[9]}
    3508             else:   #'T'OF
     3588            elif 'T' in calcControls[hfx+'histType']:
    35093589                lenBF = iFin-iBeg
    35103590                if lenBF < 0:   #bad peak coeff
     
    35143594                for i in range(6):
    35153595                    dMdpk[i] += refl[11+im]*refl[9+im]*dMdipk[i]      #cw[iBeg:iFin]*
     3596                dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'alp':dMdpk[2],'bet':dMdpk[3],'sig':dMdpk[4],'gam':dMdpk[5]}           
     3597            elif 'B' in calcControls[hfx+'histType']:
     3598                tanth = tand(pos/2.0)
     3599                costh = cosd(pos/2.0)
     3600                lenBF = iFin-iBeg
     3601                if lenBF < 0:   #bad peak coeff
     3602                    break
     3603                dMdpk = np.zeros(shape=(6,lenBF))
     3604                dMdipk = G2pwd.getdEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/100.,refl[7+im]/1.e4,ma.getdata(x[iBeg:iFin]))
     3605                for i in range(6):
     3606                    dMdpk[i] += refl[11+im]*refl[9+im]*dMdipk[i]
    35163607                dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'alp':dMdpk[2],'bet':dMdpk[3],'sig':dMdpk[4],'gam':dMdpk[5]}           
    35173608            if Phase['General'].get('doPawley'):
     
    35423633                else:
    35433634                    names.update({hfx+'Absorption':[dFdAb,'int'],})
    3544             else:   #'T'OF
     3635            elif 'T' in calcControls[hfx+'histType']:   #'T'OF
    35453636                dpdA,dpdZ,dpdDC,dpdDA,dpdDB,dpdV = GetReflPosDerv(refl,im,0.0,A,pfx,hfx,phfx,calcControls,parmDict)
    35463637                names = {hfx+'Scale':[dIdsh,'int'],phfx+'Scale':[dIdsp,'int'],
     
    35503641                    hfx+'beta-q':[1./refl[4+im]**2,'bet'],hfx+'sig-0':[1.0,'sig'],hfx+'sig-1':[refl[4+im]**2,'sig'],
    35513642                    hfx+'sig-2':[refl[4+im]**4,'sig'],hfx+'sig-q':[refl[4+im],'sig'],
     3643                    hfx+'Absorption':[dFdAb,'int'],phfx+'Extinction':[dFdEx,'int'],}
     3644            elif 'B' in calcControls[hfx+'histType']:   #'T'OF
     3645                dpdA,dpdw,dpdZ,dpdSh,dpdTr,dpdX,dpdY,dpdV = GetReflPosDerv(refl,im,0.0,A,pfx,hfx,phfx,calcControls,parmDict)
     3646                names = {hfx+'Scale':[dIdsh,'int'],phfx+'Scale':[dIdsp,'int'],hfx+'Lam':[dpdw,'pos'],
     3647                    hfx+'Zero':[dpdZ,'pos'],hfx+'X':[1.0/costh,'gam'],hfx+'Y':[tanth,'gam'],hfx+'Z':[1.0,'gam'],
     3648                    hfx+'U':[tanth**2,'sig'],hfx+'V':[tanth,'sig'],hfx+'W':[1.0,'sig'],hfx+'Polariz.':[dIdpola,'int'],
     3649                    hfx+'alpha-0':[1.0,'alp'],hfx+'alpha-1':[tanth,'alp'],hfx+'beta-0':[1.0,'bet'],hfx+'beta-1':[tanth,'bet'],
    35523650                    hfx+'Absorption':[dFdAb,'int'],phfx+'Extinction':[dFdEx,'int'],}
    35533651            for name in names:
     
    36193717                    if Ka2 and iFin2-iBeg2:
    36203718                        depDerivDict[name][iBeg2:iFin2] += dpdV[i]*dervDict2['pos']
    3621             if 'C' in calcControls[hfx+'histType']:
     3719            if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']:
    36223720                sigDict,gamDict = GetSampleSigGamDerv(refl,im,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict)
    36233721            else:   #'T'OF
Note: See TracChangeset for help on using the changeset viewer.