Changeset 1516


Ignore:
Timestamp:
Oct 3, 2014 1:58:59 PM (8 years ago)
Author:
vondreele
Message:

remove CreatePSvarDict & its references
try add sampleParms to PSvarDict...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r1515 r1516  
    21242124            columnsSizer.Add(colSizer)
    21252125        Sizer.Add(columnsSizer)
    2126         Sizer.Add(wx.StaticText(panel,label=' For modify by, enter arithimetic string eg. "-12345.67". "+","-","*","/","**" all allowed'),0,WACV)
     2126        Sizer.Add(wx.StaticText(panel,label=' For modify by, enter arithmetic string eg. "-12345.67". "+","-","*","/","**" all allowed'),0,WACV)
    21272127        Sizer.Add((-1,10))
    21282128        # OK/Cancel buttons
     
    46254625            UpdateSeqResults(G2frame,data,G2frame.dataDisplay.GetSize()) # redisplay variables
    46264626
    4627     # PATCH: this routine can go away eventually
    4628     def CreatePSvarDict(seqnum,name):
    4629         '''Create a parameter dict (parmDict) for everything that might be used
    4630         in a PseudoVar.
    4631         Also creates a list of revised labels (modVaryList) for the covariance matrix to
    4632         match the items in the parameter dict and a matching list of ESDs (ESDvaryList).
    4633        
    4634         :param int seqnum: the sequence number of the histogram in the sequential
    4635           refinement
    4636         :param str name: the name of the histogram in the data tree
    4637 
    4638         :returns: parmDict,modVaryList,ESDvaryList
    4639         '''
    4640         parmDict = {}
    4641         modVaryList = []
    4642         for i,(key,val) in enumerate(zip(data[name]['varyList'],data[name]['variables'])):
    4643             skey = striphist(key)
    4644             if skey in data[name].get('newAtomDict',{}):
    4645                 # replace coordinate shifts with equivalents from lookup table
    4646                 repkey,repval = data[name]['newAtomDict'][skey]
    4647                 parmDict[repkey] = repval
    4648                 modVaryList.append(repkey)
    4649             elif skey in data[name].get('newCellDict',{}):
    4650                 # replace recip. cell term shifts with equivalents from lookup table       
    4651                 repkey,repval = data[name]['newCellDict'][skey]
    4652                 parmDict[repkey] = repval
    4653                 modVaryList.append(repkey)
    4654             else:
    4655                 parmDict[key] = val
    4656                 modVaryList.append(key)
    4657         # create a cell parm dict, override initial settings with values in parmDict
    4658         for phase in Phases:
    4659             phasedict = Phases[phase]
    4660             pId = phasedict['pId']
    4661             cell = Rcelldict.copy()
    4662             cell.update(
    4663                 {lbl:parmDict[lbl] for lbl in RcellLbls[pId] if lbl in parmDict}
    4664                 )
    4665             pfx = str(pId)+'::' # prefix for A values from phase
    4666             A,zeros = G2stIO.cellFill(pfx,SGdata[pId],cell,zeroDict[pId])
    4667             parmDict.update({pfx+cellUlbl[i]:val for i,val in
    4668                              enumerate(G2lat.A2cell(A))
    4669                              if i in uniqCellIndx[pId]
    4670                              })
    4671             parmDict[pfx+"vol"] = G2lat.calc_V(A)
    4672         # now add misc terms to dict
    4673         parmDict['Rwp'] = data[name]['Rvals']['Rwp']
    4674         parmDict[u'\u0394\u03C7\u00B2 (%)'] = 100.*data[name]['Rvals'].get('DelChi2',-1)
    4675         for key in sampleParms:
    4676             parmDict[key] = sampleParms[key][seqnum]
    4677         return parmDict,modVaryList,data[name]['sig']
    4678 
    46794627    def UpdateParmDict(parmDict):
    46804628        '''generate the atom positions and the direct & reciprocal cell values,
     
    52165164            parmDict = data[name].get('parmDict')
    52175165            badVary = data[name].get('badVary',[])
    5218             if parmDict and Controls['ShowCell']:
    5219                 constraintInfo = data[name].get('constraintInfo',[[],[],{},[],seqnum])
    5220                 groups,parmlist,constrDict,fixedList,ihst = constraintInfo
    5221                 varyList = data[name]['varyList']
    5222                 parmDict = data[name]['parmDict']
    5223                 G2mv.GenerateConstraints(groups,parmlist,varyList,constrDict,fixedList,parmDict,SeqHist=ihst)
    5224                 derivs = np.array(
    5225                     [EvalPSvarDeriv(calcobj,parmDict.copy(),var,ESD)
    5226                      for var,ESD in zip(varyList,sigs)]
    5227                     )
    5228                 esdList.append(np.sqrt(
    5229                     np.inner(derivs,np.inner(data[name]['covMatrix'],derivs.T))
    5230                     ))
    5231                 PSvarDict = parmDict.copy()
    5232                 UpdateParmDict(PSvarDict)
    5233                 #calcobj.SetupCalc(PSvarDict)
    5234                 calcobj.UpdateDict(PSvarDict)
    5235             else:
    5236                 # PATCH: this routine can go away eventually once parmDict is always in
    5237                 # sequential refinement
    5238                 PSvarDict,unused,unused = CreatePSvarDict(seqnum,name)
    5239                 calcobj.SetupCalc(PSvarDict)
     5166            constraintInfo = data[name].get('constraintInfo',[[],[],{},[],seqnum])
     5167            groups,parmlist,constrDict,fixedList,ihst = constraintInfo
     5168            varyList = data[name]['varyList']
     5169            parmDict = data[name]['parmDict']
     5170            G2mv.GenerateConstraints(groups,parmlist,varyList,constrDict,fixedList,parmDict,SeqHist=ihst)
     5171            derivs = np.array(
     5172                [EvalPSvarDeriv(calcobj,parmDict.copy(),var,ESD)
     5173                 for var,ESD in zip(varyList,sigs)]
     5174                )
     5175            esdList.append(np.sqrt(
     5176                np.inner(derivs,np.inner(data[name]['covMatrix'],derivs.T))
     5177                ))
     5178            PSvarDict = parmDict.copy()
     5179            UpdateParmDict(PSvarDict)
     5180            calcobj.UpdateDict(PSvarDict)
    52405181            valList.append(calcobj.EvalExpression())
    52415182        if not esdList:
     
    52505191    name = histNames[0]
    52515192    parmDict = data[name].get('parmDict')
    5252     if parmDict:
    5253         PSvarDict = parmDict.copy()
    5254         UpdateParmDict(PSvarDict)
    5255     else:
    5256         print 'Sequential refinement needs to be rerun to obtain ESDs for PseudoVariables'
    5257         # PATCH: this routine can go away eventually
    5258         PSvarDict,unused,unused = CreatePSvarDict(0,histNames[0])
     5193    PSvarDict = parmDict.copy()
     5194    PSvarDict.update(sampleParms)
     5195    UpdateParmDict(PSvarDict)
    52595196    # Also dicts of dependent (depVarDict) & independent vars (indepVarDict)
    52605197    # for Parametric fitting from the data table
Note: See TracChangeset for help on using the changeset viewer.