Changeset 404 for trunk/GSASIIstruct.py


Ignore:
Timestamp:
Oct 28, 2011 1:59:03 PM (10 years ago)
Author:
vondreele
Message:

put error bars on seq refinement plots
add cubic elastic strain coeff
make sure results are saved from seq refinements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstruct.py

    r403 r404  
    201201    return Histograms,Phases
    202202   
    203 def GPXBackup(GPXfile):
     203def GPXBackup(GPXfile,makeBack=True):
    204204    import distutils.file_util as dfu
    205205    GPXpath,GPXname = ospath.split(GPXfile)
     
    210210        name = name.split('.')
    211211        if len(name) == 3 and name[0] == Name and 'bak' in name[1]:
    212             last = max(last,int(name[1].strip('bak'))+1)
     212            if makeBack:
     213                last = max(last,int(name[1].strip('bak'))+1)
     214            else:
     215                last = max(last,int(name[1].strip('bak')))
    213216    GPXback = ospath.join(GPXpath,ospath.splitext(GPXname)[0]+'.bak'+str(last)+'.gpx')
    214217    dfu.copy_file(GPXfile,GPXback)
    215218    return GPXback
    216219       
    217 def SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,CovData):
     220def SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,CovData,makeBack=True):
    218221    ''' Updates gpxfile from all histograms that are found in any phase
    219222    and any phase that used a histogram
     
    223226        Phases = dictionary of phases that use histograms
    224227        CovData = dictionary of refined variables, varyList, & covariance matrix
     228        makeBack = True if new backup of .gpx file is to be made; else use the last one made
    225229    '''
    226230                       
    227     GPXback = GPXBackup(GPXfile)
     231    GPXback = GPXBackup(GPXfile,makeBack)
    228232    print '\n',135*'-'
    229233    print 'Read from file:',GPXback
     
    906910
    907911    def PrintHStrain(hapData,SGData):
    908         print '\n Hydrostatic strain: '
     912        print '\n Hydrostatic/elastic strain: '
    909913        Hsnames = G2spc.HStrainNames(SGData)
    910914        ptlbls = ' names :'
     
    10981102           
    10991103    def PrintHStrainAndSig(hapData,strainSig,SGData):
    1100         print '\n Hydrostatic strain: '
     1104        print '\n Hydrostatic/elastic strain: '
    11011105        Hsnames = G2spc.HStrainNames(SGData)
    11021106        ptlbls = ' name  :'
     
    18971901    h,k,l = refl[:3]
    18981902    if laue in ['m3','m3m']:
    1899         Dij = parmDict[phfx+'D11']*(h**2+k**2+l**2)
     1903        Dij = parmDict[phfx+'D11']*(h**2+k**2+l**2)+ \
     1904            refl[4]**2*parmDict[phfx+'eA']*((h*k)**2+(h*l)**2+(k*l)**2)/(h**2+k**2+l**2)**2
    19001905    elif laue in ['6/m','6/mmm','3m1','31m','3']:
    19011906        Dij = parmDict[phfx+'D11']*(h**2+k**2+h*k)+parmDict[phfx+'D33']*l**2
     
    19241929    h,k,l = refl[:3]
    19251930    if laue in ['m3','m3m']:
    1926         dDijDict = {phfx+'D11':h**2+k**2+l**2,}
     1931        dDijDict = {phfx+'D11':h**2+k**2+l**2,
     1932            phfx+'eA':((h*k)**2+(h*l)**2+(k*l)**2)/(h**2+k**2+l**2)**2}
    19271933    elif laue in ['6/m','6/mmm','3m1','31m','3']:
    19281934        dDijDict = {phfx+'D11':h**2+k**2+h*k,phfx+'D33':l**2}
     
    24212427    GetFobsSq(Histograms,Phases,parmDict,calcControls)
    24222428    sigDict = dict(zip(varyList,sig))
    2423     covData = {'variables':result[0],'varyList':varyList,'covMatrix':covMatrix,
    2424         'title':GPXfile,'newAtomDict':newAtomDict}
     2429    covData = {'variables':result[0],'varyList':varyList,'sig':sig,
     2430        'covMatrix':covMatrix,'title':GPXfile,'newAtomDict':newAtomDict}
    24252431    SetPhaseData(parmDict,sigDict,Phases,covData)
    24262432    SetHistogramPhaseData(parmDict,sigDict,Phases,Histograms)
     
    24682474            histNames.reverse()
    24692475    SeqResult = {'histNames':histNames}
    2470    
     2476    makeBack = True
    24712477    for ihst,histogram in enumerate(histNames):
    24722478        ifPrint = False
     
    25602566        GetFobsSq(Histo,Phases,parmDict,calcControls)
    25612567        sigDict = dict(zip(varyList,sig))
    2562         covData = {'variables':result[0],'varyList':varyList,'covMatrix':covMatrix,
    2563             'title':histogram,'newAtomDict':newAtomDict}
     2568        covData = {'variables':result[0],'varyList':varyList,'sig':sig,
     2569            'covMatrix':covMatrix,'title':histogram,'newAtomDict':newAtomDict}
    25642570        SetHistogramPhaseData(parmDict,sigDict,Phases,Histo,ifPrint)
    25652571        SetHistogramData(parmDict,sigDict,Histo,ifPrint)
    25662572        SeqResult[histogram] = covData
     2573        SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,covData,makeBack)
     2574        makeBack = False
    25672575    SetSeqResult(GPXfile,Histograms,SeqResult)
    25682576
Note: See TracChangeset for help on using the changeset viewer.