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
4 changes: 0 additions & 4 deletions RATapi/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ def __str__(self):
class PredictionIntervals(RATResult):
reflectivity: list
sld: list
reflectivityXData: list
sldXData: list
sampleChi: np.ndarray


Expand Down Expand Up @@ -189,8 +187,6 @@ def make_results(
prediction_intervals = PredictionIntervals(
reflectivity=bayes_results.predictionIntervals.reflectivity,
sld=bayes_results.predictionIntervals.sld,
reflectivityXData=bayes_results.predictionIntervals.reflectivityXData,
sldXData=bayes_results.predictionIntervals.sldXData,
sampleChi=bayes_results.predictionIntervals.sampleChi,
)

Expand Down
13 changes: 3 additions & 10 deletions RATapi/utils/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ def plot_ref_sld_helper(
# Plot confidence intervals if required
if confidence_intervals is not None:
ref_min, ref_max = confidence_intervals["reflectivity"][i]
# FIXME: remove x-data once rascalsoftware/RAT#249 is merged
ref_x_data = confidence_intervals["reflectivity-x-data"][i][0]
mult = (1 if not q4 else ref_x_data**4) / div
ref_plot.fill_between(ref_x_data, ref_min * mult, ref_max * mult, alpha=0.6, color="grey")
mult = (1 if not q4 else r[:, 0] ** 4) / div
ref_plot.fill_between(r[:, 0], ref_min / div, ref_max / div, alpha=0.6, color="grey")

if data.dataPresent[i]:
sd_x = sd[:, 0]
Expand All @@ -146,9 +144,7 @@ def plot_ref_sld_helper(
# Plot confidence intervals if required
if confidence_intervals is not None:
sld_min, sld_max = confidence_intervals["sld"][i][j]
# FIXME: remove x-data once rascalsoftware/RAT#249 is merged
sld_x_data = confidence_intervals["sld-x-data"][i][j][0]
sld_plot.fill_between(sld_x_data, sld_min, sld_max, alpha=0.6, color="grey")
sld_plot.fill_between(sld[j][:, 0], sld_min, sld_max, alpha=0.6, color="grey")

if data.resample[i] == 1 or data.modelType == "custom xy":
layers = data.resampledLayers[i][0]
Expand Down Expand Up @@ -278,9 +274,6 @@ def plot_ref_sld(
[(sld_inter[interval[0]], sld_inter[interval[1]]) for sld_inter in sld]
for sld in results.predictionIntervals.sld
],
# FIXME: remove x-data once rascalsoftware/RAT#249 is merged
"reflectivity-x-data": results.predictionIntervals.reflectivityXData,
"sld-x-data": results.predictionIntervals.sldXData,
}
else:
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion cpp/RAT
Submodule RAT updated 99 files
+1 −1 DREAMWrapper.cpp
+2 −2 DREAMWrapper.h
+3 −5 RATMain.cpp
+23 −25 RATMain_internal_types.h
+1 −1 RATMain_rtwutil.cpp
+1 −1 RATMain_rtwutil.h
+4 −11 RATMain_types.h
+144 −27 SLDFunction.cpp
+2 −0 SLDFunction.h
+608 −86 adaptive.cpp
+4 −2 adaptive.h
+5 −4 allocateLayersForContrast.cpp
+2 −2 allocateLayersForContrast.h
+6 −3 allocateParamsToLayers.cpp
+2 −2 allocateParamsToLayers.h
+11 −25 coreLayersCalculation.cpp
+78 −66 customLayers.cpp
+3 −3 customLayers.h
+38 −71 customLayers1.cpp
+3 −3 customLayers1.h
+92 −65 customXY.cpp
+3 −3 customXY.h
+67 −40 customXY1.cpp
+3 −3 customXY1.h
+418 −96 deopt.cpp
+2 −2 deopt.h
+1 −1 drawMCMC.cpp
+2 −2 drawMCMC.h
+1 −1 drawMultiNest.cpp
+2 −2 drawMultiNest.h
+1 −1 evaluateModel.cpp
+2 −2 evaluateModel.h
+1 −1 fMinSearch.cpp
+2 −2 fMinSearch.h
+10 −17 find.cpp
+3 −3 find.h
+2 −2 flip.cpp
+0 −5 groupLayersMod.cpp
+6 −13 groupLayersModImaginary.cpp
+1 −3 initializeDREAM.cpp
+2 −2 initializeDREAM.h
+13 −1 interp1.cpp
+16 −52 makeCell.cpp
+4 −9 makeCell.h
+16 −96 makeEmptyBayesResultsStruct.cpp
+2 −7 makeEmptyBayesResultsStruct.h
+8 −10 makeSLDProfileXY.cpp
+5 −5 mergesort.cpp
+1 −1 mergesort.h
+1 −1 nestedSampler.cpp
+2 −2 nestedSampler.h
+2 −2 nsIntraFun.cpp
+3 −3 nsIntraFun.h
+3 −2 processBayes.cpp
+2 −2 processBayes.h
+5 −37 processCustomFunction.cpp
+2 −2 processCustomFunction.h
+5 −36 processCustomFunction1.cpp
+2 −2 processCustomFunction1.h
+1 −2 processCustomFunction2.cpp
+2 −2 processCustomFunction2.h
+8 −39 processCustomFunction3.cpp
+2 −2 processCustomFunction3.h
+1 −1 ratDREAM.cpp
+2 −2 ratDREAM.h
+169 −214 refPercentileConfidenceIntervals.cpp
+5 −4 refPercentileConfidenceIntervals.h
+112 −157 reflectivityCalculation.cpp
+3 −3 reflectivityCalculation.h
+2 −2 reflectivityCalculation1.cpp
+3 −3 reflectivityCalculation1.h
+2 −2 reflectivityCalculation2.cpp
+3 −3 reflectivityCalculation2.h
+46 −1 resampleLayers.cpp
+3 −0 resampleLayers.h
+1 −1 resampleLayersReIm.cpp
+8 −15 runDE.cpp
+3 −3 runDE.h
+1 −30 runDREAM.cpp
+2 −2 runDREAM.h
+31 −65 runNestedSampler.cpp
+2 −2 runNestedSampler.h
+1 −1 runSimplex.cpp
+2 −2 runSimplex.h
+1 −1 simplexIntrafun.cpp
+2 −2 simplexIntrafun.h
+3 −3 sortIdx.cpp
+2 −2 sortIdx.h
+7 −7 sortLE.cpp
+4 −4 sortLE.h
+2 −23 sortrows.cpp
+2 −1 sortrows.h
+10 −23 standardLayers.cpp
+3 −3 standardLayers.h
+383 −376 standardLayers1.cpp
+3 −3 standardLayers1.h
+8 −28 structConstructorHelper.cpp
+6 −12 structConstructorHelper.h
+6 −6 triggerEvent.cpp
6 changes: 0 additions & 6 deletions cpp/rat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,6 @@ struct PredictionIntervals
{
py::list reflectivity;
py::list sld;
py::list reflectivityXData;
py::list sldXData;
py::array_t<real_T> sampleChi;
};

Expand Down Expand Up @@ -1160,8 +1158,6 @@ BayesResults bayesResultsFromStruct8T(const RAT::struct8_T results)

bayesResults.predictionIntervals.reflectivity = pyList1DFromRatCellWrap<coder::array<RAT::cell_wrap_11, 1U>>(results.predictionIntervals.reflectivity);
bayesResults.predictionIntervals.sld = pyList2dFromRatCellWrap<coder::array<RAT::cell_wrap_11, 2U>>(results.predictionIntervals.sld);
bayesResults.predictionIntervals.reflectivityXData = pyList1DFromRatCellWrap<coder::array<RAT::cell_wrap_12, 1U>>(results.predictionIntervals.reflectivityXData);
bayesResults.predictionIntervals.sldXData = pyList2dFromRatCellWrap<coder::array<RAT::cell_wrap_12, 2U>>(results.predictionIntervals.sldXData);
bayesResults.predictionIntervals.sampleChi = pyArray1dFromBoundedArray<coder::bounded_array<real_T, 1000U, 1U>>(results.predictionIntervals.sampleChi);

bayesResults.confidenceIntervals.percentile95 = pyArrayFromRatArray2d(results.confidenceIntervals.percentile95);
Expand Down Expand Up @@ -1283,8 +1279,6 @@ PYBIND11_MODULE(rat_core, m) {
.def(py::init<>())
.def_readwrite("reflectivity", &PredictionIntervals::reflectivity)
.def_readwrite("sld", &PredictionIntervals::sld)
.def_readwrite("reflectivityXData", &PredictionIntervals::reflectivityXData)
.def_readwrite("sldXData", &PredictionIntervals::sldXData)
.def_readwrite("sampleChi", &PredictionIntervals::sampleChi);

py::class_<PlotEventData>(m, "PlotEventData")
Expand Down
264 changes: 0 additions & 264 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1778,138 +1778,6 @@ def dream_bayes():
),
],
]
bayes.predictionIntervals.reflectivityXData = [
np.array(
[
[
0.011403,
0.013861,
0.016848,
0.020479,
0.024892,
0.030256,
0.036777,
0.044702,
0.054336,
0.066045,
0.080279,
0.097579,
0.11861,
0.14417,
0.17524,
0.213,
0.25891,
0.3147,
0.38252,
0.46496,
0.56516,
],
],
),
np.array(
[
[
0.011403,
0.013861,
0.016848,
0.020479,
0.024892,
0.030256,
0.036777,
0.044702,
0.054336,
0.066045,
0.080279,
0.097579,
0.11861,
0.14417,
0.17524,
0.213,
0.25891,
0.3147,
0.38252,
0.46496,
0.56516,
],
],
),
]
bayes.predictionIntervals.sldXData = [
[
np.array(
[
[
0.0,
11.0,
22.0,
33.0,
44.0,
55.0,
66.0,
77.0,
88.0,
99.0,
110.0,
121.0,
132.0,
143.0,
154.0,
165.0,
176.0,
187.0,
198.0,
209.0,
220.0,
231.0,
242.0,
253.0,
264.0,
275.0,
286.0,
297.0,
308.0,
319.0,
],
],
),
np.array(
[
[
0.0,
11.0,
22.0,
33.0,
44.0,
55.0,
66.0,
77.0,
88.0,
99.0,
110.0,
121.0,
132.0,
143.0,
154.0,
165.0,
176.0,
187.0,
198.0,
209.0,
220.0,
231.0,
242.0,
253.0,
264.0,
275.0,
286.0,
297.0,
308.0,
319.0,
],
],
),
],
]
bayes.predictionIntervals.sampleChi = np.array(
[
1.46133559e16,
Expand Down Expand Up @@ -4050,138 +3918,6 @@ def dream_results():
),
]
],
reflectivityXData=[
np.array(
[
[
0.011403,
0.013861,
0.016848,
0.020479,
0.024892,
0.030256,
0.036777,
0.044702,
0.054336,
0.066045,
0.080279,
0.097579,
0.118610,
0.144170,
0.175240,
0.213000,
0.258910,
0.314700,
0.382520,
0.464960,
0.565160,
],
],
),
np.array(
[
[
0.011403,
0.013861,
0.016848,
0.020479,
0.024892,
0.030256,
0.036777,
0.044702,
0.054336,
0.066045,
0.080279,
0.097579,
0.118610,
0.144170,
0.175240,
0.213000,
0.258910,
0.314700,
0.382520,
0.464960,
0.565160,
],
],
),
],
sldXData=[
[
np.array(
[
[
0.0,
11.0,
22.0,
33.0,
44.0,
55.0,
66.0,
77.0,
88.0,
99.0,
110.0,
121.0,
132.0,
143.0,
154.0,
165.0,
176.0,
187.0,
198.0,
209.0,
220.0,
231.0,
242.0,
253.0,
264.0,
275.0,
286.0,
297.0,
308.0,
319.0,
],
],
),
np.array(
[
[
0.0,
11.0,
22.0,
33.0,
44.0,
55.0,
66.0,
77.0,
88.0,
99.0,
110.0,
121.0,
132.0,
143.0,
154.0,
165.0,
176.0,
187.0,
198.0,
209.0,
220.0,
231.0,
242.0,
253.0,
264.0,
275.0,
286.0,
297.0,
308.0,
319.0,
],
],
),
],
],
sampleChi=np.array(
[
1.46133559e16,
Expand Down
2 changes: 0 additions & 2 deletions tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ def dream_str():
"predictionIntervals = PredictionIntervals(\n"
"\treflectivity = [Data array: [5 x 21], Data array: [5 x 21]],\n"
"\tsld = [[Data array: [5 x 30], Data array: [5 x 30]]],\n"
"\treflectivityXData = [Data array: [1 x 21], Data array: [1 x 21]],\n"
"\tsldXData = [[Data array: [1 x 30], Data array: [1 x 30]]],\n"
"\tsampleChi = Data array: [1000],\n"
"),\n"
"confidenceIntervals = ConfidenceIntervals(\n"
Expand Down
2 changes: 0 additions & 2 deletions tests/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ def bayes_fig(request) -> plt.figure:
[(curve[:, 1] - curve[:, 1] * 0.1, curve[:, 1] + curve[:, 1] * 0.1) for curve in sld]
for sld in dat.sldProfiles
],
"reflectivity-x-data": [[curve[:, 0]] for curve in dat.reflectivity],
"sld-x-data": [[[profile[:, 0]] for profile in sld] for sld in dat.sldProfiles],
}
return RATplot.plot_ref_sld_helper(data=dat, fig=figure, confidence_intervals=confidence_intervals)

Expand Down
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ def check_bayes_fields_equal(actual_results, expected_results) -> None:
}

list_fields = {
"predictionIntervals": ["reflectivity", "reflectivityXData"],
"predictionIntervals": ["reflectivity"],
"confidenceIntervals": [],
"dreamParams": [],
"dreamOutput": [],
"nestedSamplerOutput": [],
}

double_list_fields = {
"predictionIntervals": ["sld", "sldXData"],
"predictionIntervals": ["sld"],
"confidenceIntervals": [],
"dreamParams": [],
"dreamOutput": [],
Expand Down