Changeset 112f54c in sasview
- Timestamp:
- Dec 31, 2009 6:22:55 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:
- 7e8601f
- Parents:
- adbb821
- Location:
- realSpaceModeling/pointsmodelpy/pointsmodelpymodule
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.cc
r41e8114 r112f54c 129 129 METH_VARARGS, pypointsmodelpy_get_complex_iq__doc__}, 130 130 131 //outputPR 132 {pypointsmodelpy_outputPR__name__, pypointsmodelpy_outputPR, 133 METH_VARARGS, pypointsmodelpy_outputPR__doc__}, 131 //outputPR 132 {pypointsmodelpy_outputPR__name__, pypointsmodelpy_outputPR, 133 METH_VARARGS, pypointsmodelpy_outputPR__doc__}, 134 135 //getPR 136 {pypointsmodelpy_getPR__name__, pypointsmodelpy_getPR, 137 METH_VARARGS, pypointsmodelpy_getPR__doc__}, 134 138 135 139 //outputPR_xy -
realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc
rbbfad0a r112f54c 673 673 } 674 674 675 676 //method get_pr() 677 char pypointsmodelpy_getPR__name__[] = "get_pr"; 678 char pypointsmodelpy_getPR__doc__[] = "Return P(r) as a list of points"; 679 680 PyObject * pypointsmodelpy_getPR(PyObject *, PyObject *args) 681 { 682 PyObject *pymodel = 0; 683 char *outfile; 684 int ok = PyArg_ParseTuple(args, "O", &pymodel); 685 if(!ok) return NULL; 686 687 void *temp = PyCObject_AsVoidPtr(pymodel); 688 689 LORESModel * thislores = static_cast<LORESModel *>(temp); 690 691 // Get the P(r) array 692 Array2D<double> pr_ = thislores->GetPr(); 693 694 // Create two lists to store the r and P(r) values 695 PyObject* r_list = PyList_New(0); 696 PyObject* pr_list = PyList_New(0); 697 698 double sum = 0.0; 699 double r_stepsize = 1.0; 700 if (pr_.dim1()>2) r_stepsize = pr_[1][0] - pr_[0][0]; 701 702 for (int i = 0; i < pr_.dim1(); ++i){ 703 sum += pr_[i][1]*r_stepsize; 704 } 705 706 for (int i = 0; i < pr_.dim1(); ++i){ 707 if (pr_[i][1]==0) continue; 708 int r_append = PyList_Append(r_list, Py_BuildValue("d", pr_[i][0])); 709 int pr_append = PyList_Append(pr_list, Py_BuildValue("d", pr_[i][1]/sum)); 710 if (r_append+pr_append<0) return NULL; 711 } 712 713 return Py_BuildValue("OO", r_list, pr_list); 714 } 715 716 717 675 718 //method outputPR_xy(string filename) 676 719 char pypointsmodelpy_outputPR_xy__name__[] = "outputPR_xy"; -
realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.h
r41e8114 r112f54c 200 200 PyObject * pypointsmodelpy_outputPR(PyObject *, PyObject *); 201 201 202 //method get_pr() 203 extern char pypointsmodelpy_getPR__name__[]; 204 extern char pypointsmodelpy_getPR__doc__[]; 205 extern "C" 206 PyObject * pypointsmodelpy_getPR(PyObject *, PyObject *); 207 208 202 209 // method outputPR_xy 203 210 extern char pypointsmodelpy_outputPR_xy__name__[];
Note: See TracChangeset
for help on using the changeset viewer.