Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions RATapi/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class DreamOutput(RATResult):
@dataclass
class NestedSamplerOutput(RATResult):
logZ: float
logZErr: float
nestSamples: np.ndarray
postSamples: np.ndarray

Expand Down Expand Up @@ -230,6 +231,7 @@ def make_results(

nested_sampler_output = NestedSamplerOutput(
logZ=bayes_results.nestedSamplerOutput.logZ,
logZErr=bayes_results.nestedSamplerOutput.logZErr,
nestSamples=bayes_results.nestedSamplerOutput.nestSamples,
postSamples=bayes_results.nestedSamplerOutput.postSamples,
)
Expand Down
3 changes: 3 additions & 0 deletions cpp/rat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ struct ConfidenceIntervals
struct NestedSamplerOutput
{
real_T logZ;
real_T logZErr;
py::array_t<real_T> nestSamples;
py::array_t<real_T> postSamples;
};
Expand Down Expand Up @@ -1243,6 +1244,7 @@ BayesResults bayesResultsFromStruct9T(const RAT::struct9_T results)
bayesResults.confidenceIntervals.mean = pyArrayFromRatArray2d(results.confidenceIntervals.mean);

bayesResults.nestedSamplerOutput.logZ = results.nestedSamplerOutput.LogZ;
bayesResults.nestedSamplerOutput.logZErr = results.nestedSamplerOutput.LogZErr;
bayesResults.nestedSamplerOutput.nestSamples = pyArrayFromRatArray2d(results.nestedSamplerOutput.nestSamples);
bayesResults.nestedSamplerOutput.postSamples = pyArrayFromRatArray2d(results.nestedSamplerOutput.postSamples);

Expand Down Expand Up @@ -1445,6 +1447,7 @@ PYBIND11_MODULE(rat_core, m) {
py::class_<NestedSamplerOutput>(m, "NestedSamplerOutput")
.def(py::init<>())
.def_readwrite("logZ", &NestedSamplerOutput::logZ)
.def_readwrite("logZErr", &NestedSamplerOutput::logZErr)
.def_readwrite("nestSamples", &NestedSamplerOutput::nestSamples)
.def_readwrite("postSamples", &NestedSamplerOutput::postSamples);

Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5639,6 +5639,7 @@ def dream_results():
),
nestedSamplerOutput=RATapi.outputs.NestedSamplerOutput(
logZ=0.0,
logZErr=0.0,
nestSamples=np.array([[0.0, 0.0]]),
postSamples=np.array([[0.0, 0.0]]),
),
Expand Down
1 change: 1 addition & 0 deletions tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def dream_str():
"),\n"
"nestedSamplerOutput = NestedSamplerOutput(\n"
"\tlogZ = 0.0,\n"
"\tlogZErr = 0.0,\n"
"\tnestSamples = Data array: [1 x 2],\n"
"\tpostSamples = Data array: [1 x 2],\n"
"),\n"
Expand Down
Loading