Changeset 1283


Ignore:
Timestamp:
Apr 18, 2014 11:27:12 AM (8 years ago)
Author:
vondreele
Message:

open a SASD gpx file now starts at SASD file & plot
fix 2/a & 2/c lattice codes in CellSizer?
more graceful when SASD least squares fails
add 'Radius' to list of possibel parameters in SASD fit
fix form factor volume calc for monodisperse models

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1282 r1283  
    26382638        while item and not Id:
    26392639            name = self.PatternTree.GetItemText(item)
    2640             if name[:4] in ['PWDR','HKLF','IMG ','PDF ']:
     2640            if name[:4] in ['PWDR','HKLF','IMG ','PDF ','SASD',]:
    26412641                Id = item
    26422642            elif name == 'Controls':
  • trunk/GSASIIgrid.py

    r1282 r1283  
    43204320        data = G2frame.PatternTree.GetItemPyData(item)
    43214321        G2pdG.UpdateModelsGrid(G2frame,data)
     4322        G2plt.PlotPatterns(G2frame,plotType='SASD')
    43224323        if len(data['Size']['Distribution']):
    43234324            G2plt.PlotSASDSizeDist(G2frame)
    4324         G2plt.PlotPatterns(G2frame,plotType='SASD')
    43254325    elif G2frame.PatternTree.GetItemText(item) == 'Substances':
    43264326        G2frame.PatternId = G2frame.PatternTree.GetItemParent(item)
  • trunk/GSASIIphsGUI.py

    r1239 r1283  
    283283                [True,True,True,False],[0,1,2,0])],
    284284            [['2/m'+'a'],10,zip([" a = "," b = "," c = "," alpha = "," Vol = "],
    285                 ["%.5f","%.5f","%.5f","%.3f","%.3f"],[True,True,True,True,False],[0,1,2,4,0])],
     285                ["%.5f","%.5f","%.5f","%.3f","%.3f"],[True,True,True,True,False],[0,1,2,5,0])],
    286286            [['2/m'+'b'],10,zip([" a = "," b = "," c = "," beta = "," Vol = "],
    287287                ["%.5f","%.5f","%.5f","%.3f","%.3f"],[True,True,True,True,False],[0,1,2,4,0])],
    288288            [['2/m'+'c'],10,zip([" a = "," b = "," c = "," gamma = "," Vol = "],
    289                 ["%.5f","%.5f","%.5f","%.3f","%.3f"],[True,True,True,True,False],[0,1,2,4,0])],
     289                ["%.5f","%.5f","%.5f","%.3f","%.3f"],[True,True,True,True,False],[0,1,2,3,0])],
    290290            [['-1'],8,zip([" a = "," b = "," c = "," Vol = "," alpha = "," beta = "," gamma = "],
    291291                ["%.5f","%.5f","%.5f","%.3f","%.3f","%.3f","%.3f"],
  • trunk/GSASIIpwdGUI.py

    r1280 r1283  
    26642664    #end patches
    26652665   
     2666    def RefreshPlots(newPlot=False):
     2667        PlotText = G2frame.G2plotNB.nb.GetPageText(G2frame.G2plotNB.nb.GetSelection())
     2668        if 'Powder' in PlotText:
     2669            G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=newPlot)
     2670        elif 'Size' in PlotText:
     2671            G2plt.PlotSASDSizeDist(G2frame)
     2672               
    26662673    def OnAddModel(event):
    26672674        if data['Current'] == 'Particle fit':
     
    26842691                })
    26852692            G2sasd.ModelFxn(Profile,ProfDict,Limits,Substances,Sample,data)
    2686             G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=True)
     2693            RefreshPlots(True)
    26872694                   
    26882695        wx.CallAfter(UpdateModelsGrid,G2frame,data)
     
    27182725                return
    27192726            G2sasd.SizeDistribution(Profile,ProfDict,Limits,Substances,Sample,data)
    2720             G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=True)
    2721             G2plt.PlotSASDSizeDist(G2frame)
     2727            RefreshPlots(True)
    27222728           
    27232729        elif data['Current'] == 'Particle fit':
    27242730            SaveState()
    2725             G2sasd.ModelFit(Profile,ProfDict,Limits,Substances,Sample,data)
    2726             G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=True)
     2731            if not G2sasd.ModelFit(Profile,ProfDict,Limits,Substances,Sample,data):
     2732                G2frame.ErrorDialog('Failed refinement',
     2733                    'You need to rethink your selection of parameters\n'+    \
     2734                    ' Model restored to previous version')
     2735            G2sasd.ModelFxn(Profile,ProfDict,Limits,Substances,Sample,data)
     2736            RefreshPlots(True)
    27272737            wx.CallAfter(UpdateModelsGrid,G2frame,data)
    27282738           
     
    27342744        UpdateModelsGrid(G2frame,data)
    27352745        G2sasd.ModelFxn(Profile,ProfDict,Limits,Substances,Sample,data)
    2736         G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=True)
     2746        RefreshPlots(True)
    27372747
    27382748    def DoUnDo():
     
    27402750        file = open(G2frame.undosasd,'rb')
    27412751        PatternId = G2frame.PatternId
    2742         for item in ['Models']:
    2743             G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, item),cPickle.load(file))
    2744             if G2frame.dataDisplay.GetName() == item:
    2745                 if item == 'Background':
    2746                     UpdateBackground(G2frame,G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, item)))
    2747                 elif item == 'Instrument Parameters':
    2748                     UpdateInstrumentGrid(G2frame,G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, item)))
    2749                 elif item == 'Peak List':
    2750                     UpdatePeakGrid(G2frame,G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, item)))
    2751             print item,' recovered'
     2752        G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Models'),cPickle.load(file))
     2753        print ' Models recovered'
    27522754        file.close()
    27532755       
     
    27762778        if itemKey == 'Back':
    27772779            Profile[4][:] = value
    2778         G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=False)
     2780        RefreshPlots()
    27792781       
    27802782    def OnCheckBox(event):
     
    29172919            ]
    29182920                 
    2919         def RefreshPlots():
    2920             PlotText = G2frame.G2plotNB.nb.GetPageText(G2frame.G2plotNB.nb.GetSelection())
    2921             if 'Powder' in PlotText:
    2922                 G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=False)
    2923             elif 'Size' in PlotText:
    2924                 G2plt.PlotSASDSizeDist(G2frame)
    2925                
    29262921        def OnValue(event):
    29272922            Obj = event.GetEventObject()
     
    30673062            Parms = level[level['Controls']['DistType']]
    30683063            FFargs = level['Controls']['FFargs']
    3069             parmOrder = ['Volume','Mean','StdDev','MinSize','G','Rg','B','P','Cutoff',
     3064            parmOrder = ['Volume','Radius','Mean','StdDev','MinSize','G','Rg','B','P','Cutoff',
    30703065                'PkInt','PkPos','PkSig','PkGam',]
    30713066            for parm in parmOrder:
     
    31413136        ProfDict['wtFactor'] = 1./value**2
    31423137        esdScale.SetValue('%.3f'%(value))
    3143         G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=True)
     3138        RefreshPlots(True)
    31443139       
    31453140    Sample = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Sample Parameters'))
  • trunk/GSASIIsasd.py

    r1278 r1283  
    10241024            elif 'Mono' in Type:
    10251025                FFfxn = parmDict[cid+'FormFact']
    1026                 Volfxn = parmDict[cid+'FormFact']
     1026                Volfxn = parmDict[cid+'FFVolume']
    10271027                FFargs = []
    10281028                for item in [cid+'Aspect ratio',cid+'Length',cid+'Thickness',cid+'Diameter',]:
     
    10551055    parmDict.update(zip(varyList,result[0]))
    10561056    Ic[Ibeg:Ifin] = getSASD(Q[Ibeg:Ifin],levelTypes,parmDict)
    1057     sigDict = dict(zip(varyList,np.sqrt(np.diag(result[1])*GOF)))
    1058     print ' Results of small angle data modelling fit:'
    1059     print 'Number of function calls:',result[2]['nfev'],' Number of observations: ',Ifin-Ibeg,' Number of parameters: ',len(varyList)
    1060     print 'Rwp = %7.2f%%, chi**2 = %12.6g, reduced chi**2 = %6.2f'%(Rwp,chisq,GOF)
    1061     SetModelParms()
     1057    try:
     1058        sigDict = dict(zip(varyList,np.sqrt(np.diag(result[1])*GOF)))
     1059        print ' Results of small angle data modelling fit:'
     1060        print 'Number of function calls:',result[2]['nfev'],' Number of observations: ',Ifin-Ibeg,' Number of parameters: ',len(varyList)
     1061        print 'Rwp = %7.2f%%, chi**2 = %12.6g, reduced chi**2 = %6.2f'%(Rwp,chisq,GOF)
     1062        SetModelParms()
     1063        return True
     1064    except ValueError:
     1065        return False
     1066       
    10621067   
    10631068def ModelFxn(Profile,ProfDict,Limits,Substances,Sample,sasdData):
Note: See TracChangeset for help on using the changeset viewer.