Changeset 4094 for trunk/GSASIIpwdGUI.py


Ignore:
Timestamp:
Aug 15, 2019 2:54:58 PM (4 years ago)
Author:
vondreele
Message:

SHAPES now complete, but slow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwdGUI.py

    r4092 r4094  
    356356                'MaxEnt':{'Niter':100,'Precision':0.01,'Sky':-3},
    357357                'IPG':{'Niter':100,'Approach':0.8,'Power':-1},'Reg':{},},
    358         'Pair':{'Method':'Regularization','MaxRadius':100.,'NBins':100,'Errors':'User',
     358        'Pair':{'Method':'Moore','MaxRadius':100.,'NBins':100,'Errors':'User',
    359359                'Percent error':2.5,'Background':[0,False],'Distribution':[],
    360360                'Moore':20,'Dist G':100.,'Result':[],},           
     
    52305230        data['BackFile'] = ''
    52315231    if 'Pair' not in data:
    5232         data['Pair'] = {'Method':'Regularization','MaxRadius':100.,'NBins':100,'Errors':'User','Result':[],
     5232        data['Pair'] = {'Method':'Moore','MaxRadius':100.,'NBins':100,'Errors':'User','Result':[],
    52335233            'Percent error':2.5,'Background':[0,False],'Distribution':[],'Moore':[20,False],'Dist G':100.,} 
    52345234    if 'Shapes' not in data:
     
    54225422            SaveState()
    54235423            G2sasd.PairDistFxn(Profile,ProfDict,Limits,Sample,data)
     5424            RefreshPlots(True)
    54245425            G2plt.PlotSASDPairDist(G2frame)
    5425             RefreshPlots(True)
    54265426            wx.CallAfter(UpdateModelsGrid,G2frame,data)
    54275427           
     
    54325432      A New Algroithm for the Reconstruction of Protein Molecular Envelopes
    54335433      from X-ray Solution Scattering Data,
    5434       J. Badger, Jour. of Appl. Chrystallogr. 2019, XX, xxx-xxx.
    5435       doi: xxx''',
     5434      J. Badger, Jour. of Appl. Chrystallogr. 2019, 52, xxx-xxx.
     5435      doi: 10.1107/S1600576719009774''',
    54365436      caption='Program Shapes',style=wx.ICON_INFORMATION)
    54375437            data['Pair']['Result'] = []       #clear old results (if any) for now
     
    56075607        def OnMooreTerms(event):
    56085608            data['Pair']['Moore'] = int(round(Limits[1][1]*data['Pair']['MaxRadius']/np.pi))-1
    5609             wx.CallAfter(UpdateModelsGrid,G2frame,data)                               
     5609            wx.CallAfter(UpdateModelsGrid,G2frame,data)
     5610
     5611        def OnNewVal(invalid,value,tc):
     5612            if invalid: return
     5613            parmDict = {'Rg':data['Pair']['MaxRadius']/2.5,'G':data['Pair']['Dist G'],
     5614                'B':data['Pair'].get('Dist B',Profile[1][-1]*Profile[0][-1]**4),
     5615                'Back':data['Back'][0]}
     5616            Profile[2] = G2sasd.getSASDRg(Profile[0],parmDict)
     5617            RefreshPlots(True)
    56105618           
    56115619        pairSizer = wx.BoxSizer(wx.VERTICAL)
     
    56205628        binSizer.Add(nbins,0,WACV)
    56215629        binSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Max diam.: '),0,WACV)
    5622         maxdiam = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Pair'],'MaxRadius',min=10.,nDig=(10,1))
     5630        maxdiam = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Pair'],'MaxRadius',min=10.,nDig=(10,1),OnLeave=OnNewVal)
    56235631        binSizer.Add(maxdiam,0,WACV)
    56245632        maxest = wx.Button(G2frame.dataWindow,label='Make estimate')
     
    56285636        pairSizer.Add((5,5),0)
    56295637        fitSizer = wx.BoxSizer(wx.HORIZONTAL)
    5630         methods = ['Regularization','Moore']
     5638        methods = ['Moore',]            #'Regularization',
    56315639        fitSizer.Add(wx.StaticText(G2frame.dataWindow,label='Fitting method: '),0,WACV)
    56325640        method = wx.ComboBox(G2frame.dataWindow,value=data['Pair']['Method'],choices=methods,
     
    56345642        method.Bind(wx.EVT_COMBOBOX,OnMethod)
    56355643        fitSizer.Add(method,0,WACV)
     5644        if data['Pair']['Method'] == 'Moore':
     5645            fitSizer.Add(wx.StaticText(G2frame.dataWindow,label=" P.B. Moore, J. Appl. Cryst., 13, 168-175 (1980)"),0,WACV)
     5646        else:
     5647            fitSizer.Add(wx.StaticText(G2frame.dataWindow,label=" D.I. Svergun, J. Appl. Cryst., 24, 485-492 (1991)"),0,WACV)
    56365648        pairSizer.Add(fitSizer,0,WACV)
    56375649        if 'Moore' in data['Pair']['Method']:
    56385650            mooreSizer = wx.BoxSizer(wx.HORIZONTAL)
    56395651            mooreSizer.Add(wx.StaticText(G2frame.dataWindow,label='Number of functions: '),0,WACV)
    5640             moore = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Pair'],'Moore',min=10)
     5652            moore = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Pair'],'Moore',min=2)
    56415653            mooreSizer.Add(moore,0,WACV)
    56425654            mooreterms = wx.Button(G2frame.dataWindow,label = 'Auto determine?')
     
    56715683            selAtoms = Atoms[2*r+(c-1)]
    56725684            pattern = Patterns[r]
    5673             data['Pair']['Pair Calc'] = np.array([PRcalc[r][0],PRcalc[r][2]]).T
     5685            prCalc = PRcalc[r][2]
     5686            prDelt= np.diff(PRcalc[r][0])[0]
     5687            prsum = np.sum(prCalc)
     5688            prCalc /= prsum*prDelt
     5689            data['Pair']['Pair Calc'] = np.array([PRcalc[r][0],prCalc]).T
    56745690            print('%s %d'%('num. beads',len(selAtoms[1])))
    56755691            print('%s %.3f'%('selected r value',pattern[-1]))
    56765692            print('%s %.3f'%('selected Delta P(r)',PRcalc[r][-1]))
     5693            G2plt.PlotBeadModel(G2frame,selAtoms,plotDefaults)
     5694            RefreshPlots(True)
    56775695            G2plt.PlotSASDPairDist(G2frame)
    5678             RefreshPlots(True)
    56795696           
    5680             G2plt.PlotBeadModel(G2frame,selAtoms,plotDefaults)
    56815697           
    56825698           
     
    56965712        inflate = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Shapes'],'inflateV',min=1.,max=1.4,nDig=(10,2))
    56975713        parmSizer.Add(inflate,0,WACV)
    5698         parmSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Axial symmetry (1-6): '),0,WACV)       
    5699         symm = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Shapes'],'Symm',min=1,max=6)
     5714        parmSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Axial symmetry (1-12): '),0,WACV)       
     5715        symm = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Shapes'],'Symm',min=1,max=12)
    57005716        parmSizer.Add(symm,0,WACV)
    57015717#3rd row
     
    60746090    backSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Background:'),0,WACV)
    60756091    backVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Back'],0,
    6076         nDig=(10,3),typeHint=float,OnLeave=OnBackChange)
     6092        nDig=(10,3,'g'),OnLeave=OnBackChange)
    60776093    backSizer.Add(backVal,0,WACV)
    60786094    backVar = wx.CheckBox(G2frame.dataWindow,label='Refine?')
Note: See TracChangeset for help on using the changeset viewer.