Changeset cc03f59 in sasview
- Timestamp:
- Aug 5, 2016 4:00:40 AM (8 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 28e2b3a
- Parents:
- 2760662
- Location:
- src/sas/sascalc/file_converter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/file_converter/BSLLoader.py
r2760662 rcc03f59 11 11 # See invertor.py for implementation of pickling and setters/getters 12 12 13 # def __setattr__(self, name, value): 14 # # if name == 'param': 15 # # return self.set_param(value) 16 # return CBSLLoader.__set_attr__(self, name, value) 13 def __setattr__(self, name, value): 14 if name == 'filename': 15 return self.set_filename(value) 16 elif name == 'frame': 17 return self.set_frame(value) 18 elif name == 'n_pixels': 19 return self.set_n_pixels(value) 20 elif name == 'n_rasters': 21 return self.set_n_rasters(value) 22 return CBSLLoader.__set_attr__(self, name, value) 17 23 18 24 def __getattr__(self, name): -
src/sas/sascalc/file_converter/c_ext/bsl_loader.c
r2760662 rcc03f59 57 57 } 58 58 59 static PyObject *set_filename(CLoader *self, PyObject *args) { 60 const char *new_filename; 61 if (!PyArg_ParseTuple(args, "s", &new_filename)) 62 return NULL; 63 strcpy(self->params.filename, new_filename); 64 65 return Py_BuildValue("s", self->params.filename); 66 } 67 59 68 static PyObject *get_frame(CLoader *self, PyObject *args) { 60 69 return Py_BuildValue("i", self->params.frame); 61 70 } 62 71 72 static PyObject *set_frame(CLoader *self, PyObject *args) { 73 int new_frame; 74 if (!PyArg_ParseTuple(args, "i", &new_frame)) 75 return NULL; 76 self->params.frame = new_frame; 77 78 return Py_BuildValue("i", self->params.frame); 79 } 80 63 81 static PyObject *get_n_pixels(CLoader *self, PyObject *args) { 64 82 return Py_BuildValue("i", self->params.n_pixels); 65 83 } 66 84 85 static PyObject *set_n_pixels(CLoader *self, PyObject *args) { 86 int new_pixels; 87 if (!PyArg_ParseTuple(args, "i", &new_pixels)) 88 return NULL; 89 self->params.n_pixels = new_pixels; 90 91 return Py_BuildValue("i", self->params.n_pixels); 92 } 93 67 94 static PyObject *get_n_rasters(CLoader *self, PyObject *args) { 95 return Py_BuildValue("i", self->params.n_rasters); 96 } 97 98 static PyObject *set_n_rasters(CLoader *self, PyObject *args) { 99 int new_rasters; 100 if (!PyArg_ParseTuple(args, "i", &new_rasters)) 101 return NULL; 102 self->params.n_rasters = new_rasters; 103 68 104 return Py_BuildValue("i", self->params.n_rasters); 69 105 } … … 117 153 { "to_string", (PyCFunction)to_string, METH_VARARGS, "Print the objects params" }, 118 154 { "get_filename", (PyCFunction)get_filename, METH_VARARGS, "Get the filename" }, 155 { "set_filename", (PyCFunction)set_filename, METH_VARARGS, "Set the filename" }, 119 156 { "get_frame", (PyCFunction)get_frame, METH_VARARGS, "Get the frame that will be loaded" }, 157 { "set_frame", (PyCFunction)set_frame, METH_VARARGS, "Set the frame that will be loaded" }, 120 158 { "get_n_pixels", (PyCFunction)get_n_pixels, METH_VARARGS, "Get n_pixels" }, 159 { "set_n_pixels", (PyCFunction)set_n_pixels, METH_VARARGS, "Set n_pixels" }, 121 160 { "get_n_rasters", (PyCFunction)get_n_rasters, METH_VARARGS, "Get n_rasters" }, 161 { "set_n_rasters", (PyCFunction)set_n_rasters, METH_VARARGS, "Set n_rasters" }, 122 162 { "load_data", (PyCFunction)load_data, METH_VARARGS, "Load the data into a numpy array" }, 123 163 {NULL}
Note: See TracChangeset
for help on using the changeset viewer.