Changeset 2cb89e7 in sasview for sansmodels/src/sans/models/c_models
- Timestamp:
- Aug 16, 2009 12:30:27 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 7d11b81
- Parents:
- b0d0723
- Location:
- sansmodels/src/sans/models/c_models
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/CParallelepipedModel.cpp
r975ec8e r2cb89e7 86 86 87 87 // Initialize parameter dictionary 88 PyDict_SetItemString(self->params,"short_a",Py_BuildValue("d",35.000000)); 88 89 PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000)); 89 PyDict_SetItemString(self->params,"longer_edgeB",Py_BuildValue("d",75.000000)); 90 PyDict_SetItemString(self->params,"long_b",Py_BuildValue("d",75.000000)); 91 PyDict_SetItemString(self->params,"longer_c",Py_BuildValue("d",400.000000)); 90 92 PyDict_SetItemString(self->params,"parallel_psi",Py_BuildValue("d",0.000000)); 91 PyDict_SetItemString(self->params,"longuest_edgeC",Py_BuildValue("d",400.000000));92 93 PyDict_SetItemString(self->params,"parallel_phi",Py_BuildValue("d",0.000000)); 93 94 PyDict_SetItemString(self->params,"parallel_theta",Py_BuildValue("d",0.000000)); 94 95 PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000)); 95 PyDict_SetItemString(self->params,"short_edgeA",Py_BuildValue("d",35.000000));96 96 PyDict_SetItemString(self->params,"contrast",Py_BuildValue("d",0.000005)); 97 97 // Initialize dispersion / averaging parameter dict … … 99 99 PyObject * disp_dict; 100 100 disp_dict = PyDict_New(); 101 self->model->short_ edgeA.dispersion->accept_as_source(visitor, self->model->short_edgeA.dispersion, disp_dict);102 PyDict_SetItemString(self->dispersion, "short_ edgeA", disp_dict);101 self->model->short_a.dispersion->accept_as_source(visitor, self->model->short_a.dispersion, disp_dict); 102 PyDict_SetItemString(self->dispersion, "short_a", disp_dict); 103 103 disp_dict = PyDict_New(); 104 self->model->long er_edgeB.dispersion->accept_as_source(visitor, self->model->longer_edgeB.dispersion, disp_dict);105 PyDict_SetItemString(self->dispersion, "long er_edgeB", disp_dict);104 self->model->long_b.dispersion->accept_as_source(visitor, self->model->long_b.dispersion, disp_dict); 105 PyDict_SetItemString(self->dispersion, "long_b", disp_dict); 106 106 disp_dict = PyDict_New(); 107 self->model->long uest_edgeC.dispersion->accept_as_source(visitor, self->model->longuest_edgeC.dispersion, disp_dict);108 PyDict_SetItemString(self->dispersion, "long uest_edgeC", disp_dict);107 self->model->longer_c.dispersion->accept_as_source(visitor, self->model->longer_c.dispersion, disp_dict); 108 PyDict_SetItemString(self->dispersion, "longer_c", disp_dict); 109 109 disp_dict = PyDict_New(); 110 110 self->model->parallel_phi.dispersion->accept_as_source(visitor, self->model->parallel_phi.dispersion, disp_dict); … … 246 246 247 247 // Reader parameter dictionary 248 self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 248 249 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 249 self->model->longer_edgeB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_edgeB") ); 250 self->model->long_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_b") ); 251 self->model->longer_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_c") ); 250 252 self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 251 self->model->longuest_edgeC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longuest_edgeC") );252 253 self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); 253 254 self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") ); 254 255 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 255 self->model->short_edgeA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_edgeA") );256 256 self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 257 257 // Read in dispersion parameters 258 258 PyObject* disp_dict; 259 259 DispersionVisitor* visitor = new DispersionVisitor(); 260 disp_dict = PyDict_GetItemString(self->dispersion, "short_ edgeA");261 self->model->short_ edgeA.dispersion->accept_as_destination(visitor, self->model->short_edgeA.dispersion, disp_dict);262 disp_dict = PyDict_GetItemString(self->dispersion, "long er_edgeB");263 self->model->long er_edgeB.dispersion->accept_as_destination(visitor, self->model->longer_edgeB.dispersion, disp_dict);264 disp_dict = PyDict_GetItemString(self->dispersion, "long uest_edgeC");265 self->model->long uest_edgeC.dispersion->accept_as_destination(visitor, self->model->longuest_edgeC.dispersion, disp_dict);260 disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 261 self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 262 disp_dict = PyDict_GetItemString(self->dispersion, "long_b"); 263 self->model->long_b.dispersion->accept_as_destination(visitor, self->model->long_b.dispersion, disp_dict); 264 disp_dict = PyDict_GetItemString(self->dispersion, "longer_c"); 265 self->model->longer_c.dispersion->accept_as_destination(visitor, self->model->longer_c.dispersion, disp_dict); 266 266 disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 267 267 self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); … … 332 332 333 333 // Reader parameter dictionary 334 self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 334 335 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 335 self->model->longer_edgeB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_edgeB") ); 336 self->model->long_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_b") ); 337 self->model->longer_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_c") ); 336 338 self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 337 self->model->longuest_edgeC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longuest_edgeC") );338 339 self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); 339 340 self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") ); 340 341 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 341 self->model->short_edgeA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_edgeA") );342 342 self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 343 343 // Read in dispersion parameters 344 344 PyObject* disp_dict; 345 345 DispersionVisitor* visitor = new DispersionVisitor(); 346 disp_dict = PyDict_GetItemString(self->dispersion, "short_ edgeA");347 self->model->short_ edgeA.dispersion->accept_as_destination(visitor, self->model->short_edgeA.dispersion, disp_dict);348 disp_dict = PyDict_GetItemString(self->dispersion, "long er_edgeB");349 self->model->long er_edgeB.dispersion->accept_as_destination(visitor, self->model->longer_edgeB.dispersion, disp_dict);350 disp_dict = PyDict_GetItemString(self->dispersion, "long uest_edgeC");351 self->model->long uest_edgeC.dispersion->accept_as_destination(visitor, self->model->longuest_edgeC.dispersion, disp_dict);346 disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 347 self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 348 disp_dict = PyDict_GetItemString(self->dispersion, "long_b"); 349 self->model->long_b.dispersion->accept_as_destination(visitor, self->model->long_b.dispersion, disp_dict); 350 disp_dict = PyDict_GetItemString(self->dispersion, "longer_c"); 351 self->model->longer_c.dispersion->accept_as_destination(visitor, self->model->longer_c.dispersion, disp_dict); 352 352 disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 353 353 self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); … … 407 407 408 408 // Reader parameter dictionary 409 self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 409 410 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 410 self->model->longer_edgeB = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_edgeB") ); 411 self->model->long_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_b") ); 412 self->model->longer_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_c") ); 411 413 self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 412 self->model->longuest_edgeC = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longuest_edgeC") );413 414 self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); 414 415 self->model->parallel_theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_theta") ); 415 416 self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") ); 416 self->model->short_edgeA = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_edgeA") );417 417 self->model->contrast = PyFloat_AsDouble( PyDict_GetItemString(self->params, "contrast") ); 418 418 // Read in dispersion parameters 419 419 PyObject* disp_dict; 420 420 DispersionVisitor* visitor = new DispersionVisitor(); 421 disp_dict = PyDict_GetItemString(self->dispersion, "short_ edgeA");422 self->model->short_ edgeA.dispersion->accept_as_destination(visitor, self->model->short_edgeA.dispersion, disp_dict);423 disp_dict = PyDict_GetItemString(self->dispersion, "long er_edgeB");424 self->model->long er_edgeB.dispersion->accept_as_destination(visitor, self->model->longer_edgeB.dispersion, disp_dict);425 disp_dict = PyDict_GetItemString(self->dispersion, "long uest_edgeC");426 self->model->long uest_edgeC.dispersion->accept_as_destination(visitor, self->model->longuest_edgeC.dispersion, disp_dict);421 disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 422 self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 423 disp_dict = PyDict_GetItemString(self->dispersion, "long_b"); 424 self->model->long_b.dispersion->accept_as_destination(visitor, self->model->long_b.dispersion, disp_dict); 425 disp_dict = PyDict_GetItemString(self->dispersion, "longer_c"); 426 self->model->longer_c.dispersion->accept_as_destination(visitor, self->model->longer_c.dispersion, disp_dict); 427 427 disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 428 428 self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); … … 486 486 // Ugliness necessary to go from python to C 487 487 // TODO: refactor this 488 if (!strcmp(par_name, "short_ edgeA")) {489 self->model->short_ edgeA.dispersion = dispersion;490 } else if (!strcmp(par_name, "long er_edgeB")) {491 self->model->long er_edgeB.dispersion = dispersion;492 } else if (!strcmp(par_name, "long uest_edgeC")) {493 self->model->long uest_edgeC.dispersion = dispersion;488 if (!strcmp(par_name, "short_a")) { 489 self->model->short_a.dispersion = dispersion; 490 } else if (!strcmp(par_name, "long_b")) { 491 self->model->long_b.dispersion = dispersion; 492 } else if (!strcmp(par_name, "longer_c")) { 493 self->model->longer_c.dispersion = dispersion; 494 494 } else if (!strcmp(par_name, "parallel_phi")) { 495 495 self->model->parallel_phi.dispersion = dispersion; -
sansmodels/src/sans/models/c_models/models.hh
r975ec8e r2cb89e7 49 49 // Model parameters 50 50 Parameter scale; 51 Parameter short_ edgeA;52 Parameter long er_edgeB;53 Parameter long uest_edgeC;51 Parameter short_a; 52 Parameter long_b; 53 Parameter longer_c; 54 54 Parameter contrast; 55 55 Parameter background;
Note: See TracChangeset
for help on using the changeset viewer.