Changeset 3068
- Timestamp:
- Sep 12, 2017 10:54:45 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpy3.py
r2574 r3068 142 142 return '0.0' 143 143 # negative numbers, leave room for a sign 144 if val < 0: maxdigits -= 1 144 if np.isnan(val): 145 return str(val) 146 if val < 0: maxdigits -= 1 145 147 if abs(val) < 1e-99 or abs(val) > 9.999e99: 146 148 decimals = min(maxdigits-6,sigfigs) … … 156 158 fmt = "{" + (":{:d}.{:d}g".format(maxdigits,decimals))+"}" 157 159 elif abs(val) < 1: # small numbers, add to decimal places 158 decimals = sigfigs - int(np.log10( abs(val)))160 decimals = sigfigs - int(np.log10(np.abs(val))) 159 161 fmt = "{" + (":{:d}.{:d}f".format(maxdigits,decimals))+"}" 160 162 else: # larger numbers, remove decimal places 161 decimals = sigfigs - 1 - int(np.log10( abs(val)))163 decimals = sigfigs - 1 - int(np.log10(np.abs(val))) 162 164 if decimals <= 0: 163 165 fmt = "{" + (":{:d}.0f".format(maxdigits))+"}." -
trunk/GSASIIstrMain.py
r3049 r3068 54 54 begin = time.time() 55 55 values = np.array(G2stMth.Dict2Values(parmDict, varyList)) 56 if np.any(np.isnan(values)): 57 raise G2obj.G2Exception('ERROR - nan found in LS parameters - use Calculate/View LS parms to locate') 56 58 # test code to compute GOF and save for external repeat 57 59 #args = ([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg) … … 135 137 del(varyList[ipvt-1]) 136 138 break 137 G2stMth.GetFobsSq(Histograms,Phases,parmDict,calcControls) 139 if IfOK: 140 G2stMth.GetFobsSq(Histograms,Phases,parmDict,calcControls) 138 141 return IfOK,Rvals,result,covMatrix,sig 139 142 … … 212 215 IfOK,Rvals,result,covMatrix,sig = RefineCore(Controls,Histograms,Phases,restraintDict, 213 216 rigidbodyDict,parmDict,varyList,calcControls,pawleyLookup,ifPrint,printFile,dlg) 214 sigDict = dict(zip(varyList,sig)) 215 newCellDict = G2stMth.GetNewCellParms(parmDict,varyList) 216 newAtomDict = G2stMth.ApplyXYZshifts(parmDict,varyList) 217 covData = {'variables':result[0],'varyList':varyList,'sig':sig,'Rvals':Rvals, 218 'varyListStart':varyListStart, 219 'covMatrix':covMatrix,'title':GPXfile,'newAtomDict':newAtomDict, 220 'newCellDict':newCellDict,'freshCOV':True} 221 # add the uncertainties into the esd dictionary (sigDict) 222 sigDict.update(G2mv.ComputeDepESD(covMatrix,varyList,parmDict)) 223 G2mv.PrintIndependentVars(parmDict,varyList,sigDict,pFile=printFile) 224 G2stMth.ApplyRBModels(parmDict,Phases,rigidbodyDict,True) 225 G2stIO.SetRigidBodyModels(parmDict,sigDict,rigidbodyDict,printFile) 226 G2stIO.SetPhaseData(parmDict,sigDict,Phases,rbIds,covData,restraintDict,printFile) 227 G2stIO.SetHistogramPhaseData(parmDict,sigDict,Phases,Histograms,calcControls['FFtables'],pFile=printFile) 228 G2stIO.SetHistogramData(parmDict,sigDict,Histograms,calcControls['FFtables'],pFile=printFile) 229 G2stIO.SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,rigidbodyDict,covData,makeBack) 230 printFile.close() 231 print ' Refinement results are in file: '+ospath.splitext(GPXfile)[0]+'.lst' 232 print ' ***** Refinement successful *****' 217 if IfOK: 218 sigDict = dict(zip(varyList,sig)) 219 newCellDict = G2stMth.GetNewCellParms(parmDict,varyList) 220 newAtomDict = G2stMth.ApplyXYZshifts(parmDict,varyList) 221 covData = {'variables':result[0],'varyList':varyList,'sig':sig,'Rvals':Rvals, 222 'varyListStart':varyListStart, 223 'covMatrix':covMatrix,'title':GPXfile,'newAtomDict':newAtomDict, 224 'newCellDict':newCellDict,'freshCOV':True} 225 # add the uncertainties into the esd dictionary (sigDict) 226 sigDict.update(G2mv.ComputeDepESD(covMatrix,varyList,parmDict)) 227 G2mv.PrintIndependentVars(parmDict,varyList,sigDict,pFile=printFile) 228 G2stMth.ApplyRBModels(parmDict,Phases,rigidbodyDict,True) 229 G2stIO.SetRigidBodyModels(parmDict,sigDict,rigidbodyDict,printFile) 230 G2stIO.SetPhaseData(parmDict,sigDict,Phases,rbIds,covData,restraintDict,printFile) 231 G2stIO.SetHistogramPhaseData(parmDict,sigDict,Phases,Histograms,calcControls['FFtables'],pFile=printFile) 232 G2stIO.SetHistogramData(parmDict,sigDict,Histograms,calcControls['FFtables'],pFile=printFile) 233 G2stIO.SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,rigidbodyDict,covData,makeBack) 234 printFile.close() 235 print ' Refinement results are in file: '+ospath.splitext(GPXfile)[0]+'.lst' 236 print ' ***** Refinement successful *****' 237 else: 238 print '****ERROR - Refinement failed' 239 raise G2obj.G2Exception('****ERROR - Refinement failed') 233 240 except G2obj.G2Exception,Msg: 234 241 printFile.close() … … 236 243 237 244 #for testing purposes!!! 238 if DEBUG :245 if DEBUG and IfOK: 239 246 #needs: values,HistoPhases,parmDict,varylist,calcControls,pawleyLookup 240 247 import cPickle -
trunk/GSASIIstrMath.py
r3048 r3068 4070 4070 xB = np.searchsorted(x,Limits[0]) 4071 4071 xF = np.searchsorted(x,Limits[1])+1 4072 dMdvh = np.sqrt(w[xB:xF])*getPowderProfileDerv (parmDict,x[xB:xF],4073 varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars )4072 dMdvh = np.sqrt(w[xB:xF])*getPowderProfileDervMP([parmDict,x[xB:xF], 4073 varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars]) 4074 4074 elif 'HKLF' in histogram[:4]: 4075 4075 Histogram = Histograms[histogram]
Note: See TracChangeset
for help on using the changeset viewer.