source: sasview/sansmodels/src/sans/models/c_models/CProlateModel.cpp @ e0a8a3c

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since e0a8a3c was e0a8a3c, checked in by Gervaise Alina <gervyh@…>, 15 years ago

change the orientation of models

  • Property mode set to 100644
File size: 21.6 KB
Line 
1/**
2        This software was developed by the University of Tennessee as part of the
3        Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
4        project funded by the US National Science Foundation.
5
6        If you use DANSE applications to do scientific research that leads to
7        publication, we ask that you acknowledge the use of the software with the
8        following sentence:
9
10        "This work benefited from DANSE software developed under NSF award DMR-0520547."
11
12        copyright 2008, University of Tennessee
13 */
14
15/** CProlateModel
16 *
17 * C extension
18 *
19 * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
20 *          DO NOT MODIFY THIS FILE, MODIFY prolate.h
21 *          AND RE-RUN THE GENERATOR SCRIPT
22 *
23 */
24#define NO_IMPORT_ARRAY
25#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
26 
27extern "C" {
28#include <Python.h>
29#include <arrayobject.h>
30#include "structmember.h"
31#include <stdio.h>
32#include <stdlib.h>
33#include <math.h>
34#include <time.h>
35#include "prolate.h"
36}
37
38#include "models.hh"
39#include "dispersion_visitor.hh"
40
41/// Error object for raised exceptions
42static PyObject * CProlateModelError = NULL;
43
44
45// Class definition
46typedef struct {
47    PyObject_HEAD
48    /// Parameters
49    PyObject * params;
50    /// Dispersion parameters
51    PyObject * dispersion;
52    /// Underlying model object
53    ProlateModel * model;
54    /// Log for unit testing
55    PyObject * log;
56} CProlateModel;
57
58
59static void
60CProlateModel_dealloc(CProlateModel* self)
61{
62    self->ob_type->tp_free((PyObject*)self);
63   
64
65}
66
67static PyObject *
68CProlateModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
69{
70    CProlateModel *self;
71   
72    self = (CProlateModel *)type->tp_alloc(type, 0);
73   
74    return (PyObject *)self;
75}
76
77static int
78CProlateModel_init(CProlateModel *self, PyObject *args, PyObject *kwds)
79{
80    if (self != NULL) {
81       
82        // Create parameters
83        self->params = PyDict_New();
84        self->dispersion = PyDict_New();
85        self->model = new ProlateModel();
86       
87        // Initialize parameter dictionary
88        PyDict_SetItemString(self->params,"major_core",Py_BuildValue("d",100.000000));
89        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000));
90        PyDict_SetItemString(self->params,"minor_core",Py_BuildValue("d",50.000000));
91        PyDict_SetItemString(self->params,"sld_solvent",Py_BuildValue("d",0.000006));
92        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000));
93        PyDict_SetItemString(self->params,"major_shell",Py_BuildValue("d",110.000000));
94        PyDict_SetItemString(self->params,"contrast",Py_BuildValue("d",0.000001));
95        PyDict_SetItemString(self->params,"minor_shell",Py_BuildValue("d",60.000000));
96        // Initialize dispersion / averaging parameter dict
97        DispersionVisitor* visitor = new DispersionVisitor();
98        PyObject * disp_dict;
99        disp_dict = PyDict_New();
100        self->model->major_core.dispersion->accept_as_source(visitor, self->model->major_core.dispersion, disp_dict);
101        PyDict_SetItemString(self->dispersion, "major_core", disp_dict);
102        disp_dict = PyDict_New();
103        self->model->minor_core.dispersion->accept_as_source(visitor, self->model->minor_core.dispersion, disp_dict);
104        PyDict_SetItemString(self->dispersion, "minor_core", disp_dict);
105        disp_dict = PyDict_New();
106        self->model->major_shell.dispersion->accept_as_source(visitor, self->model->major_shell.dispersion, disp_dict);
107        PyDict_SetItemString(self->dispersion, "major_shell", disp_dict);
108        disp_dict = PyDict_New();
109        self->model->minor_shell.dispersion->accept_as_source(visitor, self->model->minor_shell.dispersion, disp_dict);
110        PyDict_SetItemString(self->dispersion, "minor_shell", disp_dict);
111
112
113         
114        // Create empty log
115        self->log = PyDict_New();
116       
117       
118
119    }
120    return 0;
121}
122
123static PyMemberDef CProlateModel_members[] = {
124    {"params", T_OBJECT, offsetof(CProlateModel, params), 0,
125     "Parameters"},
126        {"dispersion", T_OBJECT, offsetof(CProlateModel, dispersion), 0,
127          "Dispersion parameters"},     
128    {"log", T_OBJECT, offsetof(CProlateModel, log), 0,
129     "Log"},
130    {NULL}  /* Sentinel */
131};
132
133/** Read double from PyObject
134    @param p PyObject
135    @return double
136*/
137double CProlateModel_readDouble(PyObject *p) {
138    if (PyFloat_Check(p)==1) {
139        return (double)(((PyFloatObject *)(p))->ob_fval);
140    } else if (PyInt_Check(p)==1) {
141        return (double)(((PyIntObject *)(p))->ob_ival);
142    } else if (PyLong_Check(p)==1) {
143        return (double)PyLong_AsLong(p);
144    } else {
145        return 0.0;
146    }
147}
148/**
149 * Function to call to evaluate model
150 * @param args: input numpy array q[]
151 * @return: numpy array object
152 */
153 
154static PyObject *evaluateOneDim(ProlateModel* model, PyArrayObject *q){
155    PyArrayObject *result;
156   
157    // Check validity of array q , q must be of dimension 1, an array of double
158    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
159    {
160        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
161        //PyErr_SetString(PyExc_ValueError , message);
162        return NULL;
163    }
164    result = (PyArrayObject *)PyArray_FromDims(q->nd, (int *)(q->dimensions), 
165                                                                                  PyArray_DOUBLE);
166        if (result == NULL) {
167        const char * message= "Could not create result ";
168        PyErr_SetString(PyExc_RuntimeError , message);
169                return NULL;
170        }
171         for (int i = 0; i < q->dimensions[0]; i++){
172      double q_value  = *(double *)(q->data + i*q->strides[0]);
173      double *result_value = (double *)(result->data + i*result->strides[0]);
174      *result_value =(*model)(q_value);
175        }
176    return PyArray_Return(result); 
177 }
178
179 /**
180 * Function to call to evaluate model
181 * @param args: input numpy array  [x[],y[]]
182 * @return: numpy array object
183 */
184 static PyObject * evaluateTwoDimXY( ProlateModel* model, 
185                              PyArrayObject *x, PyArrayObject *y)
186 {
187    PyArrayObject *result;
188    int i,j, x_len, y_len, dims[2];
189    //check validity of input vectors
190    if (x->nd != 2 || x->descr->type_num != PyArray_DOUBLE
191        || y->nd != 2 || y->descr->type_num != PyArray_DOUBLE
192        || y->dimensions[1] != x->dimensions[0]){
193        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
194        PyErr_SetString(PyExc_ValueError , message); 
195        return NULL;
196    }
197   
198        if (PyArray_Check(x) && PyArray_Check(y)) {
199               
200            x_len = dims[1]= x->dimensions[1];
201        y_len = dims[0]= y->dimensions[0];
202           
203            // Make a new double matrix of same dims
204        result=(PyArrayObject *) PyArray_FromDims(2,dims,NPY_DOUBLE);
205        if (result == NULL){
206            const char * message= "Could not create result ";
207        PyErr_SetString(PyExc_RuntimeError , message);
208            return NULL;
209            }
210       
211        /* Do the calculation. */
212        for ( j=0; j< y_len; j++) {
213            for ( i=0; i< x_len; i++) {
214                double x_value = *(double *)(x->data + i*x->strides[1]);
215                    double y_value = *(double *)(y->data + j*y->strides[0]);
216                        double *result_value = (double *)(result->data +
217                              i*result->strides[1] + j*result->strides[0]);
218                        *result_value = (*model)(x_value, y_value);
219            }           
220        }
221        return PyArray_Return(result); 
222       
223        }else{
224                    PyErr_SetString(CProlateModelError, 
225                   "CProlateModel.evaluateTwoDimXY couldn't run.");
226                return NULL;
227                }       
228}
229/**
230 *  evalDistribution function evaluate a model function with input vector
231 *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
232 *
233 */ 
234static PyObject * evalDistribution(CProlateModel *self, PyObject *args){
235        PyObject *qx, *qy;
236        PyArrayObject * pars;
237        int npars ,mpars;
238       
239        // Get parameters
240       
241            // Reader parameter dictionary
242    self->model->major_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_core") );
243    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
244    self->model->minor_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_core") );
245    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
246    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
247    self->model->major_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_shell") );
248    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
249    self->model->minor_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_shell") );
250    // Read in dispersion parameters
251    PyObject* disp_dict;
252    DispersionVisitor* visitor = new DispersionVisitor();
253    disp_dict = PyDict_GetItemString(self->dispersion, "major_core");
254    self->model->major_core.dispersion->accept_as_destination(visitor, self->model->major_core.dispersion, disp_dict);
255    disp_dict = PyDict_GetItemString(self->dispersion, "minor_core");
256    self->model->minor_core.dispersion->accept_as_destination(visitor, self->model->minor_core.dispersion, disp_dict);
257    disp_dict = PyDict_GetItemString(self->dispersion, "major_shell");
258    self->model->major_shell.dispersion->accept_as_destination(visitor, self->model->major_shell.dispersion, disp_dict);
259    disp_dict = PyDict_GetItemString(self->dispersion, "minor_shell");
260    self->model->minor_shell.dispersion->accept_as_destination(visitor, self->model->minor_shell.dispersion, disp_dict);
261
262       
263        // Get input and determine whether we have to supply a 1D or 2D return value.
264        if ( !PyArg_ParseTuple(args,"O",&pars) ) {
265            PyErr_SetString(CProlateModelError, 
266                "CProlateModel.evalDistribution expects a q value.");
267                return NULL;
268        }
269    // Check params
270       
271    if(PyArray_Check(pars)==1) {
272               
273            // Length of list should 1 or 2
274            npars = pars->nd; 
275            if(npars==1) {
276                // input is a numpy array
277                if (PyArray_Check(pars)) {
278                        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
279                    }
280                }else{
281                    PyErr_SetString(CProlateModelError, 
282                   "CProlateModel.evalDistribution expect numpy array of one dimension.");
283                return NULL;
284                }
285    }else if( PyList_Check(pars)==1) {
286        // Length of list should be 2 for I(qx,qy)
287            mpars = PyList_GET_SIZE(pars); 
288            if(mpars!=2) {
289                PyErr_SetString(CProlateModelError, 
290                        "CProlateModel.evalDistribution expects a list of dimension 2.");
291                return NULL;
292            }
293             qx = PyList_GET_ITEM(pars,0);
294             qy = PyList_GET_ITEM(pars,1);
295             if (PyArray_Check(qx) && PyArray_Check(qy)) {
296                 return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
297                           (PyArrayObject*)qy);
298                 }else{
299                    PyErr_SetString(CProlateModelError, 
300                   "CProlateModel.evalDistribution expect 2 numpy arrays in list.");
301                return NULL;
302             }
303        }
304        PyErr_SetString(CProlateModelError, 
305                   "CProlateModel.evalDistribution couln't be run.");
306        return NULL;
307       
308}
309
310/**
311 * Function to call to evaluate model
312 * @param args: input q or [q,phi]
313 * @return: function value
314 */
315static PyObject * run(CProlateModel *self, PyObject *args) {
316        double q_value, phi_value;
317        PyObject* pars;
318        int npars;
319       
320        // Get parameters
321       
322            // Reader parameter dictionary
323    self->model->major_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_core") );
324    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
325    self->model->minor_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_core") );
326    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
327    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
328    self->model->major_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_shell") );
329    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
330    self->model->minor_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_shell") );
331    // Read in dispersion parameters
332    PyObject* disp_dict;
333    DispersionVisitor* visitor = new DispersionVisitor();
334    disp_dict = PyDict_GetItemString(self->dispersion, "major_core");
335    self->model->major_core.dispersion->accept_as_destination(visitor, self->model->major_core.dispersion, disp_dict);
336    disp_dict = PyDict_GetItemString(self->dispersion, "minor_core");
337    self->model->minor_core.dispersion->accept_as_destination(visitor, self->model->minor_core.dispersion, disp_dict);
338    disp_dict = PyDict_GetItemString(self->dispersion, "major_shell");
339    self->model->major_shell.dispersion->accept_as_destination(visitor, self->model->major_shell.dispersion, disp_dict);
340    disp_dict = PyDict_GetItemString(self->dispersion, "minor_shell");
341    self->model->minor_shell.dispersion->accept_as_destination(visitor, self->model->minor_shell.dispersion, disp_dict);
342
343       
344        // Get input and determine whether we have to supply a 1D or 2D return value.
345        if ( !PyArg_ParseTuple(args,"O",&pars) ) {
346            PyErr_SetString(CProlateModelError, 
347                "CProlateModel.run expects a q value.");
348                return NULL;
349        }
350         
351        // Check params
352        if( PyList_Check(pars)==1) {
353               
354                // Length of list should be 2 for I(q,phi)
355            npars = PyList_GET_SIZE(pars); 
356            if(npars!=2) {
357                PyErr_SetString(CProlateModelError, 
358                        "CProlateModel.run expects a double or a list of dimension 2.");
359                return NULL;
360            }
361            // We have a vector q, get the q and phi values at which
362            // to evaluate I(q,phi)
363            q_value = CProlateModel_readDouble(PyList_GET_ITEM(pars,0));
364            phi_value = CProlateModel_readDouble(PyList_GET_ITEM(pars,1));
365            // Skip zero
366            if (q_value==0) {
367                return Py_BuildValue("d",0.0);
368            }
369                return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
370
371        } else {
372
373                // We have a scalar q, we will evaluate I(q)
374                q_value = CProlateModel_readDouble(pars);               
375               
376                return Py_BuildValue("d",(*(self->model))(q_value));
377        }       
378}
379
380/**
381 * Function to call to evaluate model in cartesian coordinates
382 * @param args: input q or [qx, qy]]
383 * @return: function value
384 */
385static PyObject * runXY(CProlateModel *self, PyObject *args) {
386        double qx_value, qy_value;
387        PyObject* pars;
388        int npars;
389       
390        // Get parameters
391       
392            // Reader parameter dictionary
393    self->model->major_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_core") );
394    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
395    self->model->minor_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_core") );
396    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
397    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
398    self->model->major_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_shell") );
399    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
400    self->model->minor_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_shell") );
401    // Read in dispersion parameters
402    PyObject* disp_dict;
403    DispersionVisitor* visitor = new DispersionVisitor();
404    disp_dict = PyDict_GetItemString(self->dispersion, "major_core");
405    self->model->major_core.dispersion->accept_as_destination(visitor, self->model->major_core.dispersion, disp_dict);
406    disp_dict = PyDict_GetItemString(self->dispersion, "minor_core");
407    self->model->minor_core.dispersion->accept_as_destination(visitor, self->model->minor_core.dispersion, disp_dict);
408    disp_dict = PyDict_GetItemString(self->dispersion, "major_shell");
409    self->model->major_shell.dispersion->accept_as_destination(visitor, self->model->major_shell.dispersion, disp_dict);
410    disp_dict = PyDict_GetItemString(self->dispersion, "minor_shell");
411    self->model->minor_shell.dispersion->accept_as_destination(visitor, self->model->minor_shell.dispersion, disp_dict);
412
413       
414        // Get input and determine whether we have to supply a 1D or 2D return value.
415        if ( !PyArg_ParseTuple(args,"O",&pars) ) {
416            PyErr_SetString(CProlateModelError, 
417                "CProlateModel.run expects a q value.");
418                return NULL;
419        }
420         
421        // Check params
422        if( PyList_Check(pars)==1) {
423               
424                // Length of list should be 2 for I(qx, qy))
425            npars = PyList_GET_SIZE(pars); 
426            if(npars!=2) {
427                PyErr_SetString(CProlateModelError, 
428                        "CProlateModel.run expects a double or a list of dimension 2.");
429                return NULL;
430            }
431            // We have a vector q, get the qx and qy values at which
432            // to evaluate I(qx,qy)
433            qx_value = CProlateModel_readDouble(PyList_GET_ITEM(pars,0));
434            qy_value = CProlateModel_readDouble(PyList_GET_ITEM(pars,1));
435            return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
436
437        } else {
438
439                // We have a scalar q, we will evaluate I(q)
440                qx_value = CProlateModel_readDouble(pars);             
441               
442                return Py_BuildValue("d",(*(self->model))(qx_value));
443        }       
444}
445
446static PyObject * reset(CProlateModel *self, PyObject *args) {
447   
448
449    return Py_BuildValue("d",0.0);
450}
451
452static PyObject * set_dispersion(CProlateModel *self, PyObject *args) {
453        PyObject * disp;
454        const char * par_name;
455
456        if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
457            PyErr_SetString(CProlateModelError,
458                "CProlateModel.set_dispersion expects a DispersionModel object.");
459                return NULL;
460        }
461        void *temp = PyCObject_AsVoidPtr(disp);
462        DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
463
464
465        // Ugliness necessary to go from python to C
466            // TODO: refactor this
467    if (!strcmp(par_name, "major_core")) {
468        self->model->major_core.dispersion = dispersion;
469    } else    if (!strcmp(par_name, "minor_core")) {
470        self->model->minor_core.dispersion = dispersion;
471    } else    if (!strcmp(par_name, "major_shell")) {
472        self->model->major_shell.dispersion = dispersion;
473    } else    if (!strcmp(par_name, "minor_shell")) {
474        self->model->minor_shell.dispersion = dispersion;
475    } else {
476            PyErr_SetString(CProlateModelError,
477                "CProlateModel.set_dispersion expects a valid parameter name.");
478                return NULL;
479        }
480
481        DispersionVisitor* visitor = new DispersionVisitor();
482        PyObject * disp_dict = PyDict_New();
483        dispersion->accept_as_source(visitor, dispersion, disp_dict);
484        PyDict_SetItemString(self->dispersion, par_name, disp_dict);
485    return Py_BuildValue("i",1);
486}
487
488
489static PyMethodDef CProlateModel_methods[] = {
490    {"run",      (PyCFunction)run     , METH_VARARGS,
491      "Evaluate the model at a given Q or Q, phi"},
492    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
493      "Evaluate the model at a given Q or Qx, Qy"},
494     
495    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
496      "Evaluate the model at a given Q or Qx, Qy vector "},
497    {"reset",    (PyCFunction)reset   , METH_VARARGS,
498      "Reset pair correlation"},
499    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
500      "Set the dispersion model for a given parameter"},
501   {NULL}
502};
503
504static PyTypeObject CProlateModelType = {
505    PyObject_HEAD_INIT(NULL)
506    0,                         /*ob_size*/
507    "CProlateModel",             /*tp_name*/
508    sizeof(CProlateModel),             /*tp_basicsize*/
509    0,                         /*tp_itemsize*/
510    (destructor)CProlateModel_dealloc, /*tp_dealloc*/
511    0,                         /*tp_print*/
512    0,                         /*tp_getattr*/
513    0,                         /*tp_setattr*/
514    0,                         /*tp_compare*/
515    0,                         /*tp_repr*/
516    0,                         /*tp_as_number*/
517    0,                         /*tp_as_sequence*/
518    0,                         /*tp_as_mapping*/
519    0,                         /*tp_hash */
520    0,                         /*tp_call*/
521    0,                         /*tp_str*/
522    0,                         /*tp_getattro*/
523    0,                         /*tp_setattro*/
524    0,                         /*tp_as_buffer*/
525    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
526    "CProlateModel objects",           /* tp_doc */
527    0,                         /* tp_traverse */
528    0,                         /* tp_clear */
529    0,                         /* tp_richcompare */
530    0,                         /* tp_weaklistoffset */
531    0,                         /* tp_iter */
532    0,                         /* tp_iternext */
533    CProlateModel_methods,             /* tp_methods */
534    CProlateModel_members,             /* tp_members */
535    0,                         /* tp_getset */
536    0,                         /* tp_base */
537    0,                         /* tp_dict */
538    0,                         /* tp_descr_get */
539    0,                         /* tp_descr_set */
540    0,                         /* tp_dictoffset */
541    (initproc)CProlateModel_init,      /* tp_init */
542    0,                         /* tp_alloc */
543    CProlateModel_new,                 /* tp_new */
544};
545
546
547//static PyMethodDef module_methods[] = {
548//    {NULL}
549//};
550
551/**
552 * Function used to add the model class to a module
553 * @param module: module to add the class to
554 */ 
555void addCProlateModel(PyObject *module) {
556        PyObject *d;
557       
558    if (PyType_Ready(&CProlateModelType) < 0)
559        return;
560
561    Py_INCREF(&CProlateModelType);
562    PyModule_AddObject(module, "CProlateModel", (PyObject *)&CProlateModelType);
563   
564    d = PyModule_GetDict(module);
565    CProlateModelError = PyErr_NewException("CProlateModel.error", NULL, NULL);
566    PyDict_SetItemString(d, "CProlateModelError", CProlateModelError);
567}
568
Note: See TracBrowser for help on using the repository browser.