Skip to content

Commit 831a311

Browse files
committed
updated plots to no longer use x-data and updated submodule
1 parent 06630cf commit 831a311

File tree

8 files changed

+6
-291
lines changed

8 files changed

+6
-291
lines changed

RATapi/outputs.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ def __str__(self):
101101
class PredictionIntervals(RATResult):
102102
reflectivity: list
103103
sld: list
104-
reflectivityXData: list
105-
sldXData: list
106104
sampleChi: np.ndarray
107105

108106

@@ -189,8 +187,6 @@ def make_results(
189187
prediction_intervals = PredictionIntervals(
190188
reflectivity=bayes_results.predictionIntervals.reflectivity,
191189
sld=bayes_results.predictionIntervals.sld,
192-
reflectivityXData=bayes_results.predictionIntervals.reflectivityXData,
193-
sldXData=bayes_results.predictionIntervals.sldXData,
194190
sampleChi=bayes_results.predictionIntervals.sampleChi,
195191
)
196192

RATapi/utils/plotting.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,8 @@ def plot_ref_sld_helper(
118118
# Plot confidence intervals if required
119119
if confidence_intervals is not None:
120120
ref_min, ref_max = confidence_intervals["reflectivity"][i]
121-
# FIXME: remove x-data once rascalsoftware/RAT#249 is merged
122-
ref_x_data = confidence_intervals["reflectivity-x-data"][i][0]
123-
mult = (1 if not q4 else ref_x_data**4) / div
124-
ref_plot.fill_between(ref_x_data, ref_min * mult, ref_max * mult, alpha=0.6, color="grey")
121+
mult = (1 if not q4 else r[:, 0] ** 4) / div
122+
ref_plot.fill_between(r[:, 0], ref_min / div, ref_max / div, alpha=0.6, color="grey")
125123

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

153149
if data.resample[i] == 1 or data.modelType == "custom xy":
154150
layers = data.resampledLayers[i][0]
@@ -278,9 +274,6 @@ def plot_ref_sld(
278274
[(sld_inter[interval[0]], sld_inter[interval[1]]) for sld_inter in sld]
279275
for sld in results.predictionIntervals.sld
280276
],
281-
# FIXME: remove x-data once rascalsoftware/RAT#249 is merged
282-
"reflectivity-x-data": results.predictionIntervals.reflectivityXData,
283-
"sld-x-data": results.predictionIntervals.sldXData,
284277
}
285278
else:
286279
raise ValueError(

cpp/RAT

Submodule RAT updated 99 files

cpp/rat.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ struct PredictionIntervals
302302
{
303303
py::list reflectivity;
304304
py::list sld;
305-
py::list reflectivityXData;
306-
py::list sldXData;
307305
py::array_t<real_T> sampleChi;
308306
};
309307

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

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

11671163
bayesResults.confidenceIntervals.percentile95 = pyArrayFromRatArray2d(results.confidenceIntervals.percentile95);
@@ -1283,8 +1279,6 @@ PYBIND11_MODULE(rat_core, m) {
12831279
.def(py::init<>())
12841280
.def_readwrite("reflectivity", &PredictionIntervals::reflectivity)
12851281
.def_readwrite("sld", &PredictionIntervals::sld)
1286-
.def_readwrite("reflectivityXData", &PredictionIntervals::reflectivityXData)
1287-
.def_readwrite("sldXData", &PredictionIntervals::sldXData)
12881282
.def_readwrite("sampleChi", &PredictionIntervals::sampleChi);
12891283

12901284
py::class_<PlotEventData>(m, "PlotEventData")

tests/conftest.py

Lines changed: 0 additions & 264 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,138 +1778,6 @@ def dream_bayes():
17781778
),
17791779
],
17801780
]
1781-
bayes.predictionIntervals.reflectivityXData = [
1782-
np.array(
1783-
[
1784-
[
1785-
0.011403,
1786-
0.013861,
1787-
0.016848,
1788-
0.020479,
1789-
0.024892,
1790-
0.030256,
1791-
0.036777,
1792-
0.044702,
1793-
0.054336,
1794-
0.066045,
1795-
0.080279,
1796-
0.097579,
1797-
0.11861,
1798-
0.14417,
1799-
0.17524,
1800-
0.213,
1801-
0.25891,
1802-
0.3147,
1803-
0.38252,
1804-
0.46496,
1805-
0.56516,
1806-
],
1807-
],
1808-
),
1809-
np.array(
1810-
[
1811-
[
1812-
0.011403,
1813-
0.013861,
1814-
0.016848,
1815-
0.020479,
1816-
0.024892,
1817-
0.030256,
1818-
0.036777,
1819-
0.044702,
1820-
0.054336,
1821-
0.066045,
1822-
0.080279,
1823-
0.097579,
1824-
0.11861,
1825-
0.14417,
1826-
0.17524,
1827-
0.213,
1828-
0.25891,
1829-
0.3147,
1830-
0.38252,
1831-
0.46496,
1832-
0.56516,
1833-
],
1834-
],
1835-
),
1836-
]
1837-
bayes.predictionIntervals.sldXData = [
1838-
[
1839-
np.array(
1840-
[
1841-
[
1842-
0.0,
1843-
11.0,
1844-
22.0,
1845-
33.0,
1846-
44.0,
1847-
55.0,
1848-
66.0,
1849-
77.0,
1850-
88.0,
1851-
99.0,
1852-
110.0,
1853-
121.0,
1854-
132.0,
1855-
143.0,
1856-
154.0,
1857-
165.0,
1858-
176.0,
1859-
187.0,
1860-
198.0,
1861-
209.0,
1862-
220.0,
1863-
231.0,
1864-
242.0,
1865-
253.0,
1866-
264.0,
1867-
275.0,
1868-
286.0,
1869-
297.0,
1870-
308.0,
1871-
319.0,
1872-
],
1873-
],
1874-
),
1875-
np.array(
1876-
[
1877-
[
1878-
0.0,
1879-
11.0,
1880-
22.0,
1881-
33.0,
1882-
44.0,
1883-
55.0,
1884-
66.0,
1885-
77.0,
1886-
88.0,
1887-
99.0,
1888-
110.0,
1889-
121.0,
1890-
132.0,
1891-
143.0,
1892-
154.0,
1893-
165.0,
1894-
176.0,
1895-
187.0,
1896-
198.0,
1897-
209.0,
1898-
220.0,
1899-
231.0,
1900-
242.0,
1901-
253.0,
1902-
264.0,
1903-
275.0,
1904-
286.0,
1905-
297.0,
1906-
308.0,
1907-
319.0,
1908-
],
1909-
],
1910-
),
1911-
],
1912-
]
19131781
bayes.predictionIntervals.sampleChi = np.array(
19141782
[
19151783
1.46133559e16,
@@ -4050,138 +3918,6 @@ def dream_results():
40503918
),
40513919
]
40523920
],
4053-
reflectivityXData=[
4054-
np.array(
4055-
[
4056-
[
4057-
0.011403,
4058-
0.013861,
4059-
0.016848,
4060-
0.020479,
4061-
0.024892,
4062-
0.030256,
4063-
0.036777,
4064-
0.044702,
4065-
0.054336,
4066-
0.066045,
4067-
0.080279,
4068-
0.097579,
4069-
0.118610,
4070-
0.144170,
4071-
0.175240,
4072-
0.213000,
4073-
0.258910,
4074-
0.314700,
4075-
0.382520,
4076-
0.464960,
4077-
0.565160,
4078-
],
4079-
],
4080-
),
4081-
np.array(
4082-
[
4083-
[
4084-
0.011403,
4085-
0.013861,
4086-
0.016848,
4087-
0.020479,
4088-
0.024892,
4089-
0.030256,
4090-
0.036777,
4091-
0.044702,
4092-
0.054336,
4093-
0.066045,
4094-
0.080279,
4095-
0.097579,
4096-
0.118610,
4097-
0.144170,
4098-
0.175240,
4099-
0.213000,
4100-
0.258910,
4101-
0.314700,
4102-
0.382520,
4103-
0.464960,
4104-
0.565160,
4105-
],
4106-
],
4107-
),
4108-
],
4109-
sldXData=[
4110-
[
4111-
np.array(
4112-
[
4113-
[
4114-
0.0,
4115-
11.0,
4116-
22.0,
4117-
33.0,
4118-
44.0,
4119-
55.0,
4120-
66.0,
4121-
77.0,
4122-
88.0,
4123-
99.0,
4124-
110.0,
4125-
121.0,
4126-
132.0,
4127-
143.0,
4128-
154.0,
4129-
165.0,
4130-
176.0,
4131-
187.0,
4132-
198.0,
4133-
209.0,
4134-
220.0,
4135-
231.0,
4136-
242.0,
4137-
253.0,
4138-
264.0,
4139-
275.0,
4140-
286.0,
4141-
297.0,
4142-
308.0,
4143-
319.0,
4144-
],
4145-
],
4146-
),
4147-
np.array(
4148-
[
4149-
[
4150-
0.0,
4151-
11.0,
4152-
22.0,
4153-
33.0,
4154-
44.0,
4155-
55.0,
4156-
66.0,
4157-
77.0,
4158-
88.0,
4159-
99.0,
4160-
110.0,
4161-
121.0,
4162-
132.0,
4163-
143.0,
4164-
154.0,
4165-
165.0,
4166-
176.0,
4167-
187.0,
4168-
198.0,
4169-
209.0,
4170-
220.0,
4171-
231.0,
4172-
242.0,
4173-
253.0,
4174-
264.0,
4175-
275.0,
4176-
286.0,
4177-
297.0,
4178-
308.0,
4179-
319.0,
4180-
],
4181-
],
4182-
),
4183-
],
4184-
],
41853921
sampleChi=np.array(
41863922
[
41873923
1.46133559e16,

tests/test_outputs.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ def dream_str():
8686
"predictionIntervals = PredictionIntervals(\n"
8787
"\treflectivity = [Data array: [5 x 21], Data array: [5 x 21]],\n"
8888
"\tsld = [[Data array: [5 x 30], Data array: [5 x 30]]],\n"
89-
"\treflectivityXData = [Data array: [1 x 21], Data array: [1 x 21]],\n"
90-
"\tsldXData = [[Data array: [1 x 30], Data array: [1 x 30]]],\n"
9189
"\tsampleChi = Data array: [1000],\n"
9290
"),\n"
9391
"confidenceIntervals = ConfidenceIntervals(\n"

tests/test_plotting.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ def bayes_fig(request) -> plt.figure:
6868
[(curve[:, 1] - curve[:, 1] * 0.1, curve[:, 1] + curve[:, 1] * 0.1) for curve in sld]
6969
for sld in dat.sldProfiles
7070
],
71-
"reflectivity-x-data": [[curve[:, 0]] for curve in dat.reflectivity],
72-
"sld-x-data": [[[profile[:, 0]] for profile in sld] for sld in dat.sldProfiles],
7371
}
7472
return RATplot.plot_ref_sld_helper(data=dat, fig=figure, confidence_intervals=confidence_intervals)
7573

tests/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ def check_bayes_fields_equal(actual_results, expected_results) -> None:
116116
}
117117

118118
list_fields = {
119-
"predictionIntervals": ["reflectivity", "reflectivityXData"],
119+
"predictionIntervals": ["reflectivity"],
120120
"confidenceIntervals": [],
121121
"dreamParams": [],
122122
"dreamOutput": [],
123123
"nestedSamplerOutput": [],
124124
}
125125

126126
double_list_fields = {
127-
"predictionIntervals": ["sld", "sldXData"],
127+
"predictionIntervals": ["sld"],
128128
"confidenceIntervals": [],
129129
"dreamParams": [],
130130
"dreamOutput": [],

0 commit comments

Comments
 (0)