Changeset d04ac05 in sasview for src/sas/sascalc/pr
- Timestamp:
- Sep 23, 2017 1:47:05 AM (7 years ago)
- Branches:
- master, 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 9e308a3
- Parents:
- 7b50f14
- Location:
- src/sas/sascalc/pr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/pr/c_extensions/Cinvertor.c
rcb62bd5 rd04ac05 52 52 invertor_dealloc(&(self->params)); 53 53 54 self->ob_type->tp_free((PyObject*)self);54 Py_TYPE(self)->tp_free((PyObject*)self); 55 55 56 56 } … … 1054 1054 1055 1055 static PyTypeObject CinvertorType = { 1056 PyObject_HEAD_INIT(NULL) 1057 0, /*ob_size*/ 1056 //PyObject_HEAD_INIT(NULL) 1057 //0, /*ob_size*/ 1058 PyVarObject_HEAD_INIT(NULL, 0) 1058 1059 "Cinvertor", /*tp_name*/ 1059 1060 sizeof(Cinvertor), /*tp_basicsize*/ … … 1119 1120 1120 1121 1121 #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ 1122 #define PyMODINIT_FUNC void 1122 #define MODULE_DOC "C extension module for inversion to P(r)." 1123 #define MODULE_NAME "pr_inversion" 1124 #define MODULE_INIT2 initpr_inversion 1125 #define MODULE_INIT3 PyInit_pr_inversion 1126 #define MODULE_METHODS module_methods 1127 1128 /* ==== boilerplate python 2/3 interface bootstrap ==== */ 1129 1130 1131 #if defined(WIN32) && !defined(__MINGW32__) 1132 #define DLL_EXPORT __declspec(dllexport) 1133 #else 1134 #define DLL_EXPORT 1123 1135 #endif 1124 PyMODINIT_FUNC 1125 initpr_inversion(void) 1126 { 1127 PyObject* m; 1128 1129 m = Py_InitModule3("pr_inversion", module_methods, 1130 "C extension module for inversion to P(r)."); 1131 1132 addCinvertor(m); 1133 } 1136 1137 #if PY_MAJOR_VERSION >= 3 1138 1139 DLL_EXPORT PyMODINIT_FUNC MODULE_INIT3(void) 1140 { 1141 static struct PyModuleDef moduledef = { 1142 PyModuleDef_HEAD_INIT, 1143 MODULE_NAME, /* m_name */ 1144 MODULE_DOC, /* m_doc */ 1145 -1, /* m_size */ 1146 MODULE_METHODS, /* m_methods */ 1147 NULL, /* m_reload */ 1148 NULL, /* m_traverse */ 1149 NULL, /* m_clear */ 1150 NULL, /* m_free */ 1151 }; 1152 PyObject* m = PyModule_Create(&moduledef); 1153 addCinvertor(m); 1154 return m; 1155 } 1156 1157 #else /* !PY_MAJOR_VERSION >= 3 */ 1158 1159 DLL_EXPORT PyMODINIT_FUNC MODULE_INIT2(void) 1160 { 1161 PyObject* m = Py_InitModule4(MODULE_NAME, 1162 MODULE_METHODS, 1163 MODULE_DOC, 1164 0, 1165 PYTHON_API_VERSION 1166 ); 1167 addCinvertor(m); 1168 } 1169 1170 #endif /* !PY_MAJOR_VERSION >= 3 */ -
src/sas/sascalc/pr/invertor.py
r574adc7 rd04ac05 472 472 try: 473 473 self._get_matrix(nfunc, nq, a, b) 474 except :475 raise RuntimeError("Invertor: could not invert I(Q)\n %s" % s ys.exc_value)474 except Exception as exc: 475 raise RuntimeError("Invertor: could not invert I(Q)\n %s" % str(exc)) 476 476 477 477 # Perform the inversion (least square fit)
Note: See TracChangeset
for help on using the changeset viewer.