Changeset d744767 in sasview for src/sas/sascalc
- Timestamp:
- Mar 16, 2018 2:05:42 PM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 47bf906
- Parents:
- 477c473 (diff), e4c475b7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/sascalc
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/calculator/resolution_calculator.py
r574adc7 r8f83719f 1007 1007 try: 1008 1008 detector_offset = self.sample2detector_distance[1] 1009 except :1010 logger.error( sys.exc_value)1009 except Exception as ex: 1010 logger.error(ex) 1011 1011 1012 1012 # detector size in [no of pix_x,no of pix_y] … … 1057 1057 # qx_value and qy_value values in array 1058 1058 qx_value = qx_value.repeat(detector_pix_nums_y) 1059 qx_value = qx_value.reshape( detector_pix_nums_x, detector_pix_nums_y)1059 qx_value = qx_value.reshape(int(detector_pix_nums_x), int(detector_pix_nums_y)) 1060 1060 qy_value = qy_value.repeat(detector_pix_nums_x) 1061 qy_value = qy_value.reshape( detector_pix_nums_y, detector_pix_nums_x)1061 qy_value = qy_value.reshape(int(detector_pix_nums_y), int(detector_pix_nums_x)) 1062 1062 qy_value = qy_value.transpose() 1063 1063 … … 1094 1094 output.qx_data = qx_value 1095 1095 output.qy_data = qy_value 1096 except :1097 logger.error( sys.exc_value)1096 except Exception as ex: 1097 logger.error(ex) 1098 1098 1099 1099 return output -
src/sas/sascalc/dataloader/data_info.py
r9e6aeaf r749b715 775 775 clone.meta_data = deepcopy(self.meta_data) 776 776 clone.errors = deepcopy(self.errors) 777 clone.isSesans = self.isSesans 777 778 778 779 return clone -
src/sas/sascalc/dataloader/readers/danse_reader.py
raf3e9f5 rcee5c78 191 191 x_vals = np.tile(x_vals, (size_y, 1)).flatten() 192 192 y_vals = np.tile(y_vals, (size_x, 1)).T.flatten() 193 if (np.all(self.current_dataset.err_data ==None)193 if (np.all(self.current_dataset.err_data is None) 194 194 or np.any(self.current_dataset.err_data <= 0)): 195 195 new_err_data = np.sqrt(np.abs(self.current_dataset.data)) -
src/sas/sascalc/fit/AbstractFitEngine.py
r574adc7 r63319b0 300 300 self.qmax = math.sqrt(x_max * x_max + y_max * y_max) 301 301 ## new error image for fitting purpose 302 if self.err_data is None or self.err_data == []:302 if self.err_data is None or not self.err_data: 303 303 self.res_err_data = np.ones(len(self.data)) 304 304 else: -
src/sas/sascalc/fit/expression.py
r574adc7 re4c475b7 210 210 211 211 #print("Function: "+functiondef) 212 exec functiondef in globals,locals 212 # Python 2.7 213 #exec (functiondef in globals,locals) 214 # Python 3.5 215 exec (functiondef, globals, locals) 216 213 217 retfn = locals['eval_expressions'] 214 218 -
src/sas/sascalc/fit/models.py
rb963b20 rfa81e94 139 139 if type is not None and issubclass(type, py_compile.PyCompileError): 140 140 print("Problem with", repr(value)) 141 raise type, value, tb141 raise (type, value, tb) 142 142 return 1 143 143 -
src/sas/sascalc/pr/invertor.py
rd04ac05 r8f83719f 481 481 float(chi2) 482 482 except: 483 chi2 = -1.0483 chi2 = [-1.0] 484 484 self.chi2 = chi2 485 485 … … 500 500 cov = np.linalg.pinv(inv_cov) 501 501 err = math.fabs(chi2 / float(npts - nfunc)) * cov 502 except :502 except Exception as ex: 503 503 # We were not able to estimate the errors 504 504 # Return an empty error matrix 505 logger.error( sys.exc_value)505 logger.error(ex) 506 506 507 507 # Keep a copy of the last output … … 540 540 541 541 """ 542 from num_term import NTermEstimator542 from sas.sascalc.pr.num_term import NTermEstimator 543 543 estimator = NTermEstimator(self.clone()) 544 544 try: 545 545 return estimator.num_terms(isquit_func) 546 except :546 except Exception as ex: 547 547 # If we fail, estimate alpha and return the default 548 548 # number of terms 549 549 best_alpha, _, _ = self.estimate_alpha(self.nfunc) 550 logger.warning("Invertor.estimate_numterms: %s" % sys.exc_value)550 logger.warning("Invertor.estimate_numterms: %s" % ex) 551 551 return self.nfunc, best_alpha, "Could not estimate number of terms" 552 552 … … 634 634 return best_alpha, message, elapsed 635 635 636 except :637 message = "Invertor.estimate_alpha: %s" % sys.exc_value636 except Exception as ex: 637 message = "Invertor.estimate_alpha: %s" % ex 638 638 return 0, message, elapsed 639 639 … … 754 754 self.cov[i][i] = float(toks2[1]) 755 755 756 except :757 msg = "Invertor.from_file: corrupted file\n%s" % sys.exc_value756 except Exception as ex: 757 msg = "Invertor.from_file: corrupted file\n%s" % ex 758 758 raise RuntimeError(msg) 759 759 else: -
src/sas/sascalc/pr/num_term.py
ra1b8fee r8f83719f 183 183 data_y = np.append(data_y, test_y) 184 184 data_err = np.append(data_err, err) 185 except :186 logger.error( sys.exc_value)185 except Exception as ex: 186 logger.error(ex) 187 187 188 188 return data_x, data_y, data_err
Note: See TracChangeset
for help on using the changeset viewer.