Changeset 4095


Ignore:
Timestamp:
Aug 16, 2019 10:58:08 AM (2 years ago)
Author:
vondreele
Message:

improve dmax estimation - use proper selected weights
ditto P(R) calculation
remove Seq fit from all but particle fits - not appropriate for rest.
Add option for bead separation in SHAPES results - improves appearance in small proteins

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/G2shapes.py

    r4094 r4095  
    11161116    surface_scale = shapeDict['AAglue']
    11171117    pdbOut = shapeDict['pdbOut']
     1118    box_step = shapeDict.get('boxStep',4.0)
    11181119    Phases = []
    11191120    Patterns = []
     
    13001301   
    13011302    # Box parametere
    1302     box_step = 5.0
     1303#    box_step = 4.0      #5.0
    13031304    box_pt_vol = box_step*box_step*box_step
    13041305   
  • trunk/GSASIIdataGUI.py

    r4093 r4095  
    54785478        self.SasdUndo = self.ModelEdit.Append(G2G.wxID_MODELUNDO,'Undo','Undo model fit')
    54795479        self.SasdUndo.Enable(False)           
    5480         self.ModelEdit.Append(G2G.wxID_MODELFITALL,'Sequential fit','Sequential fit of model parameters to all SASD data')
     5480        self.SasSeqFit = self.ModelEdit.Append(G2G.wxID_MODELFITALL,'Sequential fit','Sequential fit of model parameters to all SASD data')
     5481        self.SasSeqFit.Enable(False)
    54815482        self.ModelEdit.Append(G2G.wxID_MODELCOPY,'Copy','Copy model parameters to other histograms')
    54825483        self.ModelEdit.Append(G2G.wxID_MODELCOPYFLAGS,'Copy flags','Copy model refinement flags to other histograms')
  • trunk/GSASIIpwdGUI.py

    r4094 r4095  
    5353import GSASIIElem as G2elem
    5454import GSASIIsasd as G2sasd
     55import G2shapes_np
    5556VERY_LIGHT_GREY = wx.Colour(235,235,235)
    5657WACV = wx.ALIGN_CENTER_VERTICAL
     
    358359        'Pair':{'Method':'Moore','MaxRadius':100.,'NBins':100,'Errors':'User',
    359360                'Percent error':2.5,'Background':[0,False],'Distribution':[],
    360                 'Moore':20,'Dist G':100.,'Result':[],},           
     361                'Moore':10,'Dist G':100.,'Result':[],},           
    361362        'Particle':{'Matrix':{'Name':'vacuum','VolFrac':[0.0,False]},'Levels':[],},
    362363        'Shapes':{'outName':'run','NumAA':100,'Niter':1,'AAscale':1.0,'Symm':1,'bias-z':0.0,
    363                  'inflateV':1.0,'AAglue':0.0,'pdbOut':False},
     364                 'inflateV':1.0,'AAglue':0.0,'pdbOut':False,'boxStep':4.0},
    364365        'Current':'Size dist.','BackFile':'',
    365366        }
     
    52315232    if 'Pair' not in data:
    52325233        data['Pair'] = {'Method':'Moore','MaxRadius':100.,'NBins':100,'Errors':'User','Result':[],
    5233             'Percent error':2.5,'Background':[0,False],'Distribution':[],'Moore':[20,False],'Dist G':100.,} 
     5234            'Percent error':2.5,'Background':[0,False],'Distribution':[],'Moore':10,'Dist G':100.,} 
    52345235    if 'Shapes' not in data:
    52355236        data['Shapes'] = {'outName':'run','NumAA':100,'Niter':1,'AAscale':1.0,'Symm':1,'bias-z':0.0,
    5236             'inflateV':1.0,'AAglue':0.0,'pdbOut':False}
     5237            'inflateV':1.0,'AAglue':0.0,'pdbOut':False,'boxStep':4.0}
     5238    if 'boxStep' not in data['Shapes']:
     5239        data['Shapes']['boxStep'] = 4.0
    52375240    plotDefaults = {'oldxy':[0.,0.],'Quaternion':[0.,0.,0.,1.],'cameraPos':150.,'viewDir':[0,0,1],}
    52385241
     
    55845587       
    55855588    def PairSizer():
    5586 #        'Pair':{'Method':'Regularization','MaxRadius':[100.,False],'NBins':101,'Errors':'User',
    5587 #                'Percent error':2.5,'Background':[0,False],'Distribution':[],
    5588 #                'Moore':20,},           
    55895589               
    55905590        def OnMethod(event):
     
    56505650            mooreSizer = wx.BoxSizer(wx.HORIZONTAL)
    56515651            mooreSizer.Add(wx.StaticText(G2frame.dataWindow,label='Number of functions: '),0,WACV)
    5652             moore = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Pair'],'Moore',min=2)
     5652            moore = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Pair'],'Moore',min=2,max=20)
    56535653            mooreSizer.Add(moore,0,WACV)
    56545654            mooreterms = wx.Button(G2frame.dataWindow,label = 'Auto determine?')
     
    56945694            RefreshPlots(True)
    56955695            G2plt.PlotSASDPairDist(G2frame)
    5696            
    5697            
    5698            
    56995696       
    57005697        shapeSizer = wx.BoxSizer(wx.VERTICAL)
     
    57065703        parmSizer.Add(numAA,0,WACV)
    57075704        parmSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Nballs=no. amino acids*'),0,WACV)       
    5708         scaleAA = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Shapes'],'AAscale',min=0.1,max=10.,nDig=(10,2))
     5705        scaleAA = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Shapes'],'AAscale',min=0.01,max=10.,nDig=(10,2))
    57095706        parmSizer.Add(scaleAA,0,WACV)
    57105707#2nd row       
     
    57295726        name = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Shapes'],'outName')
    57305727        parmSizer.Add(name,0,WACV)
    5731 #last row       
     5728#last row
     5729        parmSizer.Add(wx.StaticText(G2frame.dataWindow,label=' Bead separation (3.5-5): '),0,WACV)
     5730        beadsep = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['Shapes'],'boxStep',min=3.5,max=5,nDig=(10,1))
     5731        parmSizer.Add(beadsep,0,WACV)       
    57325732        pdb = wx.CheckBox(G2frame.dataWindow,label=' Save as pdb files?: ')
    57335733        pdb.SetValue(data['Shapes']['pdbOut'])
     
    60756075    G2G.HorizontalLine(mainSizer,G2frame.dataWindow)
    60766076    if 'Size' in data['Current']:
     6077        G2frame.dataWindow.SasSeqFit.Enable(False)
    60776078        if 'MaxEnt' in data['Size']['Method']:
    60786079            G2frame.GetStatusBar().SetStatusText('Size distribution by Maximum entropy',1)
     
    60816082        mainSizer.Add(SizeSizer())       
    60826083    elif 'Particle' in data['Current']:
     6084        G2frame.dataWindow.SasSeqFit.Enable(True)
    60836085        mainSizer.Add(PartSizer(),1,wx.ALIGN_LEFT|wx.EXPAND)
    60846086    elif 'Pair' in data['Current']:
     6087        G2frame.dataWindow.SasSeqFit.Enable(False)
    60856088        mainSizer.Add(PairSizer(),1,wx.ALIGN_LEFT|wx.EXPAND)
    60866089    elif 'Shape' in data['Current']:
     6090        G2frame.dataWindow.SasSeqFit.Enable(False)
    60876091        mainSizer.Add(ShapesSizer(),1,wx.ALIGN_LEFT|wx.EXPAND)
    60886092    G2G.HorizontalLine(mainSizer,G2frame.dataWindow)   
     
    60926096        nDig=(10,3,'g'),OnLeave=OnBackChange)
    60936097    backSizer.Add(backVal,0,WACV)
    6094     backVar = wx.CheckBox(G2frame.dataWindow,label='Refine?')
    6095     Indx[backVar.GetId()] = [data['Back'],1]
    6096     backVar.SetValue(data['Back'][1])
    6097     backVar.Bind(wx.EVT_CHECKBOX, OnCheckBox)
    6098     backSizer.Add(backVar,0,WACV)
    6099     #multiple background files?
     6098    if 'Shape' not in data['Current']:
     6099        backVar = wx.CheckBox(G2frame.dataWindow,label='Refine?')
     6100        Indx[backVar.GetId()] = [data['Back'],1]
     6101        backVar.SetValue(data['Back'][1])
     6102        backVar.Bind(wx.EVT_CHECKBOX, OnCheckBox)
     6103        backSizer.Add(backVar,0,WACV)
     6104        #multiple background files?
    61006105    backSizer.Add(wx.StaticText(G2frame.dataWindow,-1,' Background file: '),0,WACV)
    61016106    Choices = ['',]+G2gd.GetGPXtreeDataNames(G2frame,['SASD',])
  • trunk/GSASIIsasd.py

    r4094 r4095  
    750750                z = a[i][j] - z
    751751                if j == i:
    752                     y = math.sqrt(z)
     752                    y = math.sqrt(max(0.,z))
    753753                else:
    754754                    y = z / fl[j][j]
     
    11291129            N += 1
    11301130        MPV = np.ones(N)*1.e-5
    1131 #        MPV[0] = Q[Ibeg]
    11321131        dmax = pairData['MaxRadius']
     1132        if 'User' in pairData['Errors']:
     1133            Wt = wt[Ibeg:Ifin]
     1134        elif 'Sqrt' in pairData['Errors']:
     1135            Wt = 1./Io[Ibeg:Ifin]
     1136        elif 'Percent' in pairData['Errors']:
     1137            Wt = 1./(pairData['Percent error']*Io[Ibeg:Ifin])
    11331138        result = so.leastsq(calcSASD,MPV,full_output=True,epsfcn=1.e-8,   #ftol=Ftol,
    1134             args=(Q[Ibeg:Ifin],Io[Ibeg:Ifin],wtFactor*wt[Ibeg:Ifin],Ifb[Ibeg:Ifin],dmax,ifBack))
     1139            args=(Q[Ibeg:Ifin],Io[Ibeg:Ifin],wtFactor*Wt,Ifb[Ibeg:Ifin],dmax,ifBack))
    11351140        if ifBack:
    11361141            MPVR = result[0][:-1]
     
    14411446    Ifin = np.searchsorted(Q,Qmax)+1    #include last point
    14421447    Ic[:] = 0
     1448    pairData = Model['Pair']
     1449    if 'User' in pairData['Errors']:
     1450        Wt = wt[Ibeg:Ifin]
     1451    elif 'Sqrt' in pairData['Errors']:
     1452        Wt = 1./Io[Ibeg:Ifin]
     1453    elif 'Percent' in pairData['Errors']:
     1454        Wt = 1./(pairData['Percent error']*Io[Ibeg:Ifin])
    14431455    parmDict,varyList,values = GetModelParms()
    14441456    result = so.leastsq(calcSASD,values,full_output=True,epsfcn=1.e-12,factor=0.1,  #ftol=Ftol,
    1445         args=(Q[Ibeg:Ifin],Io[Ibeg:Ifin],wtFactor*wt[Ibeg:Ifin],Ifb[Ibeg:Ifin],parmDict,varyList))
     1457        args=(Q[Ibeg:Ifin],Io[Ibeg:Ifin],wtFactor*Wt,Ifb[Ibeg:Ifin],parmDict,varyList))
    14461458    parmDict.update(dict(zip(varyList,result[0])))
    14471459    chisq = np.sum(result[2]['fvec']**2)
Note: See TracChangeset for help on using the changeset viewer.