Changeset 404


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

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r400 r404  
    356356                    DataType = DataType.strip()[0:3]                                #just 1st 3 chars
    357357                    wx.BeginBusyCursor()
    358                     Sample = G2pdG.GetDefaultSample()
     358                    Sample = G2pdG.SetDefaultSample()
     359                    Sample['Temperature'] = Temperature
    359360                    try:
    360361                        for Item in Data:
  • trunk/GSASIIgrid.py

    r400 r404  
    700700    histNames = data['histNames']
    701701   
     702    def GetSigData(parm):
     703        sigData = []
     704        for name in histNames:
     705            sigList = data[name]['sig']
     706            sigData.append(sigList[parm])
     707        return sigData
     708   
    702709    def Select(event):
    703710        cols = self.dataDisplay.GetSelectedCols()
     
    705712        if cols:
    706713            plotData = []
     714            plotSig = []
    707715            plotNames = []
    708716            for col in cols:
    709717                plotData.append(self.SeqTable.GetColValues(col))
     718                plotSig.append(GetSigData(col))
    710719                plotNames.append(self.SeqTable.GetColLabelValue(col))
    711720            plotData = np.array(plotData)
    712             G2plt.PlotSeq(self,plotData,plotNames)
     721            G2plt.PlotSeq(self,plotData,plotSig,plotNames)
    713722        elif rows:
    714723            name = histNames[rows[0]]
  • trunk/GSASIIphsGUI.py

    r402 r404  
    25302530                mainSizer.Add((0,5),0)
    25312531               
    2532                 mainSizer.Add(wx.StaticText(dataDisplay,-1,' Hydrostatic strain:'))
     2532                mainSizer.Add(wx.StaticText(dataDisplay,-1,' Hydrostatic/elastic strain:'))
    25332533                mainSizer.Add(HstrainSizer())
    25342534                   
  • trunk/GSASIIplot.py

    r400 r404  
    14461446    Page.canvas.draw()
    14471447   
    1448 def PlotSeq(self,SeqData,SeqNames):
     1448def PlotSeq(self,SeqData,SeqSig,SeqNames):
    14491449   
    14501450    try:
     
    14641464    if len(SeqData):   
    14651465        X = np.arange(0,len(SeqData[0]),1)
    1466         for Y,name in zip(SeqData,SeqNames):
    1467             Plot.plot(X,Y,label=name)       
     1466        for Y,sig,name in zip(SeqData,SeqSig,SeqNames):
     1467            Plot.errorbar(X,Y,yerr=sig,label=name)       
    14681468        Plot.legend(loc='best')
    14691469        Page.canvas.draw()
  • trunk/GSASIIspc.py

    r388 r404  
    551551    uniq = SGData['SGUniq']
    552552    if laue in ['m3','m3m']:
    553         return ['D11']
     553        return ['D11','eA']         #add cubic strain term
    554554    elif laue in ['6/m','6/mmm','3m1','31m','3']:
    555555        return ['D11','D33']
  • 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.