Changeset 5284


Ignore:
Timestamp:
May 19, 2022 11:22:13 AM (4 months ago)
Author:
vondreele
Message:

fix so partials are made only if there are more than one phase in a histogram

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r5283 r5284  
    32753275        return alp,bet
    32763276
     3277    def SavePartial(phase,y):
     3278        phPartialFP = open(phasePartials,'ab')  # append to file
     3279        pickle.dump(phase,phPartialFP)
     3280        pickle.dump(y,phPartialFP)
     3281        phPartialFP.close()
     3282           
    32773283    hId = Histogram['hId']
    32783284    hfx = ':%d:'%(hId)
     
    32853291    # set up for save of phase partials if triggered in GSASIIdataGUI.OnRefinePartials
    32863292    phasePartials = calcControls.get('PhasePartials',None)
     3293    Nphase = len(Histogram['Reflection Lists'])     #partials made ony if Nphase > 1
    32873294    if phasePartials:
     3295       
    32883296        phPartialFP = open(phasePartials,'ab')  # create histogram header
    32893297        pickle.dump(None,phPartialFP)
    32903298        pickle.dump(hId,phPartialFP)
    3291         pickle.dump(x,phPartialFP)
    3292         pickle.dump(yb,phPartialFP)
     3299        if Nphase > 1:
     3300            pickle.dump(x,phPartialFP)
     3301            pickle.dump(yb,phPartialFP)
     3302        else:
     3303            pickle.dump(None,phPartialFP)
     3304            pickle.dump(None,phPartialFP)
    32933305        phPartialFP.close()
    32943306       
    3295         def SavePartial(phase,y):
    3296             phPartialFP = open(phasePartials,'ab')  # append to file
    3297             pickle.dump(phase,phPartialFP)
    3298             pickle.dump(y,phPartialFP)
    3299             phPartialFP.close()
    33003307       
    33013308    if 'C' in calcControls[hfx+'histType']:   
     
    34243431                        yc[iBeg:iFin] += refl[11+im]*refl[9+im]*kRatio*fp2       #and here
    34253432                        if phasePartials: ypartial[iBeg:iFin] += refl[11+im]*refl[9+im]*kRatio*fp2
    3426             if phasePartials: SavePartial(phase,ypartial)
    34273433        elif 'E' in calcControls[hfx+'histType']:
    34283434           
     
    34633469                    yc[iBeg:iFin] += refl[9+im]*fp
    34643470                    if phasePartials: ypartial[iBeg:iFin] += refl[11+im]*refl[9+im]*fp
    3465             if phasePartials: SavePartial(phase,ypartial)
    34663471           
    34673472        elif 'B' in calcControls[hfx+'histType']:
     
    35093514                    yc[iBeg:iFin] += refl[11+im]*refl[9+im]*fp
    35103515                    if phasePartials: ypartial[iBeg:iFin] += refl[11+im]*refl[9+im]*fp
    3511             if phasePartials: SavePartial(phase,ypartial)
    35123516           
    35133517        elif 'T' in calcControls[hfx+'histType']:
     
    35503554                    yc[iBeg:iFin] += refl[11+im]*refl[9+im]*fp
    35513555                    if phasePartials: ypartial[iBeg:iFin] += refl[11+im]*refl[9+im]*fp
    3552             if phasePartials: SavePartial(phase,ypartial)
     3556                   
     3557        if phasePartials:   #for all flavors of PWDR
     3558            if Nphase > 1:
     3559                SavePartial(phase,ypartial)
     3560            else:
     3561                SavePartial(phase,[])
     3562               
    35533563#        print 'profile calc time: %.3fs'%(time.time()-time0)
    35543564        if useMP and 'C' in calcControls[hfx+'histType']:
Note: See TracChangeset for help on using the changeset viewer.