Ignore:
Timestamp:
Jun 30, 2019 9:53:33 PM (4 years ago)
Author:
toby
Message:

remove histograms that are not added to a phse from the Seq Ref refinement; skip histograms w/o Use flag in mass fraction computation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r4038 r4046  
    30133013                    continue
    30143014                Phase = Phases[phase]
     3015                if histogram not in Phase['Histograms']:
     3016                    continue
    30153017                im = 0
    30163018                if Phase['General'].get('Modulated',False):
     
    31143116        print ('GetFobsSq t=',time.time()-starttime)
    31153117               
    3116 def getPowderProfile(parmDict,x,varylist,Histogram,Phases,calcControls,pawleyLookup):
     3118def getPowderProfile(parmDict,x,varylist,Histogram,Phases,calcControls,pawleyLookup,histogram=None):
    31173119    'Computes the powder pattern for a histogram based on contributions from all used phases'
    31183120    if GSASIIpath.GetConfigValue('Show_timing',False): starttime = time.time()
     
    31733175            continue
    31743176        Phase = Phases[phase]
     3177        if histogram and not histogram in Phase['Histograms']:
     3178            continue
    31753179        pId = Phase['pId']
    31763180        pfx = '%d::'%(pId)
     
    33183322    ptx.pyqlmninit()            #initialize fortran arrays for spherical harmonics for each processor
    33193323    parmDict,x,varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars = args[:9]
    3320     prc=0
    3321     tprc=1
     3324    prc,tprc,histogram = 0,1,None
    33223325    if len(args) >= 10: prc=args[9]
    33233326    if len(args) >= 11: tprc=args[10]
     3327    if len(args) >= 12: histogram=args[11]
    33243328    def cellVaryDerv(pfx,SGData,dpdA):
    33253329        if SGData['SGLaue'] in ['-1',]:
     
    33903394            continue
    33913395        Phase = Phases[phase]
     3396        if histogram and histogram not in Phase['Histograms']:
     3397            continue
    33923398        SGData = Phase['General']['SGData']
    33933399        SGMT = np.array([ops[0].T for ops in SGData['SGOps']])
     
    38553861                dMdvh = None
    38563862                depDerivDict = None
    3857                 profArgs = [
     3863                # old approach, create all args prior to use
     3864#                profArgs = [
     3865#                    (parmDict,x[xB:xF],varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars,
     3866#                     i,ncores,histogram) for i in range(ncores)]
     3867#                for dmdv,depDerivs in MPpool.imap_unordered(getPowderProfileDervMP,profArgs):
     3868                # better, use a generator so arg is created as used
     3869                profGenArgs = (
    38583870                    (parmDict,x[xB:xF],varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars,
    3859                      i,ncores) for i in range(ncores)]
    3860                 for dmdv,depDerivs in MPpool.imap_unordered(getPowderProfileDervMP,profArgs):
     3871                     i,ncores,histogram) for i in range(ncores))
     3872                for dmdv,depDerivs in MPpool.imap_unordered(getPowderProfileDervMP,profGenArgs):
    38613873                    if dMdvh is None:
    38623874                       dMdvh = dmdv
     
    38683880            else:
    38693881                dMdvh,depDerivDict = getPowderProfileDervMP([parmDict,x[xB:xF],
    3870                     varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars])
     3882                    varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars,0,1,histogram])
    38713883                #dMdvh = getPowderProfileDerv(parmDict,x[xB:xF],
    38723884                #    varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars)
     
    39503962            xF = np.searchsorted(x,Limits[1])+1
    39513963            yc[xB:xF],yb[xB:xF] = getPowderProfile(parmDict,x[xB:xF],
    3952                 varylist,Histogram,Phases,calcControls,pawleyLookup)
     3964                varylist,Histogram,Phases,calcControls,pawleyLookup,histogram)
    39533965            yc[xB:xF] += yb[xB:xF]
    39543966            if not np.any(y):                   #fill dummy data
Note: See TracChangeset for help on using the changeset viewer.