@@ -108,8 +108,8 @@ def __init__(self, recipe, update=True, showfixed=True, showcon=False):
108108
109109 def update (self ):
110110 """Update the results according to the current state of the recipe."""
111- ## Note that the order of these operations are chosen to reduce
112- ## computation time.
111+ # Note that the order of these operations are chosen to reduce
112+ # computation time.
113113
114114 recipe = self .recipe
115115
@@ -173,8 +173,8 @@ def _calculateCovariance(self):
173173 self .cov = numpy .dot (vh .T .conj () / s ** 2 , vh )
174174 except numpy .linalg .LinAlgError :
175175 self .messages .append ("Cannot compute covariance matrix." )
176- l = len (self .varvals )
177- self .cov = numpy .zeros ((l , l ), dtype = float )
176+ lvarvals = len (self .varvals )
177+ self .cov = numpy .zeros ((lvarvals , lvarvals ), dtype = float )
178178 return
179179
180180 def _calculateJacobian (self ):
@@ -324,17 +324,19 @@ def formatResults(self, header="", footer="", update=False):
324324 lines .append (header )
325325
326326 if not certain :
327- l = "Some quantities invalid due to missing profile uncertainty"
328- if not l in self .messages :
329- self .messages .append (l )
327+ err_msg = (
328+ "Some quantities invalid due to missing profile uncertainty"
329+ )
330+ if err_msg not in self .messages :
331+ self .messages .append (err_msg )
330332
331333 lines .extend (self .messages )
332334
333- ## Overall results
334- l = "Overall"
335+ # Overall results
336+ err_msg = "Overall"
335337 if not certain :
336- l += " (Chi2 and Reduced Chi2 invalid)"
337- lines .append (l )
338+ err_msg += " (Chi2 and Reduced Chi2 invalid)"
339+ lines .append (err_msg )
338340 lines .append (_DASHEDLINE )
339341 formatstr = "%-14s %.8f"
340342 lines .append (formatstr % ("Residual" , self .residual ))
@@ -346,16 +348,16 @@ def formatResults(self, header="", footer="", update=False):
346348 lines .append (formatstr % ("Reduced Chi2" , self .rchi2 ))
347349 lines .append (formatstr % ("Rw" , self .rw ))
348350
349- ## Per-FitContribution results
351+ # Per-FitContribution results
350352 if len (self .conresults ) > 1 :
351353 keys = list (self .conresults .keys ())
352354 keys .sort (key = numstr )
353355
354356 lines .append ("" )
355- l = "Contributions"
357+ err_msg = "Contributions"
356358 if not certain :
357- l += " (Chi2 and Reduced Chi2 invalid)"
358- lines .append (l )
359+ err_msg += " (Chi2 and Reduced Chi2 invalid)"
360+ lines .append (err_msg )
359361 lines .append (_DASHEDLINE )
360362 formatstr = "%-10s %-42.8f"
361363 for name in keys :
@@ -368,14 +370,14 @@ def formatResults(self, header="", footer="", update=False):
368370 lines .append (formatstr % ("Chi2" , res .chi2 ))
369371 lines .append (formatstr % ("Rw" , res .rw ))
370372
371- ## The variables
373+ # The variables
372374 if self .varnames :
373375 lines .append ("" )
374- l = "Variables"
376+ err_msg = "Variables"
375377 if not certain :
376- m = "Uncertainties invalid"
377- l += " (%s)" % m
378- lines .append (l )
378+ err_msg2 = "Uncertainties invalid"
379+ err_msg += " (%s)" % err_msg2
380+ lines .append (err_msg )
379381 lines .append (_DASHEDLINE )
380382
381383 varnames = self .varnames
@@ -407,13 +409,13 @@ def formatResults(self, header="", footer="", update=False):
407409 varlines .sort ()
408410 lines .extend (varlines )
409411
410- ## The constraints
412+ # The constraints
411413 if self .connames and self .showcon :
412414 lines .append ("" )
413- l = "Constrained Parameters"
415+ err_msg = "Constrained Parameters"
414416 if not certain :
415- l += " (Uncertainties invalid)"
416- lines .append (l )
417+ err_msg += " (Uncertainties invalid)"
418+ lines .append (err_msg )
417419 lines .append (_DASHEDLINE )
418420
419421 w = 0
@@ -436,13 +438,13 @@ def formatResults(self, header="", footer="", update=False):
436438 val , unc = vals [name ]
437439 lines .append (formatstr % (name , val , unc ))
438440
439- ## Variable correlations
441+ # Variable correlations
440442 lines .append ("" )
441443 corint = int (corrmin * 100 )
442- l = "Variable Correlations greater than %i%%" % corint
444+ err_msg = "Variable Correlations greater than %i%%" % corint
443445 if not certain :
444- l += " (Correlations invalid)"
445- lines .append (l )
446+ err_msg += " (Correlations invalid)"
447+ lines .append (err_msg )
446448 lines .append (_DASHEDLINE )
447449 tup = []
448450 cornames = []
@@ -563,8 +565,8 @@ def __init__(self, con, weight, fitres):
563565
564566 def _init (self , con , weight , fitres ):
565567 """Initialize the attributes, for real."""
566- ## Note that the order of these operations is chosen to reduce
567- ## computation time.
568+ # Note that the order of these operations is chosen to reduce
569+ # computation time.
568570
569571 if con .profile is None :
570572 return
0 commit comments