Index: sansmodels/src/sans/models/c_models/CLamellarPSHGModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLamellarPSHGModel.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
+++ sansmodels/src/sans/models/c_models/CLamellarPSHGModel.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -0,0 +1,390 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/** CLamellarPSHGModel
+ *
+ * C extension 
+ *
+ * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
+ *          DO NOT MODIFY THIS FILE, MODIFY lamellarPS_HG.h
+ *          AND RE-RUN THE GENERATOR SCRIPT
+ *
+ */
+ 
+extern "C" {
+#include <Python.h>
+#include "structmember.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+#include "lamellarPS_HG.h"
+}
+
+#include "models.hh"
+#include "dispersion_visitor.hh"
+
+/// Error object for raised exceptions
+static PyObject * CLamellarPSHGModelError = NULL;
+
+
+// Class definition
+typedef struct {
+    PyObject_HEAD
+    /// Parameters
+    PyObject * params;
+    /// Dispersion parameters
+    PyObject * dispersion;
+    /// Underlying model object
+    LamellarPSHGModel * model;
+    /// Log for unit testing
+    PyObject * log;
+} CLamellarPSHGModel;
+
+
+static void
+CLamellarPSHGModel_dealloc(CLamellarPSHGModel* self)
+{
+    self->ob_type->tp_free((PyObject*)self);
+    
+
+}
+
+static PyObject *
+CLamellarPSHGModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+    CLamellarPSHGModel *self;
+    
+    self = (CLamellarPSHGModel *)type->tp_alloc(type, 0);
+   
+    return (PyObject *)self;
+}
+
+static int
+CLamellarPSHGModel_init(CLamellarPSHGModel *self, PyObject *args, PyObject *kwds)
+{
+    if (self != NULL) {
+    	
+    	// Create parameters
+        self->params = PyDict_New();
+        self->dispersion = PyDict_New();
+        self->model = new LamellarPSHGModel();
+        
+        // Initialize parameter dictionary
+        PyDict_SetItemString(self->params,"n_plates",Py_BuildValue("d",30.000000));
+        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000));
+        PyDict_SetItemString(self->params,"deltaT",Py_BuildValue("d",10.000000));
+        PyDict_SetItemString(self->params,"spacing",Py_BuildValue("d",40.000000));
+        PyDict_SetItemString(self->params,"sld_tail",Py_BuildValue("d",0.000000));
+        PyDict_SetItemString(self->params,"sld_solvent",Py_BuildValue("d",0.000006));
+        PyDict_SetItemString(self->params,"caille",Py_BuildValue("d",0.001000));
+        PyDict_SetItemString(self->params,"sld_head",Py_BuildValue("d",0.000002));
+        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000));
+        PyDict_SetItemString(self->params,"deltaH",Py_BuildValue("d",2.000000));
+        // Initialize dispersion / averaging parameter dict
+        DispersionVisitor* visitor = new DispersionVisitor();
+        PyObject * disp_dict;
+        disp_dict = PyDict_New();
+        self->model->deltaT.dispersion->accept_as_source(visitor, self->model->deltaT.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "deltaT", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->deltaH.dispersion->accept_as_source(visitor, self->model->deltaH.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "deltaH", disp_dict);
+
+
+         
+        // Create empty log
+        self->log = PyDict_New();
+        
+        
+
+    }
+    return 0;
+}
+
+static PyMemberDef CLamellarPSHGModel_members[] = {
+    {"params", T_OBJECT, offsetof(CLamellarPSHGModel, params), 0,
+     "Parameters"},
+	{"dispersion", T_OBJECT, offsetof(CLamellarPSHGModel, dispersion), 0,
+	  "Dispersion parameters"},     
+    {"log", T_OBJECT, offsetof(CLamellarPSHGModel, log), 0,
+     "Log"},
+    {NULL}  /* Sentinel */
+};
+
+/** Read double from PyObject
+    @param p PyObject
+    @return double
+*/
+double CLamellarPSHGModel_readDouble(PyObject *p) {
+    if (PyFloat_Check(p)==1) {
+        return (double)(((PyFloatObject *)(p))->ob_fval);
+    } else if (PyInt_Check(p)==1) {
+        return (double)(((PyIntObject *)(p))->ob_ival);
+    } else if (PyLong_Check(p)==1) {
+        return (double)PyLong_AsLong(p);
+    } else {
+        return 0.0;
+    }
+}
+
+
+/**
+ * Function to call to evaluate model
+ * @param args: input q or [q,phi]
+ * @return: function value
+ */
+static PyObject * run(CLamellarPSHGModel *self, PyObject *args) {
+	double q_value, phi_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->deltaT = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaT") );
+    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
+    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
+    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
+    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
+    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->deltaH = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaH") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "deltaT");
+    self->model->deltaT.dispersion->accept_as_destination(visitor, self->model->deltaT.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "deltaH");
+    self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CLamellarPSHGModelError, 
+	    	"CLamellarPSHGModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(q,phi)
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(CLamellarPSHGModelError, 
+	    		"CLamellarPSHGModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the q and phi values at which
+	    // to evaluate I(q,phi)
+	    q_value = CLamellarPSHGModel_readDouble(PyList_GET_ITEM(pars,0));
+	    phi_value = CLamellarPSHGModel_readDouble(PyList_GET_ITEM(pars,1));
+	    // Skip zero
+	    if (q_value==0) {
+	    	return Py_BuildValue("d",0.0);
+	    }
+		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		q_value = CLamellarPSHGModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(q_value));
+	}	
+}
+
+/**
+ * Function to call to evaluate model in cartesian coordinates
+ * @param args: input q or [qx, qy]]
+ * @return: function value
+ */
+static PyObject * runXY(CLamellarPSHGModel *self, PyObject *args) {
+	double qx_value, qy_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->deltaT = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaT") );
+    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
+    self->model->sld_tail = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_tail") );
+    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
+    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
+    self->model->sld_head = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_head") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->deltaH = PyFloat_AsDouble( PyDict_GetItemString(self->params, "deltaH") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "deltaT");
+    self->model->deltaT.dispersion->accept_as_destination(visitor, self->model->deltaT.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "deltaH");
+    self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CLamellarPSHGModelError, 
+	    	"CLamellarPSHGModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(qx, qy))
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(CLamellarPSHGModelError, 
+	    		"CLamellarPSHGModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the qx and qy values at which
+	    // to evaluate I(qx,qy)
+	    qx_value = CLamellarPSHGModel_readDouble(PyList_GET_ITEM(pars,0));
+	    qy_value = CLamellarPSHGModel_readDouble(PyList_GET_ITEM(pars,1));
+	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		qx_value = CLamellarPSHGModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(qx_value));
+	}	
+}
+
+static PyObject * reset(CLamellarPSHGModel *self, PyObject *args) {
+    
+
+    return Py_BuildValue("d",0.0);
+}
+
+static PyObject * set_dispersion(CLamellarPSHGModel *self, PyObject *args) {
+	PyObject * disp;
+	const char * par_name;
+
+	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
+	    PyErr_SetString(CLamellarPSHGModelError,
+	    	"CLamellarPSHGModel.set_dispersion expects a DispersionModel object.");
+		return NULL;
+	}
+	void *temp = PyCObject_AsVoidPtr(disp);
+	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
+
+
+	// Ugliness necessary to go from python to C
+	    // TODO: refactor this
+    if (!strcmp(par_name, "deltaT")) {
+        self->model->deltaT.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "deltaH")) {
+        self->model->deltaH.dispersion = dispersion;
+    } else {
+	    PyErr_SetString(CLamellarPSHGModelError,
+	    	"CLamellarPSHGModel.set_dispersion expects a valid parameter name.");
+		return NULL;
+	}
+
+	DispersionVisitor* visitor = new DispersionVisitor();
+	PyObject * disp_dict = PyDict_New();
+	dispersion->accept_as_source(visitor, dispersion, disp_dict);
+	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
+    return Py_BuildValue("i",1);
+}
+
+
+static PyMethodDef CLamellarPSHGModel_methods[] = {
+    {"run",      (PyCFunction)run     , METH_VARARGS,
+      "Evaluate the model at a given Q or Q, phi"},
+    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
+      "Evaluate the model at a given Q or Qx, Qy"},
+    {"reset",    (PyCFunction)reset   , METH_VARARGS,
+      "Reset pair correlation"},
+    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
+      "Set the dispersion model for a given parameter"},
+   {NULL}
+};
+
+static PyTypeObject CLamellarPSHGModelType = {
+    PyObject_HEAD_INIT(NULL)
+    0,                         /*ob_size*/
+    "CLamellarPSHGModel",             /*tp_name*/
+    sizeof(CLamellarPSHGModel),             /*tp_basicsize*/
+    0,                         /*tp_itemsize*/
+    (destructor)CLamellarPSHGModel_dealloc, /*tp_dealloc*/
+    0,                         /*tp_print*/
+    0,                         /*tp_getattr*/
+    0,                         /*tp_setattr*/
+    0,                         /*tp_compare*/
+    0,                         /*tp_repr*/
+    0,                         /*tp_as_number*/
+    0,                         /*tp_as_sequence*/
+    0,                         /*tp_as_mapping*/
+    0,                         /*tp_hash */
+    0,                         /*tp_call*/
+    0,                         /*tp_str*/
+    0,                         /*tp_getattro*/
+    0,                         /*tp_setattro*/
+    0,                         /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+    "CLamellarPSHGModel objects",           /* tp_doc */
+    0,		               /* tp_traverse */
+    0,		               /* tp_clear */
+    0,		               /* tp_richcompare */
+    0,		               /* tp_weaklistoffset */
+    0,		               /* tp_iter */
+    0,		               /* tp_iternext */
+    CLamellarPSHGModel_methods,             /* tp_methods */
+    CLamellarPSHGModel_members,             /* tp_members */
+    0,                         /* tp_getset */
+    0,                         /* tp_base */
+    0,                         /* tp_dict */
+    0,                         /* tp_descr_get */
+    0,                         /* tp_descr_set */
+    0,                         /* tp_dictoffset */
+    (initproc)CLamellarPSHGModel_init,      /* tp_init */
+    0,                         /* tp_alloc */
+    CLamellarPSHGModel_new,                 /* tp_new */
+};
+
+
+static PyMethodDef module_methods[] = {
+    {NULL} 
+};
+
+/**
+ * Function used to add the model class to a module
+ * @param module: module to add the class to
+ */ 
+void addCLamellarPSHGModel(PyObject *module) {
+	PyObject *d;
+	
+    if (PyType_Ready(&CLamellarPSHGModelType) < 0)
+        return;
+
+    Py_INCREF(&CLamellarPSHGModelType);
+    PyModule_AddObject(module, "CLamellarPSHGModel", (PyObject *)&CLamellarPSHGModelType);
+    
+    d = PyModule_GetDict(module);
+    CLamellarPSHGModelError = PyErr_NewException("CLamellarPSHGModel.error", NULL, NULL);
+    PyDict_SetItemString(d, "CLamellarPSHGModelError", CLamellarPSHGModelError);
+}
+
Index: sansmodels/src/sans/models/c_models/CLamellarPSModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CLamellarPSModel.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
+++ sansmodels/src/sans/models/c_models/CLamellarPSModel.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -0,0 +1,375 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/** CLamellarPSModel
+ *
+ * C extension 
+ *
+ * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
+ *          DO NOT MODIFY THIS FILE, MODIFY lamellarPS.h
+ *          AND RE-RUN THE GENERATOR SCRIPT
+ *
+ */
+ 
+extern "C" {
+#include <Python.h>
+#include "structmember.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+#include "lamellarPS.h"
+}
+
+#include "models.hh"
+#include "dispersion_visitor.hh"
+
+/// Error object for raised exceptions
+static PyObject * CLamellarPSModelError = NULL;
+
+
+// Class definition
+typedef struct {
+    PyObject_HEAD
+    /// Parameters
+    PyObject * params;
+    /// Dispersion parameters
+    PyObject * dispersion;
+    /// Underlying model object
+    LamellarPSModel * model;
+    /// Log for unit testing
+    PyObject * log;
+} CLamellarPSModel;
+
+
+static void
+CLamellarPSModel_dealloc(CLamellarPSModel* self)
+{
+    self->ob_type->tp_free((PyObject*)self);
+    
+
+}
+
+static PyObject *
+CLamellarPSModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+    CLamellarPSModel *self;
+    
+    self = (CLamellarPSModel *)type->tp_alloc(type, 0);
+   
+    return (PyObject *)self;
+}
+
+static int
+CLamellarPSModel_init(CLamellarPSModel *self, PyObject *args, PyObject *kwds)
+{
+    if (self != NULL) {
+    	
+    	// Create parameters
+        self->params = PyDict_New();
+        self->dispersion = PyDict_New();
+        self->model = new LamellarPSModel();
+        
+        // Initialize parameter dictionary
+        PyDict_SetItemString(self->params,"n_plates",Py_BuildValue("d",20.000000));
+        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000));
+        PyDict_SetItemString(self->params,"spacing",Py_BuildValue("d",400.000000));
+        PyDict_SetItemString(self->params,"caille",Py_BuildValue("d",0.100000));
+        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000));
+        PyDict_SetItemString(self->params,"delta",Py_BuildValue("d",30.000000));
+        PyDict_SetItemString(self->params,"sigma",Py_BuildValue("d",0.150000));
+        PyDict_SetItemString(self->params,"contrast",Py_BuildValue("d",0.000005));
+        // Initialize dispersion / averaging parameter dict
+        DispersionVisitor* visitor = new DispersionVisitor();
+        PyObject * disp_dict;
+        disp_dict = PyDict_New();
+        self->model->delta.dispersion->accept_as_source(visitor, self->model->delta.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "delta", disp_dict);
+
+
+         
+        // Create empty log
+        self->log = PyDict_New();
+        
+        
+
+    }
+    return 0;
+}
+
+static PyMemberDef CLamellarPSModel_members[] = {
+    {"params", T_OBJECT, offsetof(CLamellarPSModel, params), 0,
+     "Parameters"},
+	{"dispersion", T_OBJECT, offsetof(CLamellarPSModel, dispersion), 0,
+	  "Dispersion parameters"},     
+    {"log", T_OBJECT, offsetof(CLamellarPSModel, log), 0,
+     "Log"},
+    {NULL}  /* Sentinel */
+};
+
+/** Read double from PyObject
+    @param p PyObject
+    @return double
+*/
+double CLamellarPSModel_readDouble(PyObject *p) {
+    if (PyFloat_Check(p)==1) {
+        return (double)(((PyFloatObject *)(p))->ob_fval);
+    } else if (PyInt_Check(p)==1) {
+        return (double)(((PyIntObject *)(p))->ob_ival);
+    } else if (PyLong_Check(p)==1) {
+        return (double)PyLong_AsLong(p);
+    } else {
+        return 0.0;
+    }
+}
+
+
+/**
+ * Function to call to evaluate model
+ * @param args: input q or [q,phi]
+ * @return: function value
+ */
+static PyObject * run(CLamellarPSModel *self, PyObject *args) {
+	double q_value, phi_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
+    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->delta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "delta") );
+    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
+    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "delta");
+    self->model->delta.dispersion->accept_as_destination(visitor, self->model->delta.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CLamellarPSModelError, 
+	    	"CLamellarPSModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(q,phi)
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(CLamellarPSModelError, 
+	    		"CLamellarPSModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the q and phi values at which
+	    // to evaluate I(q,phi)
+	    q_value = CLamellarPSModel_readDouble(PyList_GET_ITEM(pars,0));
+	    phi_value = CLamellarPSModel_readDouble(PyList_GET_ITEM(pars,1));
+	    // Skip zero
+	    if (q_value==0) {
+	    	return Py_BuildValue("d",0.0);
+	    }
+		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		q_value = CLamellarPSModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(q_value));
+	}	
+}
+
+/**
+ * Function to call to evaluate model in cartesian coordinates
+ * @param args: input q or [qx, qy]]
+ * @return: function value
+ */
+static PyObject * runXY(CLamellarPSModel *self, PyObject *args) {
+	double qx_value, qy_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->n_plates = PyFloat_AsDouble( PyDict_GetItemString(self->params, "n_plates") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->spacing = PyFloat_AsDouble( PyDict_GetItemString(self->params, "spacing") );
+    self->model->caille = PyFloat_AsDouble( PyDict_GetItemString(self->params, "caille") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->delta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "delta") );
+    self->model->sigma = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sigma") );
+    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "delta");
+    self->model->delta.dispersion->accept_as_destination(visitor, self->model->delta.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CLamellarPSModelError, 
+	    	"CLamellarPSModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(qx, qy))
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(CLamellarPSModelError, 
+	    		"CLamellarPSModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the qx and qy values at which
+	    // to evaluate I(qx,qy)
+	    qx_value = CLamellarPSModel_readDouble(PyList_GET_ITEM(pars,0));
+	    qy_value = CLamellarPSModel_readDouble(PyList_GET_ITEM(pars,1));
+	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		qx_value = CLamellarPSModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(qx_value));
+	}	
+}
+
+static PyObject * reset(CLamellarPSModel *self, PyObject *args) {
+    
+
+    return Py_BuildValue("d",0.0);
+}
+
+static PyObject * set_dispersion(CLamellarPSModel *self, PyObject *args) {
+	PyObject * disp;
+	const char * par_name;
+
+	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
+	    PyErr_SetString(CLamellarPSModelError,
+	    	"CLamellarPSModel.set_dispersion expects a DispersionModel object.");
+		return NULL;
+	}
+	void *temp = PyCObject_AsVoidPtr(disp);
+	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
+
+
+	// Ugliness necessary to go from python to C
+	    // TODO: refactor this
+    if (!strcmp(par_name, "delta")) {
+        self->model->delta.dispersion = dispersion;
+    } else {
+	    PyErr_SetString(CLamellarPSModelError,
+	    	"CLamellarPSModel.set_dispersion expects a valid parameter name.");
+		return NULL;
+	}
+
+	DispersionVisitor* visitor = new DispersionVisitor();
+	PyObject * disp_dict = PyDict_New();
+	dispersion->accept_as_source(visitor, dispersion, disp_dict);
+	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
+    return Py_BuildValue("i",1);
+}
+
+
+static PyMethodDef CLamellarPSModel_methods[] = {
+    {"run",      (PyCFunction)run     , METH_VARARGS,
+      "Evaluate the model at a given Q or Q, phi"},
+    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
+      "Evaluate the model at a given Q or Qx, Qy"},
+    {"reset",    (PyCFunction)reset   , METH_VARARGS,
+      "Reset pair correlation"},
+    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
+      "Set the dispersion model for a given parameter"},
+   {NULL}
+};
+
+static PyTypeObject CLamellarPSModelType = {
+    PyObject_HEAD_INIT(NULL)
+    0,                         /*ob_size*/
+    "CLamellarPSModel",             /*tp_name*/
+    sizeof(CLamellarPSModel),             /*tp_basicsize*/
+    0,                         /*tp_itemsize*/
+    (destructor)CLamellarPSModel_dealloc, /*tp_dealloc*/
+    0,                         /*tp_print*/
+    0,                         /*tp_getattr*/
+    0,                         /*tp_setattr*/
+    0,                         /*tp_compare*/
+    0,                         /*tp_repr*/
+    0,                         /*tp_as_number*/
+    0,                         /*tp_as_sequence*/
+    0,                         /*tp_as_mapping*/
+    0,                         /*tp_hash */
+    0,                         /*tp_call*/
+    0,                         /*tp_str*/
+    0,                         /*tp_getattro*/
+    0,                         /*tp_setattro*/
+    0,                         /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+    "CLamellarPSModel objects",           /* tp_doc */
+    0,		               /* tp_traverse */
+    0,		               /* tp_clear */
+    0,		               /* tp_richcompare */
+    0,		               /* tp_weaklistoffset */
+    0,		               /* tp_iter */
+    0,		               /* tp_iternext */
+    CLamellarPSModel_methods,             /* tp_methods */
+    CLamellarPSModel_members,             /* tp_members */
+    0,                         /* tp_getset */
+    0,                         /* tp_base */
+    0,                         /* tp_dict */
+    0,                         /* tp_descr_get */
+    0,                         /* tp_descr_set */
+    0,                         /* tp_dictoffset */
+    (initproc)CLamellarPSModel_init,      /* tp_init */
+    0,                         /* tp_alloc */
+    CLamellarPSModel_new,                 /* tp_new */
+};
+
+
+static PyMethodDef module_methods[] = {
+    {NULL} 
+};
+
+/**
+ * Function used to add the model class to a module
+ * @param module: module to add the class to
+ */ 
+void addCLamellarPSModel(PyObject *module) {
+	PyObject *d;
+	
+    if (PyType_Ready(&CLamellarPSModelType) < 0)
+        return;
+
+    Py_INCREF(&CLamellarPSModelType);
+    PyModule_AddObject(module, "CLamellarPSModel", (PyObject *)&CLamellarPSModelType);
+    
+    d = PyModule_GetDict(module);
+    CLamellarPSModelError = PyErr_NewException("CLamellarPSModel.error", NULL, NULL);
+    PyDict_SetItemString(d, "CLamellarPSModelError", CLamellarPSModelError);
+}
+
Index: sansmodels/src/sans/models/c_models/COblateModel.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/COblateModel.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
+++ sansmodels/src/sans/models/c_models/COblateModel.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -0,0 +1,426 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/** COblateModel
+ *
+ * C extension 
+ *
+ * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
+ *          DO NOT MODIFY THIS FILE, MODIFY oblate.h
+ *          AND RE-RUN THE GENERATOR SCRIPT
+ *
+ */
+ 
+extern "C" {
+#include <Python.h>
+#include "structmember.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+#include "oblate.h"
+}
+
+#include "models.hh"
+#include "dispersion_visitor.hh"
+
+/// Error object for raised exceptions
+static PyObject * COblateModelError = NULL;
+
+
+// Class definition
+typedef struct {
+    PyObject_HEAD
+    /// Parameters
+    PyObject * params;
+    /// Dispersion parameters
+    PyObject * dispersion;
+    /// Underlying model object
+    OblateModel * model;
+    /// Log for unit testing
+    PyObject * log;
+} COblateModel;
+
+
+static void
+COblateModel_dealloc(COblateModel* self)
+{
+    self->ob_type->tp_free((PyObject*)self);
+    
+
+}
+
+static PyObject *
+COblateModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+    COblateModel *self;
+    
+    self = (COblateModel *)type->tp_alloc(type, 0);
+   
+    return (PyObject *)self;
+}
+
+static int
+COblateModel_init(COblateModel *self, PyObject *args, PyObject *kwds)
+{
+    if (self != NULL) {
+    	
+    	// Create parameters
+        self->params = PyDict_New();
+        self->dispersion = PyDict_New();
+        self->model = new OblateModel();
+        
+        // Initialize parameter dictionary
+        PyDict_SetItemString(self->params,"major_core",Py_BuildValue("d",200.000000));
+        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000));
+        PyDict_SetItemString(self->params,"minor_core",Py_BuildValue("d",20.000000));
+        PyDict_SetItemString(self->params,"axis_theta",Py_BuildValue("d",1.000000));
+        PyDict_SetItemString(self->params,"sld_solvent",Py_BuildValue("d",0.000006));
+        PyDict_SetItemString(self->params,"axis_phi",Py_BuildValue("d",1.000000));
+        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.001000));
+        PyDict_SetItemString(self->params,"major_shell",Py_BuildValue("d",250.000000));
+        PyDict_SetItemString(self->params,"contrast",Py_BuildValue("d",0.000001));
+        PyDict_SetItemString(self->params,"minor_shell",Py_BuildValue("d",30.000000));
+        // Initialize dispersion / averaging parameter dict
+        DispersionVisitor* visitor = new DispersionVisitor();
+        PyObject * disp_dict;
+        disp_dict = PyDict_New();
+        self->model->major_core.dispersion->accept_as_source(visitor, self->model->major_core.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "major_core", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->minor_core.dispersion->accept_as_source(visitor, self->model->minor_core.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "minor_core", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->major_shell.dispersion->accept_as_source(visitor, self->model->major_shell.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "major_shell", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->minor_shell.dispersion->accept_as_source(visitor, self->model->minor_shell.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "minor_shell", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->axis_theta.dispersion->accept_as_source(visitor, self->model->axis_theta.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "axis_theta", disp_dict);
+        disp_dict = PyDict_New();
+        self->model->axis_phi.dispersion->accept_as_source(visitor, self->model->axis_phi.dispersion, disp_dict);
+        PyDict_SetItemString(self->dispersion, "axis_phi", disp_dict);
+
+
+         
+        // Create empty log
+        self->log = PyDict_New();
+        
+        
+
+    }
+    return 0;
+}
+
+static PyMemberDef COblateModel_members[] = {
+    {"params", T_OBJECT, offsetof(COblateModel, params), 0,
+     "Parameters"},
+	{"dispersion", T_OBJECT, offsetof(COblateModel, dispersion), 0,
+	  "Dispersion parameters"},     
+    {"log", T_OBJECT, offsetof(COblateModel, log), 0,
+     "Log"},
+    {NULL}  /* Sentinel */
+};
+
+/** Read double from PyObject
+    @param p PyObject
+    @return double
+*/
+double COblateModel_readDouble(PyObject *p) {
+    if (PyFloat_Check(p)==1) {
+        return (double)(((PyFloatObject *)(p))->ob_fval);
+    } else if (PyInt_Check(p)==1) {
+        return (double)(((PyIntObject *)(p))->ob_ival);
+    } else if (PyLong_Check(p)==1) {
+        return (double)PyLong_AsLong(p);
+    } else {
+        return 0.0;
+    }
+}
+
+
+/**
+ * Function to call to evaluate model
+ * @param args: input q or [q,phi]
+ * @return: function value
+ */
+static PyObject * run(COblateModel *self, PyObject *args) {
+	double q_value, phi_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->major_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_core") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->minor_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_core") );
+    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
+    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
+    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->major_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_shell") );
+    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
+    self->model->minor_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_shell") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "major_core");
+    self->model->major_core.dispersion->accept_as_destination(visitor, self->model->major_core.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "minor_core");
+    self->model->minor_core.dispersion->accept_as_destination(visitor, self->model->minor_core.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "major_shell");
+    self->model->major_shell.dispersion->accept_as_destination(visitor, self->model->major_shell.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "minor_shell");
+    self->model->minor_shell.dispersion->accept_as_destination(visitor, self->model->minor_shell.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
+    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
+    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(COblateModelError, 
+	    	"COblateModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(q,phi)
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(COblateModelError, 
+	    		"COblateModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the q and phi values at which
+	    // to evaluate I(q,phi)
+	    q_value = COblateModel_readDouble(PyList_GET_ITEM(pars,0));
+	    phi_value = COblateModel_readDouble(PyList_GET_ITEM(pars,1));
+	    // Skip zero
+	    if (q_value==0) {
+	    	return Py_BuildValue("d",0.0);
+	    }
+		return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		q_value = COblateModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(q_value));
+	}	
+}
+
+/**
+ * Function to call to evaluate model in cartesian coordinates
+ * @param args: input q or [qx, qy]]
+ * @return: function value
+ */
+static PyObject * runXY(COblateModel *self, PyObject *args) {
+	double qx_value, qy_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	    // Reader parameter dictionary
+    self->model->major_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_core") );
+    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model->minor_core = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_core") );
+    self->model->axis_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_theta") );
+    self->model->sld_solvent = PyFloat_AsDouble( PyDict_GetItemString(self->params, "sld_solvent") );
+    self->model->axis_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "axis_phi") );
+    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
+    self->model->major_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "major_shell") );
+    self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") );
+    self->model->minor_shell = PyFloat_AsDouble( PyDict_GetItemString(self->params, "minor_shell") );
+    // Read in dispersion parameters
+    PyObject* disp_dict;
+    DispersionVisitor* visitor = new DispersionVisitor();
+    disp_dict = PyDict_GetItemString(self->dispersion, "major_core");
+    self->model->major_core.dispersion->accept_as_destination(visitor, self->model->major_core.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "minor_core");
+    self->model->minor_core.dispersion->accept_as_destination(visitor, self->model->minor_core.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "major_shell");
+    self->model->major_shell.dispersion->accept_as_destination(visitor, self->model->major_shell.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "minor_shell");
+    self->model->minor_shell.dispersion->accept_as_destination(visitor, self->model->minor_shell.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "axis_theta");
+    self->model->axis_theta.dispersion->accept_as_destination(visitor, self->model->axis_theta.dispersion, disp_dict);
+    disp_dict = PyDict_GetItemString(self->dispersion, "axis_phi");
+    self->model->axis_phi.dispersion->accept_as_destination(visitor, self->model->axis_phi.dispersion, disp_dict);
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(COblateModelError, 
+	    	"COblateModel.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(qx, qy))
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(COblateModelError, 
+	    		"COblateModel.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the qx and qy values at which
+	    // to evaluate I(qx,qy)
+	    qx_value = COblateModel_readDouble(PyList_GET_ITEM(pars,0));
+	    qy_value = COblateModel_readDouble(PyList_GET_ITEM(pars,1));
+	    return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		qx_value = COblateModel_readDouble(pars);		
+		
+		return Py_BuildValue("d",(*(self->model))(qx_value));
+	}	
+}
+
+static PyObject * reset(COblateModel *self, PyObject *args) {
+    
+
+    return Py_BuildValue("d",0.0);
+}
+
+static PyObject * set_dispersion(COblateModel *self, PyObject *args) {
+	PyObject * disp;
+	const char * par_name;
+
+	if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
+	    PyErr_SetString(COblateModelError,
+	    	"COblateModel.set_dispersion expects a DispersionModel object.");
+		return NULL;
+	}
+	void *temp = PyCObject_AsVoidPtr(disp);
+	DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
+
+
+	// Ugliness necessary to go from python to C
+	    // TODO: refactor this
+    if (!strcmp(par_name, "major_core")) {
+        self->model->major_core.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "minor_core")) {
+        self->model->minor_core.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "major_shell")) {
+        self->model->major_shell.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "minor_shell")) {
+        self->model->minor_shell.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "axis_theta")) {
+        self->model->axis_theta.dispersion = dispersion;
+    } else    if (!strcmp(par_name, "axis_phi")) {
+        self->model->axis_phi.dispersion = dispersion;
+    } else {
+	    PyErr_SetString(COblateModelError,
+	    	"COblateModel.set_dispersion expects a valid parameter name.");
+		return NULL;
+	}
+
+	DispersionVisitor* visitor = new DispersionVisitor();
+	PyObject * disp_dict = PyDict_New();
+	dispersion->accept_as_source(visitor, dispersion, disp_dict);
+	PyDict_SetItemString(self->dispersion, par_name, disp_dict);
+    return Py_BuildValue("i",1);
+}
+
+
+static PyMethodDef COblateModel_methods[] = {
+    {"run",      (PyCFunction)run     , METH_VARARGS,
+      "Evaluate the model at a given Q or Q, phi"},
+    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
+      "Evaluate the model at a given Q or Qx, Qy"},
+    {"reset",    (PyCFunction)reset   , METH_VARARGS,
+      "Reset pair correlation"},
+    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
+      "Set the dispersion model for a given parameter"},
+   {NULL}
+};
+
+static PyTypeObject COblateModelType = {
+    PyObject_HEAD_INIT(NULL)
+    0,                         /*ob_size*/
+    "COblateModel",             /*tp_name*/
+    sizeof(COblateModel),             /*tp_basicsize*/
+    0,                         /*tp_itemsize*/
+    (destructor)COblateModel_dealloc, /*tp_dealloc*/
+    0,                         /*tp_print*/
+    0,                         /*tp_getattr*/
+    0,                         /*tp_setattr*/
+    0,                         /*tp_compare*/
+    0,                         /*tp_repr*/
+    0,                         /*tp_as_number*/
+    0,                         /*tp_as_sequence*/
+    0,                         /*tp_as_mapping*/
+    0,                         /*tp_hash */
+    0,                         /*tp_call*/
+    0,                         /*tp_str*/
+    0,                         /*tp_getattro*/
+    0,                         /*tp_setattro*/
+    0,                         /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+    "COblateModel objects",           /* tp_doc */
+    0,		               /* tp_traverse */
+    0,		               /* tp_clear */
+    0,		               /* tp_richcompare */
+    0,		               /* tp_weaklistoffset */
+    0,		               /* tp_iter */
+    0,		               /* tp_iternext */
+    COblateModel_methods,             /* tp_methods */
+    COblateModel_members,             /* tp_members */
+    0,                         /* tp_getset */
+    0,                         /* tp_base */
+    0,                         /* tp_dict */
+    0,                         /* tp_descr_get */
+    0,                         /* tp_descr_set */
+    0,                         /* tp_dictoffset */
+    (initproc)COblateModel_init,      /* tp_init */
+    0,                         /* tp_alloc */
+    COblateModel_new,                 /* tp_new */
+};
+
+
+static PyMethodDef module_methods[] = {
+    {NULL} 
+};
+
+/**
+ * Function used to add the model class to a module
+ * @param module: module to add the class to
+ */ 
+void addCOblateModel(PyObject *module) {
+	PyObject *d;
+	
+    if (PyType_Ready(&COblateModelType) < 0)
+        return;
+
+    Py_INCREF(&COblateModelType);
+    PyModule_AddObject(module, "COblateModel", (PyObject *)&COblateModelType);
+    
+    d = PyModule_GetDict(module);
+    COblateModelError = PyErr_NewException("COblateModel.error", NULL, NULL);
+    PyDict_SetItemString(d, "COblateModelError", COblateModelError);
+}
+
Index: sansmodels/src/sans/models/c_models/c_models.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/c_models.cpp	(revision 50686972861f70ebff2c64a50118cfb6b905253a)
+++ sansmodels/src/sans/models/c_models/c_models.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -9,4 +9,5 @@
 
 void addCCylinderModel(PyObject *module);
+void addCTriaxialEllipsoidModel(PyObject *module);
 void addCParallelepipedModel(PyObject *module);
 void addCSphereModel(PyObject *module);
@@ -24,4 +25,9 @@
 void addCFlexibleCylinderModel(PyObject *module);
 void addCStackedDisksModel(PyObject *module);
+void addCLamellarPSModel(PyObject *module);
+void addCLamellarPSHGModel(PyObject *module);
+void addCOblateModel(PyObject *module);
+void addCProlateModel(PyObject *module);
+
 
 extern "C" {
@@ -167,4 +173,9 @@
 	addCFlexibleCylinderModel(m);
 	addCStackedDisksModel(m);
+	addCLamellarPSModel(m);
+	addCLamellarPSHGModel(m);
+	addCOblateModel(m);
+	addCProlateModel(m);
+
 	addDisperser(m);
 	addCGaussian(m);
Index: sansmodels/src/sans/models/c_models/lamellarPS.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPS.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
+++ sansmodels/src/sans/models/c_models/lamellarPS.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -0,0 +1,137 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ *
+ *	TODO: refactor so that we pull in the old sansmodels.c_extensions
+ *	TODO: add 2D function
+ */
+
+#include <math.h>
+#include "models.hh"
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+
+extern "C" {
+	#include "libCylinder.h"
+	#include "lamellarPS.h"
+}
+
+LamellarPSModel :: LamellarPSModel() {
+	scale      = Parameter(1.0);
+	spacing    = Parameter(400.0);
+	delta     = Parameter(30.0, true);
+	delta.set_min(0.0);
+	sigma    = Parameter(0.15, true);
+	contrast   = Parameter(5.3e-6);
+	n_plates     = Parameter(20.0);
+	caille = Parameter(0.1);
+	background = Parameter(0.0);
+
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * The NIST IGOR library is used for the actual calculation.
+ * @param q: q-value
+ * @return: function value
+ */
+double LamellarPSModel :: operator()(double q) {
+	double dp[8];
+
+	// Fill parameter array for IGOR library
+	// Add the background after averaging
+	dp[0] = scale();
+	dp[1] = spacing();
+	dp[2] = delta();
+	dp[3] = sigma();
+	dp[4] = contrast();
+	dp[5] = n_plates();
+	dp[6] = caille();
+	dp[7] = background();
+	
+
+	// Get the dispersion points for (delta) thickness
+	vector<WeightPoint> weights_delta;
+	delta.get_weights(weights_delta);
+	
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+	
+	// Loop over short_edgeA weight points
+	for(int i=0; i< (int)weights_delta.size(); i++) {
+		dp[2] = weights_delta[i].value;
+
+		sum += weights_delta[i].weight * LamellarPS(dp, q);
+		norm += weights_delta[i].weight;
+				
+	}
+	return sum/norm + background();
+}
+/**
+ * Function to evaluate 2D scattering function
+ * @param q_x: value of Q along x
+ * @param q_y: value of Q along y
+ * @return: function value
+ */
+double LamellarPSModel :: operator()(double qx, double qy) {
+	LamellarPSParameters dp;
+	// Fill parameter array
+	dp.scale      = scale();
+	dp.spacing   = spacing();
+	dp.delta  = delta();
+	dp.sigma = sigma();
+	dp.contrast   = contrast();
+	dp.n_plates = n_plates();
+	dp.caille = caille();
+	dp.background    = background();
+	
+
+	// Get the dispersion points for the delta
+	vector<WeightPoint> weights_delta;
+	delta.get_weights(weights_delta);
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+
+	// Loop over radius weight points
+	for(int i=0; i< (int)weights_delta.size(); i++) {
+		dp.delta = weights_delta[i].value;
+
+		sum += weights_delta[i].weight *lamellarPS_analytical_2DXY(&dp, qx, qy);	
+		norm += weights_delta[i].weight;	
+	}
+	
+	return sum/norm + background();
+}
+
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the cylinder
+ * @param q: q-value
+ * @param phi: angle phi
+ * @return: function value
+ */
+double LamellarPSModel :: evaluate_rphi(double q, double phi) {
+	double qx = q*cos(phi);
+	double qy = q*sin(phi);
+	return (*this).operator()(qx, qy);
+}
Index: sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
+++ sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -0,0 +1,160 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ *
+ *	TODO: refactor so that we pull in the old sansmodels.c_extensions
+ *	TODO: add 2D function
+ */
+
+#include <math.h>
+#include "models.hh"
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+
+extern "C" {
+	#include "libCylinder.h"
+	#include "lamellarPS_HG.h"
+}
+
+LamellarPSHGModel :: LamellarPSHGModel() {
+	scale      = Parameter(1.0);
+	spacing    = Parameter(40.0);
+	deltaT     = Parameter(10.0, true);
+	deltaT.set_min(0.0);
+	deltaH     = Parameter(2.0, true);
+	deltaH.set_min(0.0);
+	sld_tail    = Parameter(4e-7);
+	sld_head    = Parameter(2e-6);
+	sld_solvent   = Parameter(6e-6);
+	n_plates     = Parameter(30);
+	caille = Parameter(0.001);
+	background = Parameter(0.001);
+
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * The NIST IGOR library is used for the actual calculation.
+ * @param q: q-value
+ * @return: function value
+ */
+double LamellarPSHGModel :: operator()(double q) {
+	double dp[10];
+
+	// Fill parameter array for IGOR library
+	// Add the background after averaging
+	dp[0] = scale();
+	dp[1] = spacing();
+	dp[2] = deltaT();
+	dp[3] = deltaH();
+	dp[4] = sld_tail();
+	dp[5] = sld_head();
+	dp[6] = sld_solvent();
+	dp[7] = n_plates();
+	dp[8] = caille();
+	dp[9] = background();
+	
+
+	// Get the dispersion points for (deltaT) thickness of the tail
+	vector<WeightPoint> weights_deltaT;
+	deltaT.get_weights(weights_deltaT);
+	
+	// Get the dispersion points for (deltaH) thickness of the head
+	vector<WeightPoint> weights_deltaH;
+	deltaH.get_weights(weights_deltaH);
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+	
+	// Loop over deltaT  weight points
+	for(int i=0; i< (int)weights_deltaT.size(); i++) {
+		dp[2] = weights_deltaT[i].value;
+
+		// Loop over deltaH weight points
+		for(int j=0; j< (int)weights_deltaH.size(); j++) {
+			dp[3] = weights_deltaH[j].value;
+
+			sum += weights_deltaT[i].weight * weights_deltaH[j].weight *LamellarPS_HG(dp, q);
+			norm += weights_deltaT[i].weight * weights_deltaH[j].weight;
+		}
+				
+	}
+	return sum/norm + background();
+}
+/**
+ * Function to evaluate 2D scattering function
+ * @param q_x: value of Q along x
+ * @param q_y: value of Q along y
+ * @return: function value
+ */
+double LamellarPSHGModel :: operator()(double qx, double qy) {
+	LamellarPSHGParameters dp;
+	// Fill parameter array
+	dp.scale      = scale();
+	dp.spacing   = spacing();
+	dp.deltaT  = deltaT();
+	dp.deltaH = deltaH();
+	dp.sld_tail   = sld_tail();
+	dp.sld_head = sld_head();
+	dp.sld_solvent   = sld_solvent();
+	dp.n_plates = n_plates();
+	dp.caille = caille();
+	dp.background    = background();
+	
+	// Get the dispersion points for the deltaT
+	vector<WeightPoint> weights_deltaT;
+	deltaT.get_weights(weights_deltaT);
+
+	// Get the dispersion points for the deltaH
+	vector<WeightPoint> weights_deltaH;
+	deltaH.get_weights(weights_deltaH);
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+
+	// Loop over deltaT weight points
+	for(int i=0; i< (int)weights_deltaT.size(); i++) {
+		dp.deltaT = weights_deltaT[i].value;
+		
+		// Loop over deltaH weight points
+		for(int j=0; j< (int)weights_deltaH.size(); j++) {
+			dp.deltaH = weights_deltaH[j].value;
+
+			sum += weights_deltaT[i].weight *weights_deltaH[j].weight *lamellarPS_HG_analytical_2DXY(&dp, qx, qy);	
+			norm += weights_deltaT[i].weight * weights_deltaH[j].weight;	
+		}
+	}
+	return sum/norm + background();
+}
+
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the lamellar
+ * @param q: q-value
+ * @param phi: angle phi
+ * @return: function value
+ */
+double LamellarPSHGModel :: evaluate_rphi(double q, double phi) {
+	double qx = q*cos(phi);
+	double qy = q*sin(phi);
+	return (*this).operator()(qx, qy);
+}
Index: sansmodels/src/sans/models/c_models/lineparser.py
===================================================================
--- sansmodels/src/sans/models/c_models/lineparser.py	(revision 25a608f5e19bd180280be5c566de99df08fb9e8f)
+++ sansmodels/src/sans/models/c_models/lineparser.py	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -125,5 +125,6 @@
                     if len(temp3+ temp4)==0:
                         ## [FIXED]=  only one param
-                        listtofill= [temp.lstrip().rstrip()]
+                        if temp.lstrip().rstrip()!="":
+                            listtofill= [temp.lstrip().rstrip()]
                         
                     listtofill += temp3+temp4
@@ -180,5 +181,6 @@
                         temp4=split_list(separator=';', mylist=temp3)
                 if len(temp3+ temp4)==0:# [FIXED]=  only one param
-                    listtofill= [line.lstrip().rstrip()]
+                    if line.lstrip().rstrip()!="":
+                        listtofill= [line.lstrip().rstrip()]
                 listtofill+=temp3+temp4 #
                 break
Index: sansmodels/src/sans/models/c_models/models.hh
===================================================================
--- sansmodels/src/sans/models/c_models/models.hh	(revision 50686972861f70ebff2c64a50118cfb6b905253a)
+++ sansmodels/src/sans/models/c_models/models.hh	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -266,5 +266,4 @@
 	double evaluate_rphi(double q, double phi);
 };
-
 class TriaxialEllipsoidModel{
 public:
@@ -333,3 +332,93 @@
 	double evaluate_rphi(double q, double phi);
 };
+
+class LamellarPSModel{
+public:
+	// Model parameters
+	Parameter scale;
+	Parameter spacing;
+	Parameter delta;
+	Parameter sigma;
+	Parameter contrast;
+	Parameter n_plates;
+	Parameter caille;
+	Parameter background;
+	
+	// Constructor
+	LamellarPSModel();
+
+	// Operators to get I(Q)
+	double operator()(double q);
+	double operator()(double qx, double qy);
+	double evaluate_rphi(double q, double phi);
+};
+
+class LamellarPSHGModel{
+public:
+	// Model parameters
+	Parameter scale;
+	Parameter spacing;
+	Parameter deltaT;
+	Parameter deltaH;
+	Parameter sld_tail;
+	Parameter sld_head;
+	Parameter sld_solvent;
+	Parameter n_plates;
+	Parameter caille;
+	Parameter background;
+	
+	// Constructor
+	LamellarPSHGModel();
+
+	// Operators to get I(Q)
+	double operator()(double q);
+	double operator()(double qx, double qy);
+	double evaluate_rphi(double q, double phi);
+};
+
+class OblateModel{
+public:
+	// Model parameters
+	Parameter scale;
+	Parameter major_core;
+	Parameter minor_core;
+	Parameter major_shell;
+	Parameter minor_shell;
+	Parameter contrast;
+	Parameter sld_solvent;
+	Parameter background;
+	Parameter axis_theta;
+	Parameter axis_phi;
+	
+	// Constructor
+	OblateModel();
+
+	// Operators to get I(Q)
+	double operator()(double q);
+	double operator()(double qx, double qy);
+	double evaluate_rphi(double q, double phi);
+};
+class ProlateModel{
+public:
+	// Model parameters
+	Parameter scale;
+	Parameter major_core;
+	Parameter minor_core;
+	Parameter major_shell;
+	Parameter minor_shell;
+	Parameter contrast;
+	Parameter sld_solvent;
+	Parameter background;
+	Parameter axis_theta;
+	Parameter axis_phi;
+	
+	// Constructor
+	ProlateModel();
+
+	// Operators to get I(Q)
+	double operator()(double q);
+	double operator()(double qx, double qy);
+	double evaluate_rphi(double q, double phi);
+};
+
 #endif
Index: sansmodels/src/sans/models/c_models/oblate.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/oblate.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
+++ sansmodels/src/sans/models/c_models/oblate.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -0,0 +1,229 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ *
+ *	TODO: refactor so that we pull in the old sansmodels.c_extensions
+ */
+
+#include <math.h>
+#include "models.hh"
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+
+extern "C" {
+	#include "libCylinder.h"
+	#include "oblate.h"
+}
+
+OblateModel :: OblateModel() {
+	scale      = Parameter(1.0);
+	major_core     = Parameter(200.0, true);
+	major_core.set_min(0.0);
+	minor_core     = Parameter(20.0, true);
+	minor_core.set_min(0.0);
+	major_shell   = Parameter(250.0, true);
+	major_shell.set_min(0.0);
+	minor_shell    = Parameter(30.0, true);
+	minor_shell.set_min(0.0);
+	contrast   = Parameter(1e-6);
+	sld_solvent = Parameter(6.3e-6);
+	background = Parameter(0.0);
+	axis_theta  = Parameter(0.0, true);
+	axis_phi    = Parameter(0.0, true);
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * The NIST IGOR library is used for the actual calculation.
+ * @param q: q-value
+ * @return: function value
+ */
+double OblateModel :: operator()(double q) {
+	double dp[8];
+
+	// Fill parameter array for IGOR library
+	// Add the background after averaging
+	dp[0] = scale();
+	dp[1] = major_core();
+	dp[2] = minor_core();
+	dp[3] = major_shell();
+	dp[4] = minor_shell();
+	dp[5] = contrast();
+	dp[6] = sld_solvent();
+	dp[7] = background();
+	
+	// Get the dispersion points for the major core
+	vector<WeightPoint> weights_major_core;
+	major_core.get_weights(weights_major_core);
+
+	// Get the dispersion points for the minor core
+	vector<WeightPoint> weights_minor_core;
+	minor_core.get_weights(weights_minor_core);
+
+	// Get the dispersion points for the major shell
+	vector<WeightPoint> weights_major_shell;
+	major_shell.get_weights(weights_major_shell);
+
+	// Get the dispersion points for the minor_shell
+	vector<WeightPoint> weights_minor_shell;
+	minor_shell.get_weights(weights_minor_shell);
+
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+
+	// Loop over major core weight points
+	for(int i=0; i<(int)weights_major_core.size(); i++) {
+		dp[1] = weights_major_core[i].value;
+
+		// Loop over minor core weight points
+		for(int j=0; j<(int)weights_minor_core.size(); j++) {
+			dp[2] = weights_minor_core[j].value;
+
+			// Loop over major shell weight points
+			for(int k=0; k<(int)weights_major_shell.size(); k++) {
+				dp[3] = weights_major_shell[k].value;
+
+				// Loop over minor shell weight points
+				for(int l=0; l<(int)weights_minor_shell.size(); l++) {
+					dp[4] = weights_minor_shell[l].value;
+
+					sum += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 
+						* weights_minor_shell[l].weight * OblateForm(dp, q);
+					norm += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 
+							* weights_minor_shell[l].weight;
+				}
+			}
+		}
+	}
+	return sum/norm + background();
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param q_x: value of Q along x
+ * @param q_y: value of Q along y
+ * @return: function value
+ */
+double OblateModel :: operator()(double qx, double qy) {
+	OblateParameters dp;
+	// Fill parameter array
+	dp.scale      = scale();
+	dp.major_core = major_core();
+	dp.minor_core = minor_core();
+	dp.major_shell = major_shell();
+	dp.minor_shell = minor_shell();
+	dp.contrast = contrast();
+	dp.sld_solvent = sld_solvent();
+	dp.background = background();
+	dp.axis_theta = axis_theta();
+	dp.axis_phi = axis_phi();
+
+	// Get the dispersion points for the major core
+	vector<WeightPoint> weights_major_core;
+	major_core.get_weights(weights_major_core);
+
+	// Get the dispersion points for the minor core
+	vector<WeightPoint> weights_minor_core;
+	minor_core.get_weights(weights_minor_core);
+
+	// Get the dispersion points for the major shell
+	vector<WeightPoint> weights_major_shell;
+	major_shell.get_weights(weights_major_shell);
+
+	// Get the dispersion points for the minor shell
+	vector<WeightPoint> weights_minor_shell;
+	minor_shell.get_weights(weights_minor_shell);
+
+
+	// Get angular averaging for theta
+	vector<WeightPoint> weights_theta;
+	axis_theta.get_weights(weights_theta);
+
+	// Get angular averaging for phi
+	vector<WeightPoint> weights_phi;
+	axis_phi.get_weights(weights_phi);
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+
+	// Loop over major core weight points
+	for(int i=0; i< (int)weights_major_core.size(); i++) {
+		dp.major_core = weights_major_core[i].value;
+
+		// Loop over minor core weight points
+		for(int j=0; j< (int)weights_minor_core.size(); j++) {
+			dp.minor_core = weights_minor_core[j].value;
+
+			// Loop over major shell weight points
+			for(int k=0; k< (int)weights_major_shell.size(); k++) {
+				dp.major_shell = weights_major_shell[i].value;
+
+				// Loop over minor shell weight points
+				for(int l=0; l< (int)weights_minor_shell.size(); l++) {
+					dp.minor_shell = weights_minor_shell[l].value;
+
+					// Average over theta distribution
+					for(int m=0; m< (int)weights_theta.size(); m++) {
+						dp.axis_theta = weights_theta[m].value;
+
+						// Average over phi distribution
+						for(int n=0; n< (int)weights_phi.size(); n++) {
+							dp.axis_phi = weights_phi[n].value;
+
+							double _ptvalue = weights_major_core[i].weight *weights_minor_core[j].weight
+								* weights_major_shell[k].weight * weights_minor_shell[l].weight
+								* weights_theta[m].weight
+								* weights_phi[n].weight
+								* oblate_analytical_2DXY(&dp, qx, qy);
+							if (weights_theta.size()>1) {
+								_ptvalue *= sin(weights_theta[k].value);
+							}
+							sum += _ptvalue;
+
+							norm += weights_major_core[i].weight *weights_minor_core[j].weight
+								* weights_major_shell[k].weight * weights_minor_shell[l].weight
+								* weights_theta[m].weight * weights_phi[n].weight;
+						}
+					}
+				}
+			}
+		}
+	}
+	// Averaging in theta needs an extra normalization
+	// factor to account for the sin(theta) term in the
+	// integration (see documentation).
+	if (weights_theta.size()>1) norm = norm / asin(1.0);
+	return sum/norm + background();
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the oblate
+ * @param q: q-value
+ * @param phi: angle phi
+ * @return: function value
+ */
+double OblateModel :: evaluate_rphi(double q, double phi) {
+	double qx = q*cos(phi);
+	double qy = q*sin(phi);
+	return (*this).operator()(qx, qy);
+}
Index: sansmodels/src/sans/models/c_models/prolate.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/prolate.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
+++ sansmodels/src/sans/models/c_models/prolate.cpp	(revision 27a0771a6ddbafb74959fa451e80b17dcd5ca5ed)
@@ -0,0 +1,229 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ *
+ *	TODO: refactor so that we pull in the old sansmodels.c_extensions
+ */
+
+#include <math.h>
+#include "models.hh"
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+
+extern "C" {
+	#include "libCylinder.h"
+	#include "prolate.h"
+}
+
+ProlateModel :: ProlateModel() {
+	scale      = Parameter(1.0);
+	major_core     = Parameter(100.0, true);
+	major_core.set_min(0.0);
+	minor_core     = Parameter(50.0, true);
+	minor_core.set_min(0.0);
+	major_shell   = Parameter(110.0, true);
+	major_shell.set_min(0.0);
+	minor_shell    = Parameter(60.0, true);
+	minor_shell.set_min(0.0);
+	contrast   = Parameter(1e-6);
+	sld_solvent = Parameter(6.3e-6);
+	background = Parameter(0.0);
+	axis_theta  = Parameter(0.0, true);
+	axis_phi    = Parameter(0.0, true);
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * The NIST IGOR library is used for the actual calculation.
+ * @param q: q-value
+ * @return: function value
+ */
+double ProlateModel :: operator()(double q) {
+	double dp[8];
+
+	// Fill parameter array for IGOR library
+	// Add the background after averaging
+	dp[0] = scale();
+	dp[1] = major_core();
+	dp[2] = minor_core();
+	dp[3] = major_shell();
+	dp[4] = minor_shell();
+	dp[5] = contrast();
+	dp[6] = sld_solvent();
+	dp[7] = background();
+	
+	// Get the dispersion points for the major core
+	vector<WeightPoint> weights_major_core;
+	major_core.get_weights(weights_major_core);
+
+	// Get the dispersion points for the minor core
+	vector<WeightPoint> weights_minor_core;
+	minor_core.get_weights(weights_minor_core);
+
+	// Get the dispersion points for the major shell
+	vector<WeightPoint> weights_major_shell;
+	major_shell.get_weights(weights_major_shell);
+
+	// Get the dispersion points for the minor_shell
+	vector<WeightPoint> weights_minor_shell;
+	minor_shell.get_weights(weights_minor_shell);
+
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+
+	// Loop over major core weight points
+	for(int i=0; i<(int)weights_major_core.size(); i++) {
+		dp[1] = weights_major_core[i].value;
+
+		// Loop over minor core weight points
+		for(int j=0; j<(int)weights_minor_core.size(); j++) {
+			dp[2] = weights_minor_core[j].value;
+
+			// Loop over major shell weight points
+			for(int k=0; k<(int)weights_major_shell.size(); k++) {
+				dp[3] = weights_major_shell[k].value;
+
+				// Loop over minor shell weight points
+				for(int l=0; l<(int)weights_minor_shell.size(); l++) {
+					dp[4] = weights_minor_shell[l].value;
+
+					sum += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 
+						* weights_minor_shell[l].weight * ProlateForm(dp, q);
+					norm += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 
+							* weights_minor_shell[l].weight;
+				}
+			}
+		}
+	}
+	return sum/norm + background();
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param q_x: value of Q along x
+ * @param q_y: value of Q along y
+ * @return: function value
+ */
+double ProlateModel :: operator()(double qx, double qy) {
+	ProlateParameters dp;
+	// Fill parameter array
+	dp.scale      = scale();
+	dp.major_core = major_core();
+	dp.minor_core = minor_core();
+	dp.major_shell = major_shell();
+	dp.minor_shell = minor_shell();
+	dp.contrast = contrast();
+	dp.sld_solvent = sld_solvent();
+	dp.background = background();
+	dp.axis_theta = axis_theta();
+	dp.axis_phi = axis_phi();
+
+	// Get the dispersion points for the major core
+	vector<WeightPoint> weights_major_core;
+	major_core.get_weights(weights_major_core);
+
+	// Get the dispersion points for the minor core
+	vector<WeightPoint> weights_minor_core;
+	minor_core.get_weights(weights_minor_core);
+
+	// Get the dispersion points for the major shell
+	vector<WeightPoint> weights_major_shell;
+	major_shell.get_weights(weights_major_shell);
+
+	// Get the dispersion points for the minor shell
+	vector<WeightPoint> weights_minor_shell;
+	minor_shell.get_weights(weights_minor_shell);
+
+
+	// Get angular averaging for theta
+	vector<WeightPoint> weights_theta;
+	axis_theta.get_weights(weights_theta);
+
+	// Get angular averaging for phi
+	vector<WeightPoint> weights_phi;
+	axis_phi.get_weights(weights_phi);
+
+	// Perform the computation, with all weight points
+	double sum = 0.0;
+	double norm = 0.0;
+
+	// Loop over major core weight points
+	for(int i=0; i< (int)weights_major_core.size(); i++) {
+		dp.major_core = weights_major_core[i].value;
+
+		// Loop over minor core weight points
+		for(int j=0; j< (int)weights_minor_core.size(); j++) {
+			dp.minor_core = weights_minor_core[j].value;
+
+			// Loop over major shell weight points
+			for(int k=0; k< (int)weights_major_shell.size(); k++) {
+				dp.major_shell = weights_major_shell[i].value;
+
+				// Loop over minor shell weight points
+				for(int l=0; l< (int)weights_minor_shell.size(); l++) {
+					dp.minor_shell = weights_minor_shell[l].value;
+
+					// Average over theta distribution
+					for(int m=0; m< (int)weights_theta.size(); m++) {
+						dp.axis_theta = weights_theta[m].value;
+
+						// Average over phi distribution
+						for(int n=0; n< (int)weights_phi.size(); n++) {
+							dp.axis_phi = weights_phi[n].value;
+
+							double _ptvalue = weights_major_core[i].weight *weights_minor_core[j].weight
+								* weights_major_shell[k].weight * weights_minor_shell[l].weight
+								* weights_theta[m].weight
+								* weights_phi[n].weight
+								* prolate_analytical_2DXY(&dp, qx, qy);
+							if (weights_theta.size()>1) {
+								_ptvalue *= sin(weights_theta[k].value);
+							}
+							sum += _ptvalue;
+
+							norm += weights_major_core[i].weight *weights_minor_core[j].weight
+								* weights_major_shell[k].weight * weights_minor_shell[l].weight
+								* weights_theta[m].weight * weights_phi[n].weight;
+						}
+					}
+				}
+			}
+		}
+	}
+	// Averaging in theta needs an extra normalization
+	// factor to account for the sin(theta) term in the
+	// integration (see documentation).
+	if (weights_theta.size()>1) norm = norm / asin(1.0);
+	return sum/norm + background();
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the prolate
+ * @param q: q-value
+ * @param phi: angle phi
+ * @return: function value
+ */
+double ProlateModel :: evaluate_rphi(double q, double phi) {
+	double qx = q*cos(phi);
+	double qy = q*sin(phi);
+	return (*this).operator()(qx, qy);
+}
