Changeset aed159f in sasview for src/sas/sascalc
- Timestamp:
- Oct 26, 2018 5:58:45 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 75906a1
- Parents:
- 33812c3
- Location:
- src/sas/sascalc/pr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/pr/fit/expression.py
r1431dab raed159f 209 209 """%("\n ".join(assignments),"\n ".join(code)) 210 210 211 #print("Function: "+functiondef) 212 exec(functiondef) in globals, locals 211 exec(functiondef, globals, locals) 213 212 retfn = locals['eval_expressions'] 214 213 -
src/sas/sascalc/pr/invertor.py
reeea6a3 raed159f 227 227 return None 228 228 229 def add_errors(self, yvalues): 230 """ 231 Adds errors to data set is they are not avaialble 232 :return: 233 """ 234 stats_errors = np.zeros(len(yvalues)) 235 for i in range(len(yvalues)): 236 # Scale the error so that we can fit over several decades of Q 237 scale = 0.05 * np.sqrt(yvalues[i]) 238 min_err = 0.01 * yvalues[i] 239 stats_errors[i] = scale * np.sqrt(np.fabs(yvalues[i])) + min_err 240 logger.warning("Simulated errors have been added to the data set\n") 241 return stats_errors 229 def add_errors(self, sigma=0.05): 230 """ 231 Adds errors to data set is they are not available. 232 Uses $\Delta y = \sigma | y |$. 233 """ 234 self.dy = sigma * np.fabs(self.y) 242 235 243 236 def clone(self): … … 514 507 # We were not able to estimate the errors 515 508 # Return an empty error matrix 516 logger.error(sys.exc_ value)509 logger.error(sys.exc_info()[1]) 517 510 518 511 # Keep a copy of the last output … … 559 552 # number of terms 560 553 best_alpha, _, _ = self.estimate_alpha(self.nfunc) 561 logger.warning("Invertor.estimate_numterms: %s" % sys.exc_ value)554 logger.warning("Invertor.estimate_numterms: %s" % sys.exc_info()[1]) 562 555 return self.nfunc, best_alpha, "Could not estimate number of terms" 563 556 … … 646 639 647 640 except: 648 message = "Invertor.estimate_alpha: %s" % sys.exc_ value641 message = "Invertor.estimate_alpha: %s" % sys.exc_info()[1] 649 642 return 0, message, elapsed 650 643 … … 763 756 764 757 except: 765 msg = "Invertor.from_file: corrupted file\n%s" % sys.exc_ value758 msg = "Invertor.from_file: corrupted file\n%s" % sys.exc_info()[1] 766 759 raise RuntimeError(msg) 767 760 else:
Note: See TracChangeset
for help on using the changeset viewer.