@@ -16,7 +16,7 @@ setup_pybind11(cfg)
1616#include " RAT/RATMain_initialize.h"
1717#include " RAT/RATMain_terminate.h"
1818#include " RAT/RATMain_types.h"
19- #include " RAT/makeSLDProfileXY .h"
19+ #include " RAT/makeSLDProfile .h"
2020#include " RAT/dylib.hpp"
2121#include " RAT/events/eventManager.h"
2222#include " includes/defines.h"
@@ -263,7 +263,7 @@ RAT::b_ProblemDefinition createProblemDefinitionStruct(const ProblemDefinition&
263263 problem_struct.numberOfContrasts = problem.numberOfContrasts ;
264264 stringToRatBoundedArray (problem.geometry , problem_struct.geometry .data , problem_struct.geometry .size );
265265 problem_struct.useImaginary = problem.useImaginary ;
266- problem_struct.repeatLayers = customCaller (" Problem.repeatLayers" , pyListToRatCellWrap2 , problem.repeatLayers );
266+ problem_struct.repeatLayers = customCaller (" Problem.repeatLayers" , pyArrayToRatRowArray1d , problem.repeatLayers );
267267 problem_struct.contrastBackgroundParams = customCaller (" Problem.contrastBackgroundParams" , pyListToRatCellWrap3, problem.contrastBackgroundParams );
268268 problem_struct.contrastBackgroundTypes = customCaller (" Problem.contrastBackgroundTypes" , pyListToRatCellWrap02d, problem.contrastBackgroundTypes );
269269 problem_struct.contrastBackgroundActions = customCaller (" Problem.contrastBackgroundActions" , pyListToRatCellWrap02d, problem.contrastBackgroundActions );
@@ -460,7 +460,7 @@ ProblemDefinition problemDefinitionFromStruct(const RAT::b_ProblemDefinition pro
460460 problem_def.numberOfContrasts = problem.numberOfContrasts ;
461461 stringFromRatBoundedArray (problem.geometry .data , problem.geometry .size , problem_def.geometry );
462462 problem_def.useImaginary = problem.useImaginary ;
463- problem_def.repeatLayers = pyListFromRatCellWrap2 (problem.repeatLayers );
463+ problem_def.repeatLayers = pyArrayFromRatArray1d<coder::array<real_T, 2U >> (problem.repeatLayers );
464464 problem_def.contrastBackgroundParams = pyListFromBoundedCellWrap<coder::array<RAT::cell_wrap_3, 2U >>(problem.contrastBackgroundParams );
465465 problem_def.contrastBackgroundTypes = pyListFromRatCellWrap02d (problem.contrastBackgroundTypes );
466466 problem_def.contrastBackgroundActions = pyListFromRatCellWrap02d (problem.contrastBackgroundActions );
@@ -510,9 +510,9 @@ ProblemDefinition problemDefinitionFromStruct(const RAT::b_ProblemDefinition pro
510510 return problem_def;
511511}
512512
513- BayesResults bayesResultsFromStruct (const RAT::BayesResults results)
513+ OutputBayesResult OutputBayesResultsFromStruct (const RAT::BayesResults results)
514514{
515- BayesResults bayesResults;
515+ OutputBayesResult bayesResults;
516516
517517 bayesResults.chain = pyArrayFromRatArray2d (results.chain );
518518
@@ -575,7 +575,7 @@ out_problem_def : Rat.rat_core.ProblemDefinition
575575 The project input with the updated fit values.
576576results : Rat.rat_core.OutputResult
577577 The results from a RAT calculation.
578- bayes_result : Rat.rat_core.BayesResults
578+ bayes_result : Rat.rat_core.OutputBayesResult
579579 The extra results if RAT calculation is Bayesian.
580580)" ;
581581
@@ -593,21 +593,21 @@ py::tuple RATMain(const ProblemDefinition& problem_def, const Control& control)
593593 out_problem_def.customFiles = problem_def.customFiles .attr (" copy" )();
594594 return py::make_tuple (out_problem_def,
595595 OutputResultFromStruct (results),
596- bayesResultsFromStruct (bayesResults));
596+ OutputBayesResultsFromStruct (bayesResults));
597597}
598598
599- const std::string docsMakeSLDProfileXY = R"( Creates the profiles for the SLD plots
599+ const std::string docsMakeSLDProfile = R"( Creates the profiles for the SLD plots
600600
601601Parameters
602602----------
603603bulk_in : float
604604 Bulk in value for contrast.
605605bulk_out : float
606606 Bulk out value for contrast.
607- ssub : float
608- Substrate roughness.
609607layers : np.ndarray[np.float]
610608 Array of parameters for each layer in the contrast.
609+ ssub : float
610+ Substrate roughness.
611611number_of_repeats : int, default: 1
612612 Number of times the layers are repeated.
613613
@@ -617,22 +617,20 @@ sld_profile : np.ndarray[np.float]
617617 Computed SLD profile
618618)" ;
619619
620- py::array_t <real_T> makeSLDProfileXY (real_T bulk_in,
621- real_T bulk_out,
622- real_T ssub ,
623- const py:: array_t < real_T> &layers ,
624- int number_of_repeats=DEFAULT_NREPEATS)
620+ py::array_t <real_T> makeSLDProfile (real_T bulk_in,
621+ real_T bulk_out,
622+ const py:: array_t < real_T> &layers ,
623+ real_T ssub ,
624+ int number_of_repeats=DEFAULT_NREPEATS)
625625{
626626 coder::array<real_T, 2U > out;
627627 coder::array<real_T, 2U > layers_array = pyArrayToRatArray2d (layers);
628- py::buffer_info buffer_info = layers.request ();
629- RAT::makeSLDProfileXY (bulk_in,
630- bulk_out,
631- ssub,
632- layers_array,
633- buffer_info.shape [0 ],
634- number_of_repeats,
635- out);
628+ RAT::makeSLDProfile (bulk_in,
629+ bulk_out,
630+ layers_array,
631+ ssub,
632+ number_of_repeats,
633+ out);
636634
637635 return pyArrayFromRatArray2d (out);
638636
@@ -787,14 +785,14 @@ PYBIND11_MODULE(rat_core, m) {
787785 .def_readwrite (" R_stat" , &DreamOutput::R_stat)
788786 .def_readwrite (" CR" , &DreamOutput::CR);
789787
790- py::class_<BayesResults >(m, " BayesResults " , docsBayesResults .c_str ())
788+ py::class_<OutputBayesResult >(m, " OutputBayesResult " , docsOutputBayesResult .c_str ())
791789 .def (py::init<>())
792- .def_readwrite (" predictionIntervals" , &BayesResults ::predictionIntervals)
793- .def_readwrite (" confidenceIntervals" , &BayesResults ::confidenceIntervals)
794- .def_readwrite (" dreamParams" , &BayesResults ::dreamParams)
795- .def_readwrite (" dreamOutput" , &BayesResults ::dreamOutput)
796- .def_readwrite (" nestedSamplerOutput" , &BayesResults ::nestedSamplerOutput)
797- .def_readwrite (" chain" , &BayesResults ::chain);
790+ .def_readwrite (" predictionIntervals" , &OutputBayesResult ::predictionIntervals)
791+ .def_readwrite (" confidenceIntervals" , &OutputBayesResult ::confidenceIntervals)
792+ .def_readwrite (" dreamParams" , &OutputBayesResult ::dreamParams)
793+ .def_readwrite (" dreamOutput" , &OutputBayesResult ::dreamOutput)
794+ .def_readwrite (" nestedSamplerOutput" , &OutputBayesResult ::nestedSamplerOutput)
795+ .def_readwrite (" chain" , &OutputBayesResult ::chain);
798796
799797 py::class_<Calculation>(m, " Calculation" , docsCalculation.c_str ())
800798 .def (py::init<>())
@@ -1047,7 +1045,7 @@ PYBIND11_MODULE(rat_core, m) {
10471045 p.numberOfContrasts = t[6 ].cast <real_T>();
10481046 p.geometry = t[7 ].cast <std::string>();
10491047 p.useImaginary = t[8 ].cast <bool >();
1050- p.repeatLayers = t[9 ].cast <py::list >();
1048+ p.repeatLayers = t[9 ].cast <py::array_t <real_T> >();
10511049 p.contrastBackgroundParams = t[10 ].cast <py::list>();
10521050 p.contrastBackgroundTypes = t[11 ].cast <py::list>();
10531051 p.contrastBackgroundActions = t[12 ].cast <py::list>();
@@ -1099,6 +1097,6 @@ PYBIND11_MODULE(rat_core, m) {
10991097
11001098 m.def (" RATMain" , &RATMain, docsRATMain.c_str (), py::arg (" problem_def" ), py::arg (" control" ));
11011099
1102- m.def (" makeSLDProfileXY " , &makeSLDProfileXY, docsMakeSLDProfileXY .c_str (),
1103- py::arg (" bulk_in" ), py::arg (" bulk_out" ), py::arg (" ssub " ), py::arg (" layers " ), py::arg (" number_of_repeats" ) = DEFAULT_NREPEATS);
1100+ m.def (" makeSLDProfile " , &makeSLDProfile, docsMakeSLDProfile .c_str (),
1101+ py::arg (" bulk_in" ), py::arg (" bulk_out" ), py::arg (" layers " ), py::arg (" ssub " ), py::arg (" number_of_repeats" ) = DEFAULT_NREPEATS);
11041102}
0 commit comments