@@ -5538,33 +5538,57 @@ def OnRefine(self,event):
55385538 rtext = 'LS Refinement: Rw = %.3f%%, GOF = %.2f, Nobs = %d, Nvar = %d' % (Rvals ['Rwp' ],Rvals ['GOF' ],Rvals ['Nobs' ],Rvals ['Nvars' ])
55395539 lamMax = Rvals .get ('lamMax' ,0.001 )
55405540 lst = os .path .splitext (os .path .abspath (self .GSASprojectfile ))[0 ]
5541- text = 'Detailed results are in ' + lst + '. lst\n '
5541+ text = f 'Detailed results are in file { os . path . split ( lst )[ 1 ] } .lst in directory { os . path . split ( lst )[ 0 ] } \n '
55425542 if 'GOF0' in Rvals and 'GOF' in Rvals :
5543- text += ' \n Final Reduced Chi^2: {:.3f} (before ref: {:.3f}) \n ' . format (
5544- Rvals ['GOF' ] ** 2 , Rvals [ ' GOF0' ]** 2 )
5543+ text += f" \n Final Reduced Chi^2: { Rvals [ 'GOF' ] ** 2 :.3f} "
5544+ text += f" \n (before refinement: { Rvals ['GOF0' ]** 2 :.3f } ) \n "
55455545 if Rvals .get ('Max shft/sig' ) is not None :
55465546 rtext += ', Max delt/sig = {:.3f}' .format (Rvals ['Max shft/sig' ])
55475547 text += '\n Max shift/sigma={:.3f}\n ' .format (Rvals ['Max shft/sig' ])
55485548 if 'msg' in Rvals : text += '\n ' + Rvals ['msg' ] + '\n '
55495549 if 'Aborted' in Rvals :
55505550 text += '\n WARNING: Minimizer halted because chi**2 increased\n '
55515551 if lamMax >= 10. :
5552- text += '\n WARNING: Steepest descents dominates;' + \
5553- ' minimum may not have been reached or result may be false minimum.' + \
5554- ' You should reconsider which parameters you refine. Check covariance matrix.\n '
5552+ text += ( '\n WARNING: Marquardt factor raised to point where steepest descents dominates fitting ;' +
5553+ ' minimum may not have been reached or your result may be a false minimum.' +
5554+ ' You should reconsider which parameters you refine: check covariance matrix.\n ' )
55555555 text += '\n Load new result?'
5556- dlg2 = wx .MessageDialog (self ,text ,'Refinement results, Rw =%.3f' % (Rw ),wx .OK | wx .CANCEL )
5556+ #breakpoint()
5557+ # assemble a list of changed parameters
5558+ # tbl = []
5559+ # for i in Rvals['parmDictAfterFit']:
5560+ # if i not in Rvals['parmDictBeforeFit']: continue
5561+ # if (Rvals['parmDictAfterFit'][i] != Rvals['parmDictBeforeFit'][i] or
5562+ # #np.isclose(Rvals['parmDictAfterFit'][i],Rvals['parmDictBeforeFit'][i])
5563+ # i in Rvals['parmDictvaryList']):
5564+ # txt = ''
5565+ # v = G2obj.getVarDescr(i)
5566+ # if v is not None and v[-1] is not None:
5567+ # txt = G2obj.fmtVarDescr(i)
5568+ # tbl.append((i,Rvals['parmDictBeforeFit'][i],Rvals['parmDictAfterFit'][i],txt))
5569+ dlg2 = wx .MessageDialog (self ,text ,
5570+ f'Refinement results, Rw={ Rw :.3f} ' ,
5571+ wx .OK | wx .CANCEL )
55575572 dlg2 .CenterOnParent ()
55585573 try :
55595574 if dlg2 .ShowModal () == wx .ID_OK :
55605575 self .reloadFromGPX (rtext ,Rvals )
55615576 G2IO .LogCellChanges (self )
5562- if Rvals .get ('LoggedVals' ):
5577+ # parameter logging into notebook
5578+ txt = ''
5579+ if Controls .get ('LoggedVars' ) and 'parmDictAfterFit' in Rvals :
5580+ txt = ''
5581+ for i in sorted (Controls ['LoggedVars' ]):
5582+ if i not in Rvals ['parmDictAfterFit' ]: continue
5583+ if txt : txt += ', '
5584+ txt += (f'{ i } : { Rvals ["parmDictAfterFit" ][i ]:.7g} ' )
5585+ elif GSASIIpath .GetConfigValue ('LogAllVars' ) and 'parmDictAfterFit' in Rvals :
55635586 txt = ''
5564- for p ,v in Rvals ['LoggedVals' ].items ():
5587+ for c ,i in enumerate (Rvals ['parmDictvaryList' ]):
5588+ if i not in Rvals ['parmDictAfterFit' ]: continue
55655589 if txt : txt += ', '
5566- txt += (f'{ p } : { v :.7g} ' )
5567- self .AddToNotebook (txt ,'VALS' ,False )
5590+ txt += (f'{ i } : { Rvals [ "parmDictAfterFit" ][ i ] :.7g} ' )
5591+ if txt : self .AddToNotebook (txt ,'VALS' ,False )
55685592 if refPlotUpdate :
55695593 refPlotUpdate ({},restore = True )
55705594 refPlotUpdate = None
0 commit comments