Changeset 1516
- Timestamp:
- Oct 3, 2014 1:58:59 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIgrid.py
r1515 r1516 2124 2124 columnsSizer.Add(colSizer) 2125 2125 Sizer.Add(columnsSizer) 2126 Sizer.Add(wx.StaticText(panel,label=' For modify by, enter arith imetic 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) 2127 2127 Sizer.Add((-1,10)) 2128 2128 # OK/Cancel buttons … … 4625 4625 UpdateSeqResults(G2frame,data,G2frame.dataDisplay.GetSize()) # redisplay variables 4626 4626 4627 # PATCH: this routine can go away eventually4628 def CreatePSvarDict(seqnum,name):4629 '''Create a parameter dict (parmDict) for everything that might be used4630 in a PseudoVar.4631 Also creates a list of revised labels (modVaryList) for the covariance matrix to4632 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 sequential4635 refinement4636 :param str name: the name of the histogram in the data tree4637 4638 :returns: parmDict,modVaryList,ESDvaryList4639 '''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 table4646 repkey,repval = data[name]['newAtomDict'][skey]4647 parmDict[repkey] = repval4648 modVaryList.append(repkey)4649 elif skey in data[name].get('newCellDict',{}):4650 # replace recip. cell term shifts with equivalents from lookup table4651 repkey,repval = data[name]['newCellDict'][skey]4652 parmDict[repkey] = repval4653 modVaryList.append(repkey)4654 else:4655 parmDict[key] = val4656 modVaryList.append(key)4657 # create a cell parm dict, override initial settings with values in parmDict4658 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 phase4666 A,zeros = G2stIO.cellFill(pfx,SGdata[pId],cell,zeroDict[pId])4667 parmDict.update({pfx+cellUlbl[i]:val for i,val in4668 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 dict4673 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 4679 4627 def UpdateParmDict(parmDict): 4680 4628 '''generate the atom positions and the direct & reciprocal cell values, … … 5216 5164 parmDict = data[name].get('parmDict') 5217 5165 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) 5240 5181 valList.append(calcobj.EvalExpression()) 5241 5182 if not esdList: … … 5250 5191 name = histNames[0] 5251 5192 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) 5259 5196 # Also dicts of dependent (depVarDict) & independent vars (indepVarDict) 5260 5197 # for Parametric fitting from the data table
Note: See TracChangeset
for help on using the changeset viewer.