diff --git a/RATapi/examples/__init__.py b/RATapi/examples/__init__.py index 355de43a..d2bb8877 100644 --- a/RATapi/examples/__init__.py +++ b/RATapi/examples/__init__.py @@ -3,11 +3,11 @@ from RATapi.examples.domains.domains_custom_layers import domains_custom_layers from RATapi.examples.domains.domains_custom_XY import domains_custom_XY from RATapi.examples.domains.domains_standard_layers import domains_standard_layers -from RATapi.examples.non_polarised.DSPC_custom_layers import DSPC_custom_layers -from RATapi.examples.non_polarised.DSPC_custom_XY import DSPC_custom_XY -from RATapi.examples.non_polarised.DSPC_data_background import DSPC_data_background -from RATapi.examples.non_polarised.DSPC_function_background import DSPC_function_background -from RATapi.examples.non_polarised.DSPC_standard_layers import DSPC_standard_layers +from RATapi.examples.normal_reflectivity.DSPC_custom_layers import DSPC_custom_layers +from RATapi.examples.normal_reflectivity.DSPC_custom_XY import DSPC_custom_XY +from RATapi.examples.normal_reflectivity.DSPC_data_background import DSPC_data_background +from RATapi.examples.normal_reflectivity.DSPC_function_background import DSPC_function_background +from RATapi.examples.normal_reflectivity.DSPC_standard_layers import DSPC_standard_layers __all__ = [ "absorption", diff --git a/RATapi/examples/convert_rascal_project/convert_rascal.py b/RATapi/examples/convert_rascal_project/convert_rascal.py index 9fbe1de8..f83cb38c 100644 --- a/RATapi/examples/convert_rascal_project/convert_rascal.py +++ b/RATapi/examples/convert_rascal_project/convert_rascal.py @@ -5,7 +5,7 @@ # convert R1 project to Project class -def convert_rascal(): +def convert_rascal(mat_filename="lipid_bilayer.mat"): project_path = pathlib.Path(__file__).parent / "R1monolayerVolumeModel.mat" project = RAT.utils.convert.r1_to_project_class(project_path) @@ -16,7 +16,7 @@ def convert_rascal(): # convert DSPC standard layers example to a struct and save as file lipid_bilayer_project = RAT.examples.DSPC_standard_layers()[0] - RAT.utils.convert.project_class_to_r1(lipid_bilayer_project, filename="lipid_bilayer.mat") + RAT.utils.convert.project_class_to_r1(lipid_bilayer_project, filename=mat_filename) # convert and return as a Python dictionary struct = RAT.utils.convert.project_class_to_r1(lipid_bilayer_project, return_struct=True) diff --git a/RATapi/examples/non_polarised/backgroundFunction.m b/RATapi/examples/non_polarised/backgroundFunction.m deleted file mode 100644 index 181e0f58..00000000 --- a/RATapi/examples/non_polarised/backgroundFunction.m +++ /dev/null @@ -1,14 +0,0 @@ -function background = backgroundFunction(xdata,params) - -% Split up the params array.... -Ao = params(1); -k = params(2); -backConst = params(3); - -% Make an exponential decay background.... -background = zeros(numel(xdata),1); -for i = 1:numel(xdata) - background(i) = Ao*exp(-k*xdata(i)) + backConst; -end - -end diff --git a/RATapi/examples/non_polarised/DSPC_custom_XY.py b/RATapi/examples/normal_reflectivity/DSPC_custom_XY.py similarity index 100% rename from RATapi/examples/non_polarised/DSPC_custom_XY.py rename to RATapi/examples/normal_reflectivity/DSPC_custom_XY.py diff --git a/RATapi/examples/non_polarised/DSPC_custom_layers.ipynb b/RATapi/examples/normal_reflectivity/DSPC_custom_layers.ipynb similarity index 100% rename from RATapi/examples/non_polarised/DSPC_custom_layers.ipynb rename to RATapi/examples/normal_reflectivity/DSPC_custom_layers.ipynb diff --git a/RATapi/examples/non_polarised/DSPC_custom_layers.py b/RATapi/examples/normal_reflectivity/DSPC_custom_layers.py similarity index 100% rename from RATapi/examples/non_polarised/DSPC_custom_layers.py rename to RATapi/examples/normal_reflectivity/DSPC_custom_layers.py diff --git a/RATapi/examples/non_polarised/DSPC_custom_xy.ipynb b/RATapi/examples/normal_reflectivity/DSPC_custom_xy.ipynb similarity index 100% rename from RATapi/examples/non_polarised/DSPC_custom_xy.ipynb rename to RATapi/examples/normal_reflectivity/DSPC_custom_xy.ipynb diff --git a/RATapi/examples/non_polarised/DSPC_data_background.py b/RATapi/examples/normal_reflectivity/DSPC_data_background.py similarity index 100% rename from RATapi/examples/non_polarised/DSPC_data_background.py rename to RATapi/examples/normal_reflectivity/DSPC_data_background.py diff --git a/RATapi/examples/non_polarised/DSPC_function_background.py b/RATapi/examples/normal_reflectivity/DSPC_function_background.py similarity index 97% rename from RATapi/examples/non_polarised/DSPC_function_background.py rename to RATapi/examples/normal_reflectivity/DSPC_function_background.py index 1ad863fa..8a691107 100644 --- a/RATapi/examples/non_polarised/DSPC_function_background.py +++ b/RATapi/examples/normal_reflectivity/DSPC_function_background.py @@ -142,11 +142,10 @@ def DSPC_function_background(): ) problem.backgrounds.append(name="SMW Background", type="constant", source="Background parameter SMW") - # FIXME: replace this with a Python custom file when Python backgrounds are added! problem.custom_files.append( name="D2O Background Function", - filename="backgroundFunction.m", - language="matlab", + filename="background_function.py", + language="python", path=pathlib.Path(__file__).parent.resolve(), ) diff --git a/RATapi/examples/non_polarised/DSPC_standard_layers.ipynb b/RATapi/examples/normal_reflectivity/DSPC_standard_layers.ipynb similarity index 100% rename from RATapi/examples/non_polarised/DSPC_standard_layers.ipynb rename to RATapi/examples/normal_reflectivity/DSPC_standard_layers.ipynb diff --git a/RATapi/examples/non_polarised/DSPC_standard_layers.py b/RATapi/examples/normal_reflectivity/DSPC_standard_layers.py similarity index 100% rename from RATapi/examples/non_polarised/DSPC_standard_layers.py rename to RATapi/examples/normal_reflectivity/DSPC_standard_layers.py diff --git a/RATapi/examples/non_polarised/__init__.py b/RATapi/examples/normal_reflectivity/__init__.py similarity index 100% rename from RATapi/examples/non_polarised/__init__.py rename to RATapi/examples/normal_reflectivity/__init__.py diff --git a/RATapi/examples/non_polarised/backgroundFunction.py b/RATapi/examples/normal_reflectivity/background_function.py similarity index 61% rename from RATapi/examples/non_polarised/backgroundFunction.py rename to RATapi/examples/normal_reflectivity/background_function.py index 1045298c..6728d6f8 100644 --- a/RATapi/examples/non_polarised/backgroundFunction.py +++ b/RATapi/examples/normal_reflectivity/background_function.py @@ -8,8 +8,6 @@ def backgroundFunction(xdata, params): back_const = params[2] # Make an exponential decay background - background = np.zeros(len(xdata)) - for i in range(0, len(xdata)): - background[i] = Ao * np.exp(-k * xdata[i]) + back_const + background = Ao * np.exp(-k * np.array(xdata)) + back_const return background diff --git a/RATapi/examples/non_polarised/custom_XY_DSPC.py b/RATapi/examples/normal_reflectivity/custom_XY_DSPC.py similarity index 100% rename from RATapi/examples/non_polarised/custom_XY_DSPC.py rename to RATapi/examples/normal_reflectivity/custom_XY_DSPC.py diff --git a/RATapi/examples/non_polarised/custom_bilayer_DSPC.py b/RATapi/examples/normal_reflectivity/custom_bilayer_DSPC.py similarity index 100% rename from RATapi/examples/non_polarised/custom_bilayer_DSPC.py rename to RATapi/examples/normal_reflectivity/custom_bilayer_DSPC.py diff --git a/RATapi/inputs.py b/RATapi/inputs.py index 9091e892..e747e3ab 100644 --- a/RATapi/inputs.py +++ b/RATapi/inputs.py @@ -247,6 +247,7 @@ def make_problem(project: RATapi.Project, checks: Checks) -> ProblemDefinition: background = project.backgrounds[contrast.background] contrast_background_types.append(background.type) contrast_background_param = [] + if background.type == TypeOptions.Data: contrast_background_param.append(project.data.index(background.source, True)) if background.value_1 != "": @@ -275,17 +276,34 @@ def make_problem(project: RATapi.Project, checks: Checks) -> ProblemDefinition: contrast_background_params.append(contrast_background_param) - # contrast data has exactly six columns to include background data if relevant - all_data.append(np.column_stack((data, np.zeros((data.shape[0], 6 - data.shape[1]))))) - - # Set resolution parameters, with -1 used to indicate a data resolution - contrast_resolution_param = [] + # set resolution parameters resolution = project.resolutions[contrast.resolution] contrast_resolution_types.append(resolution.type) - if resolution.source: + contrast_resolution_param = [] + if resolution.type == TypeOptions.Function: + contrast_resolution_param.append(project.custom_files.index(resolution.source, True)) + contrast_resolution_param.extend( + [ + project.resolution_parameters.index(value, True) + for value in [ + resolution.value_1, + resolution.value_2, + resolution.value_3, + resolution.value_4, + resolution.value_5, + ] + if value != "" + ] + ) + + elif resolution.type == TypeOptions.Constant: contrast_resolution_param.append(project.resolution_parameters.index(resolution.source, True)) + contrast_resolution_params.append(contrast_resolution_param) + # contrast data has exactly six columns to include background data if relevant + all_data.append(np.column_stack((data, np.zeros((data.shape[0], 6 - data.shape[1]))))) + problem = ProblemDefinition() problem.TF = project.calculation diff --git a/RATapi/outputs.py b/RATapi/outputs.py index 0f2f9a70..0f5aeb31 100644 --- a/RATapi/outputs.py +++ b/RATapi/outputs.py @@ -81,6 +81,7 @@ class Results: simulation: list shiftedData: list backgrounds: list + resolutions: list layerSlds: list sldProfiles: list resampledLayers: list @@ -239,6 +240,7 @@ def make_results( simulation=output_results.simulation, shiftedData=output_results.shiftedData, backgrounds=output_results.backgrounds, + resolutions=output_results.resolutions, layerSlds=output_results.layerSlds, sldProfiles=output_results.sldProfiles, resampledLayers=output_results.resampledLayers, @@ -260,6 +262,7 @@ def make_results( simulation=output_results.simulation, shiftedData=output_results.shiftedData, backgrounds=output_results.backgrounds, + resolutions=output_results.resolutions, layerSlds=output_results.layerSlds, sldProfiles=output_results.sldProfiles, resampledLayers=output_results.resampledLayers, diff --git a/RATapi/project.py b/RATapi/project.py index 71de9476..176298f5 100644 --- a/RATapi/project.py +++ b/RATapi/project.py @@ -62,7 +62,6 @@ def discriminate_contrasts(contrast_input): "resolutions.value_4": "resolution_parameters", "resolutions.value_5": "resolution_parameters", "resolutions.constant.source": "resolution_parameters", - "resolutions.data.source": "data", "resolutions.function.source": "custom_files", "layers.thickness": "parameters", "layers.SLD": "parameters", @@ -90,7 +89,6 @@ def discriminate_contrasts(contrast_input): "data": [ AllFields("contrasts", ["data"]), AllFields("backgrounds", ["source"]), - AllFields("resolutions", ["source"]), ], "custom_files": [AllFields("backgrounds", ["source"]), AllFields("resolutions", ["source"])], "backgrounds": [AllFields("contrasts", ["background"])], diff --git a/cpp/RAT b/cpp/RAT index ed7888e3..e14ea44c 160000 --- a/cpp/RAT +++ b/cpp/RAT @@ -1 +1 @@ -Subproject commit ed7888e3946fa3ac168e3faf43536fccb0fbc37e +Subproject commit e14ea44c57b376e9f73936320b0d460e8bec3779 diff --git a/cpp/rat.cpp b/cpp/rat.cpp index 8dda5e79..759e7d48 100644 --- a/cpp/rat.cpp +++ b/cpp/rat.cpp @@ -1013,7 +1013,7 @@ py::list pyListFromRatCellWrap0(coder::array values) py::list result; for (int32_T idx0{0}; idx0 < values.size(1); idx0++) { std::string tmp; - stringToRatBoundedArray(tmp, values[idx0].f1.data, values[idx0].f1.size); + stringFromRatBoundedArray(values[idx0].f1.data, values[idx0].f1.size, tmp); result.append(tmp); } @@ -1853,13 +1853,13 @@ PYBIND11_MODULE(rat_core, m) { p.bulkIns, p.bulkOuts, p.resolutionParams, p.params, p.numberOfLayers, p.contrastLayers, p.layersDetails, p.customFiles, p.modelType, p.contrastCustomFiles, p.contrastDomainRatios, p.domainRatios, p.numberOfDomainContrasts, p.domainContrastLayers, p.fitParams, p.otherParams, p.fitLimits, - p.otherLimits, p.names.backgroundParams, p.names.scalefactors, p.names.qzshifts, p.names.bulkIns, - p.names.bulkOuts, p.names.resolutionParams, p.names.domainRatios, p.names.contrasts, + p.otherLimits, p.names.params, p.names.backgroundParams, p.names.scalefactors, p.names.qzshifts, + p.names.bulkIns, p.names.bulkOuts, p.names.resolutionParams, p.names.domainRatios, p.names.contrasts, p.checks.params, p.checks.backgroundParams, p.checks.scalefactors, p.checks.qzshifts, p.checks.bulkIns, p.checks.bulkOuts, p.checks.resolutionParams, p.checks.domainRatios); }, [](py::tuple t) { // __setstate__ - if (t.size() != 57) + if (t.size() != 58) throw std::runtime_error("Encountered invalid state unpickling ProblemDefinition object!"); /* Create a new C++ instance */ @@ -1907,23 +1907,24 @@ PYBIND11_MODULE(rat_core, m) { p.fitLimits = t[39].cast>(); p.otherLimits = t[40].cast>(); - p.names.backgroundParams = t[41].cast(); - p.names.scalefactors = t[42].cast(); - p.names.qzshifts = t[43].cast(); - p.names.bulkIns = t[44].cast(); - p.names.bulkOuts = t[45].cast(); - p.names.resolutionParams = t[46].cast(); - p.names.domainRatios = t[47].cast(); - p.names.contrasts = t[48].cast(); - - p.checks.params = t[49].cast>(); - p.checks.backgroundParams = t[50].cast>(); - p.checks.scalefactors = t[51].cast>(); - p.checks.qzshifts = t[52].cast>(); - p.checks.bulkIns = t[53].cast>(); - p.checks.bulkOuts = t[54].cast>(); - p.checks.resolutionParams = t[55].cast>(); - p.checks.domainRatios = t[56].cast>(); + p.names.params = t[41].cast(); + p.names.backgroundParams = t[42].cast(); + p.names.scalefactors = t[43].cast(); + p.names.qzshifts = t[44].cast(); + p.names.bulkIns = t[45].cast(); + p.names.bulkOuts = t[46].cast(); + p.names.resolutionParams = t[47].cast(); + p.names.domainRatios = t[48].cast(); + p.names.contrasts = t[49].cast(); + + p.checks.params = t[50].cast>(); + p.checks.backgroundParams = t[51].cast>(); + p.checks.scalefactors = t[52].cast>(); + p.checks.qzshifts = t[53].cast>(); + p.checks.bulkIns = t[54].cast>(); + p.checks.bulkOuts = t[55].cast>(); + p.checks.resolutionParams = t[56].cast>(); + p.checks.domainRatios = t[57].cast>(); return p; })); diff --git a/tests/conftest.py b/tests/conftest.py index 4f280ec6..0b78d192 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,5 @@ +import shutil +import tempfile from pathlib import Path import numpy as np @@ -9,6 +11,13 @@ import RATapi.rat_core +@pytest.fixture +def temp_dir(): + path = tempfile.mkdtemp() + yield path + shutil.rmtree(path) + + @pytest.fixture def input_project(): """A cut-down version of the input Project object for a reflectivity calculation set out in @@ -591,6 +600,180 @@ def reflectivity_calculation_output_results(): ] ), ] + results.resolutions = [ + np.array( + [ + [0.011403, 0.03], + [0.011973, 0.03], + [0.012572, 0.03], + [0.013201, 0.03], + [0.013861, 0.03], + [0.014554, 0.03], + [0.015281, 0.03], + [0.016045, 0.03], + [0.016848, 0.03], + [0.01769, 0.03], + [0.018575, 0.03], + [0.019503, 0.03], + [0.020479, 0.03], + [0.021502, 0.03], + [0.022578, 0.03], + [0.023706, 0.03], + [0.024892, 0.03], + [0.026136, 0.03], + [0.027443, 0.03], + [0.028815, 0.03], + [0.030256, 0.03], + [0.031769, 0.03], + [0.033357, 0.03], + [0.035025, 0.03], + [0.036777, 0.03], + [0.038615, 0.03], + [0.040546, 0.03], + [0.042573, 0.03], + [0.044702, 0.03], + [0.046937, 0.03], + [0.049284, 0.03], + [0.051748, 0.03], + [0.054336, 0.03], + [0.057052, 0.03], + [0.059905, 0.03], + [0.0629, 0.03], + [0.066045, 0.03], + [0.069348, 0.03], + [0.072815, 0.03], + [0.076456, 0.03], + [0.080279, 0.03], + [0.084292, 0.03], + [0.088507, 0.03], + [0.092932, 0.03], + [0.097579, 0.03], + [0.10246, 0.03], + [0.10758, 0.03], + [0.11296, 0.03], + [0.11861, 0.03], + [0.12454, 0.03], + [0.13077, 0.03], + [0.1373, 0.03], + [0.14417, 0.03], + [0.15138, 0.03], + [0.15895, 0.03], + [0.16689, 0.03], + [0.17524, 0.03], + [0.184, 0.03], + [0.1932, 0.03], + [0.20286, 0.03], + [0.213, 0.03], + [0.22365, 0.03], + [0.23484, 0.03], + [0.24658, 0.03], + [0.25891, 0.03], + [0.27185, 0.03], + [0.28544, 0.03], + [0.29972, 0.03], + [0.3147, 0.03], + [0.33044, 0.03], + [0.34696, 0.03], + [0.36431, 0.03], + [0.38252, 0.03], + [0.40165, 0.03], + [0.42173, 0.03], + [0.44282, 0.03], + [0.46496, 0.03], + [0.48821, 0.03], + [0.51262, 0.03], + [0.53825, 0.03], + [0.56516, 0.03], + [0.59342, 0.03], + ] + ), + np.array( + [ + [0.011403, 0.03], + [0.011973, 0.03], + [0.012572, 0.03], + [0.013201, 0.03], + [0.013861, 0.03], + [0.014554, 0.03], + [0.015281, 0.03], + [0.016045, 0.03], + [0.016848, 0.03], + [0.01769, 0.03], + [0.018575, 0.03], + [0.019503, 0.03], + [0.020479, 0.03], + [0.021502, 0.03], + [0.022578, 0.03], + [0.023706, 0.03], + [0.024892, 0.03], + [0.026136, 0.03], + [0.027443, 0.03], + [0.028815, 0.03], + [0.030256, 0.03], + [0.031769, 0.03], + [0.033357, 0.03], + [0.035025, 0.03], + [0.036777, 0.03], + [0.038615, 0.03], + [0.040546, 0.03], + [0.042573, 0.03], + [0.044702, 0.03], + [0.046937, 0.03], + [0.049284, 0.03], + [0.051748, 0.03], + [0.054336, 0.03], + [0.057052, 0.03], + [0.059905, 0.03], + [0.0629, 0.03], + [0.066045, 0.03], + [0.069348, 0.03], + [0.072815, 0.03], + [0.076456, 0.03], + [0.080279, 0.03], + [0.084292, 0.03], + [0.088507, 0.03], + [0.092932, 0.03], + [0.097579, 0.03], + [0.10246, 0.03], + [0.10758, 0.03], + [0.11296, 0.03], + [0.11861, 0.03], + [0.12454, 0.03], + [0.13077, 0.03], + [0.1373, 0.03], + [0.14417, 0.03], + [0.15138, 0.03], + [0.15895, 0.03], + [0.16689, 0.03], + [0.17524, 0.03], + [0.184, 0.03], + [0.1932, 0.03], + [0.20286, 0.03], + [0.213, 0.03], + [0.22365, 0.03], + [0.23484, 0.03], + [0.24658, 0.03], + [0.25891, 0.03], + [0.27185, 0.03], + [0.28544, 0.03], + [0.29972, 0.03], + [0.3147, 0.03], + [0.33044, 0.03], + [0.34696, 0.03], + [0.36431, 0.03], + [0.38252, 0.03], + [0.40165, 0.03], + [0.42173, 0.03], + [0.44282, 0.03], + [0.46496, 0.03], + [0.48821, 0.03], + [0.51262, 0.03], + [0.53825, 0.03], + [0.56516, 0.03], + [0.59342, 0.03], + ] + ), + ] results.layerSlds = [ [ np.array( @@ -1073,6 +1256,180 @@ def reflectivity_calculation_results(): ] ), ], + resolutions=[ + np.array( + [ + [0.011403, 0.03], + [0.011973, 0.03], + [0.012572, 0.03], + [0.013201, 0.03], + [0.013861, 0.03], + [0.014554, 0.03], + [0.015281, 0.03], + [0.016045, 0.03], + [0.016848, 0.03], + [0.01769, 0.03], + [0.018575, 0.03], + [0.019503, 0.03], + [0.020479, 0.03], + [0.021502, 0.03], + [0.022578, 0.03], + [0.023706, 0.03], + [0.024892, 0.03], + [0.026136, 0.03], + [0.027443, 0.03], + [0.028815, 0.03], + [0.030256, 0.03], + [0.031769, 0.03], + [0.033357, 0.03], + [0.035025, 0.03], + [0.036777, 0.03], + [0.038615, 0.03], + [0.040546, 0.03], + [0.042573, 0.03], + [0.044702, 0.03], + [0.046937, 0.03], + [0.049284, 0.03], + [0.051748, 0.03], + [0.054336, 0.03], + [0.057052, 0.03], + [0.059905, 0.03], + [0.0629, 0.03], + [0.066045, 0.03], + [0.069348, 0.03], + [0.072815, 0.03], + [0.076456, 0.03], + [0.080279, 0.03], + [0.084292, 0.03], + [0.088507, 0.03], + [0.092932, 0.03], + [0.097579, 0.03], + [0.10246, 0.03], + [0.10758, 0.03], + [0.11296, 0.03], + [0.11861, 0.03], + [0.12454, 0.03], + [0.13077, 0.03], + [0.1373, 0.03], + [0.14417, 0.03], + [0.15138, 0.03], + [0.15895, 0.03], + [0.16689, 0.03], + [0.17524, 0.03], + [0.184, 0.03], + [0.1932, 0.03], + [0.20286, 0.03], + [0.213, 0.03], + [0.22365, 0.03], + [0.23484, 0.03], + [0.24658, 0.03], + [0.25891, 0.03], + [0.27185, 0.03], + [0.28544, 0.03], + [0.29972, 0.03], + [0.3147, 0.03], + [0.33044, 0.03], + [0.34696, 0.03], + [0.36431, 0.03], + [0.38252, 0.03], + [0.40165, 0.03], + [0.42173, 0.03], + [0.44282, 0.03], + [0.46496, 0.03], + [0.48821, 0.03], + [0.51262, 0.03], + [0.53825, 0.03], + [0.56516, 0.03], + [0.59342, 0.03], + ] + ), + np.array( + [ + [0.011403, 0.03], + [0.011973, 0.03], + [0.012572, 0.03], + [0.013201, 0.03], + [0.013861, 0.03], + [0.014554, 0.03], + [0.015281, 0.03], + [0.016045, 0.03], + [0.016848, 0.03], + [0.01769, 0.03], + [0.018575, 0.03], + [0.019503, 0.03], + [0.020479, 0.03], + [0.021502, 0.03], + [0.022578, 0.03], + [0.023706, 0.03], + [0.024892, 0.03], + [0.026136, 0.03], + [0.027443, 0.03], + [0.028815, 0.03], + [0.030256, 0.03], + [0.031769, 0.03], + [0.033357, 0.03], + [0.035025, 0.03], + [0.036777, 0.03], + [0.038615, 0.03], + [0.040546, 0.03], + [0.042573, 0.03], + [0.044702, 0.03], + [0.046937, 0.03], + [0.049284, 0.03], + [0.051748, 0.03], + [0.054336, 0.03], + [0.057052, 0.03], + [0.059905, 0.03], + [0.0629, 0.03], + [0.066045, 0.03], + [0.069348, 0.03], + [0.072815, 0.03], + [0.076456, 0.03], + [0.080279, 0.03], + [0.084292, 0.03], + [0.088507, 0.03], + [0.092932, 0.03], + [0.097579, 0.03], + [0.10246, 0.03], + [0.10758, 0.03], + [0.11296, 0.03], + [0.11861, 0.03], + [0.12454, 0.03], + [0.13077, 0.03], + [0.1373, 0.03], + [0.14417, 0.03], + [0.15138, 0.03], + [0.15895, 0.03], + [0.16689, 0.03], + [0.17524, 0.03], + [0.184, 0.03], + [0.1932, 0.03], + [0.20286, 0.03], + [0.213, 0.03], + [0.22365, 0.03], + [0.23484, 0.03], + [0.24658, 0.03], + [0.25891, 0.03], + [0.27185, 0.03], + [0.28544, 0.03], + [0.29972, 0.03], + [0.3147, 0.03], + [0.33044, 0.03], + [0.34696, 0.03], + [0.36431, 0.03], + [0.38252, 0.03], + [0.40165, 0.03], + [0.42173, 0.03], + [0.44282, 0.03], + [0.46496, 0.03], + [0.48821, 0.03], + [0.51262, 0.03], + [0.53825, 0.03], + [0.56516, 0.03], + [0.59342, 0.03], + ] + ), + ], layerSlds=[ [ np.array( @@ -1386,6 +1743,354 @@ def dream_output_results(): ], ), ] + results.backgrounds = [ + np.array( + [ + [1.14030000e-02, 2.37401704e-06, 0.00000000e00], + [1.19730000e-02, 2.37401704e-06, 0.00000000e00], + [1.25720000e-02, 2.37401704e-06, 0.00000000e00], + [1.32010000e-02, 2.37401704e-06, 0.00000000e00], + [1.38610000e-02, 2.37401704e-06, 0.00000000e00], + [1.45540000e-02, 2.37401704e-06, 0.00000000e00], + [1.52810000e-02, 2.37401704e-06, 0.00000000e00], + [1.60450000e-02, 2.37401704e-06, 0.00000000e00], + [1.68480000e-02, 2.37401704e-06, 0.00000000e00], + [1.76900000e-02, 2.37401704e-06, 0.00000000e00], + [1.85750000e-02, 2.37401704e-06, 0.00000000e00], + [1.95030000e-02, 2.37401704e-06, 0.00000000e00], + [2.04790000e-02, 2.37401704e-06, 0.00000000e00], + [2.15020000e-02, 2.37401704e-06, 0.00000000e00], + [2.25780000e-02, 2.37401704e-06, 0.00000000e00], + [2.37060000e-02, 2.37401704e-06, 0.00000000e00], + [2.48920000e-02, 2.37401704e-06, 0.00000000e00], + [2.61360000e-02, 2.37401704e-06, 0.00000000e00], + [2.74430000e-02, 2.37401704e-06, 0.00000000e00], + [2.88150000e-02, 2.37401704e-06, 0.00000000e00], + [3.02560000e-02, 2.37401704e-06, 0.00000000e00], + [3.17690000e-02, 2.37401704e-06, 0.00000000e00], + [3.33570000e-02, 2.37401704e-06, 0.00000000e00], + [3.50250000e-02, 2.37401704e-06, 0.00000000e00], + [3.67770000e-02, 2.37401704e-06, 0.00000000e00], + [3.86150000e-02, 2.37401704e-06, 0.00000000e00], + [4.05460000e-02, 2.37401704e-06, 0.00000000e00], + [4.25730000e-02, 2.37401704e-06, 0.00000000e00], + [4.47020000e-02, 2.37401704e-06, 0.00000000e00], + [4.69370000e-02, 2.37401704e-06, 0.00000000e00], + [4.92840000e-02, 2.37401704e-06, 0.00000000e00], + [5.17480000e-02, 2.37401704e-06, 0.00000000e00], + [5.43360000e-02, 2.37401704e-06, 0.00000000e00], + [5.70520000e-02, 2.37401704e-06, 0.00000000e00], + [5.99050000e-02, 2.37401704e-06, 0.00000000e00], + [6.29000000e-02, 2.37401704e-06, 0.00000000e00], + [6.60450000e-02, 2.37401704e-06, 0.00000000e00], + [6.93480000e-02, 2.37401704e-06, 0.00000000e00], + [7.28150000e-02, 2.37401704e-06, 0.00000000e00], + [7.64560000e-02, 2.37401704e-06, 0.00000000e00], + [8.02790000e-02, 2.37401704e-06, 0.00000000e00], + [8.42920000e-02, 2.37401704e-06, 0.00000000e00], + [8.85070000e-02, 2.37401704e-06, 0.00000000e00], + [9.29320000e-02, 2.37401704e-06, 0.00000000e00], + [9.75790000e-02, 2.37401704e-06, 0.00000000e00], + [1.02460000e-01, 2.37401704e-06, 0.00000000e00], + [1.07580000e-01, 2.37401704e-06, 0.00000000e00], + [1.12960000e-01, 2.37401704e-06, 0.00000000e00], + [1.18610000e-01, 2.37401704e-06, 0.00000000e00], + [1.24540000e-01, 2.37401704e-06, 0.00000000e00], + [1.30770000e-01, 2.37401704e-06, 0.00000000e00], + [1.37300000e-01, 2.37401704e-06, 0.00000000e00], + [1.44170000e-01, 2.37401704e-06, 0.00000000e00], + [1.51380000e-01, 2.37401704e-06, 0.00000000e00], + [1.58950000e-01, 2.37401704e-06, 0.00000000e00], + [1.66890000e-01, 2.37401704e-06, 0.00000000e00], + [1.75240000e-01, 2.37401704e-06, 0.00000000e00], + [1.84000000e-01, 2.37401704e-06, 0.00000000e00], + [1.93200000e-01, 2.37401704e-06, 0.00000000e00], + [2.02860000e-01, 2.37401704e-06, 0.00000000e00], + [2.13000000e-01, 2.37401704e-06, 0.00000000e00], + [2.23650000e-01, 2.37401704e-06, 0.00000000e00], + [2.34840000e-01, 2.37401704e-06, 0.00000000e00], + [2.46580000e-01, 2.37401704e-06, 0.00000000e00], + [2.58910000e-01, 2.37401704e-06, 0.00000000e00], + [2.71850000e-01, 2.37401704e-06, 0.00000000e00], + [2.85440000e-01, 2.37401704e-06, 0.00000000e00], + [2.99720000e-01, 2.37401704e-06, 0.00000000e00], + [3.14700000e-01, 2.37401704e-06, 0.00000000e00], + [3.30440000e-01, 2.37401704e-06, 0.00000000e00], + [3.46960000e-01, 2.37401704e-06, 0.00000000e00], + [3.64310000e-01, 2.37401704e-06, 0.00000000e00], + [3.82520000e-01, 2.37401704e-06, 0.00000000e00], + [4.01650000e-01, 2.37401704e-06, 0.00000000e00], + [4.21730000e-01, 2.37401704e-06, 0.00000000e00], + [4.42820000e-01, 2.37401704e-06, 0.00000000e00], + [4.64960000e-01, 2.37401704e-06, 0.00000000e00], + [4.88210000e-01, 2.37401704e-06, 0.00000000e00], + [5.12620000e-01, 2.37401704e-06, 0.00000000e00], + [5.38250000e-01, 2.37401704e-06, 0.00000000e00], + [5.65160000e-01, 2.37401704e-06, 0.00000000e00], + [5.93420000e-01, 2.37401704e-06, 0.00000000e00], + ] + ), + np.array( + [ + [1.14030000e-02, 2.19553929e-06, 0.00000000e00], + [1.19730000e-02, 2.19553929e-06, 0.00000000e00], + [1.25720000e-02, 2.19553929e-06, 0.00000000e00], + [1.32010000e-02, 2.19553929e-06, 0.00000000e00], + [1.38610000e-02, 2.19553929e-06, 0.00000000e00], + [1.45540000e-02, 2.19553929e-06, 0.00000000e00], + [1.52810000e-02, 2.19553929e-06, 0.00000000e00], + [1.60450000e-02, 2.19553929e-06, 0.00000000e00], + [1.68480000e-02, 2.19553929e-06, 0.00000000e00], + [1.76900000e-02, 2.19553929e-06, 0.00000000e00], + [1.85750000e-02, 2.19553929e-06, 0.00000000e00], + [1.95030000e-02, 2.19553929e-06, 0.00000000e00], + [2.04790000e-02, 2.19553929e-06, 0.00000000e00], + [2.15020000e-02, 2.19553929e-06, 0.00000000e00], + [2.25780000e-02, 2.19553929e-06, 0.00000000e00], + [2.37060000e-02, 2.19553929e-06, 0.00000000e00], + [2.48920000e-02, 2.19553929e-06, 0.00000000e00], + [2.61360000e-02, 2.19553929e-06, 0.00000000e00], + [2.74430000e-02, 2.19553929e-06, 0.00000000e00], + [2.88150000e-02, 2.19553929e-06, 0.00000000e00], + [3.02560000e-02, 2.19553929e-06, 0.00000000e00], + [3.17690000e-02, 2.19553929e-06, 0.00000000e00], + [3.33570000e-02, 2.19553929e-06, 0.00000000e00], + [3.50250000e-02, 2.19553929e-06, 0.00000000e00], + [3.67770000e-02, 2.19553929e-06, 0.00000000e00], + [3.86150000e-02, 2.19553929e-06, 0.00000000e00], + [4.05460000e-02, 2.19553929e-06, 0.00000000e00], + [4.25730000e-02, 2.19553929e-06, 0.00000000e00], + [4.47020000e-02, 2.19553929e-06, 0.00000000e00], + [4.69370000e-02, 2.19553929e-06, 0.00000000e00], + [4.92840000e-02, 2.19553929e-06, 0.00000000e00], + [5.17480000e-02, 2.19553929e-06, 0.00000000e00], + [5.43360000e-02, 2.19553929e-06, 0.00000000e00], + [5.70520000e-02, 2.19553929e-06, 0.00000000e00], + [5.99050000e-02, 2.19553929e-06, 0.00000000e00], + [6.29000000e-02, 2.19553929e-06, 0.00000000e00], + [6.60450000e-02, 2.19553929e-06, 0.00000000e00], + [6.93480000e-02, 2.19553929e-06, 0.00000000e00], + [7.28150000e-02, 2.19553929e-06, 0.00000000e00], + [7.64560000e-02, 2.19553929e-06, 0.00000000e00], + [8.02790000e-02, 2.19553929e-06, 0.00000000e00], + [8.42920000e-02, 2.19553929e-06, 0.00000000e00], + [8.85070000e-02, 2.19553929e-06, 0.00000000e00], + [9.29320000e-02, 2.19553929e-06, 0.00000000e00], + [9.75790000e-02, 2.19553929e-06, 0.00000000e00], + [1.02460000e-01, 2.19553929e-06, 0.00000000e00], + [1.07580000e-01, 2.19553929e-06, 0.00000000e00], + [1.12960000e-01, 2.19553929e-06, 0.00000000e00], + [1.18610000e-01, 2.19553929e-06, 0.00000000e00], + [1.24540000e-01, 2.19553929e-06, 0.00000000e00], + [1.30770000e-01, 2.19553929e-06, 0.00000000e00], + [1.37300000e-01, 2.19553929e-06, 0.00000000e00], + [1.44170000e-01, 2.19553929e-06, 0.00000000e00], + [1.51380000e-01, 2.19553929e-06, 0.00000000e00], + [1.58950000e-01, 2.19553929e-06, 0.00000000e00], + [1.66890000e-01, 2.19553929e-06, 0.00000000e00], + [1.75240000e-01, 2.19553929e-06, 0.00000000e00], + [1.84000000e-01, 2.19553929e-06, 0.00000000e00], + [1.93200000e-01, 2.19553929e-06, 0.00000000e00], + [2.02860000e-01, 2.19553929e-06, 0.00000000e00], + [2.13000000e-01, 2.19553929e-06, 0.00000000e00], + [2.23650000e-01, 2.19553929e-06, 0.00000000e00], + [2.34840000e-01, 2.19553929e-06, 0.00000000e00], + [2.46580000e-01, 2.19553929e-06, 0.00000000e00], + [2.58910000e-01, 2.19553929e-06, 0.00000000e00], + [2.71850000e-01, 2.19553929e-06, 0.00000000e00], + [2.85440000e-01, 2.19553929e-06, 0.00000000e00], + [2.99720000e-01, 2.19553929e-06, 0.00000000e00], + [3.14700000e-01, 2.19553929e-06, 0.00000000e00], + [3.30440000e-01, 2.19553929e-06, 0.00000000e00], + [3.46960000e-01, 2.19553929e-06, 0.00000000e00], + [3.64310000e-01, 2.19553929e-06, 0.00000000e00], + [3.82520000e-01, 2.19553929e-06, 0.00000000e00], + [4.01650000e-01, 2.19553929e-06, 0.00000000e00], + [4.21730000e-01, 2.19553929e-06, 0.00000000e00], + [4.42820000e-01, 2.19553929e-06, 0.00000000e00], + [4.64960000e-01, 2.19553929e-06, 0.00000000e00], + [4.88210000e-01, 2.19553929e-06, 0.00000000e00], + [5.12620000e-01, 2.19553929e-06, 0.00000000e00], + [5.38250000e-01, 2.19553929e-06, 0.00000000e00], + [5.65160000e-01, 2.19553929e-06, 0.00000000e00], + [5.93420000e-01, 2.19553929e-06, 0.00000000e00], + ] + ), + ] + results.resolutions = [ + np.array( + [ + [0.011403, 0.03], + [0.011973, 0.03], + [0.012572, 0.03], + [0.013201, 0.03], + [0.013861, 0.03], + [0.014554, 0.03], + [0.015281, 0.03], + [0.016045, 0.03], + [0.016848, 0.03], + [0.01769, 0.03], + [0.018575, 0.03], + [0.019503, 0.03], + [0.020479, 0.03], + [0.021502, 0.03], + [0.022578, 0.03], + [0.023706, 0.03], + [0.024892, 0.03], + [0.026136, 0.03], + [0.027443, 0.03], + [0.028815, 0.03], + [0.030256, 0.03], + [0.031769, 0.03], + [0.033357, 0.03], + [0.035025, 0.03], + [0.036777, 0.03], + [0.038615, 0.03], + [0.040546, 0.03], + [0.042573, 0.03], + [0.044702, 0.03], + [0.046937, 0.03], + [0.049284, 0.03], + [0.051748, 0.03], + [0.054336, 0.03], + [0.057052, 0.03], + [0.059905, 0.03], + [0.0629, 0.03], + [0.066045, 0.03], + [0.069348, 0.03], + [0.072815, 0.03], + [0.076456, 0.03], + [0.080279, 0.03], + [0.084292, 0.03], + [0.088507, 0.03], + [0.092932, 0.03], + [0.097579, 0.03], + [0.10246, 0.03], + [0.10758, 0.03], + [0.11296, 0.03], + [0.11861, 0.03], + [0.12454, 0.03], + [0.13077, 0.03], + [0.1373, 0.03], + [0.14417, 0.03], + [0.15138, 0.03], + [0.15895, 0.03], + [0.16689, 0.03], + [0.17524, 0.03], + [0.184, 0.03], + [0.1932, 0.03], + [0.20286, 0.03], + [0.213, 0.03], + [0.22365, 0.03], + [0.23484, 0.03], + [0.24658, 0.03], + [0.25891, 0.03], + [0.27185, 0.03], + [0.28544, 0.03], + [0.29972, 0.03], + [0.3147, 0.03], + [0.33044, 0.03], + [0.34696, 0.03], + [0.36431, 0.03], + [0.38252, 0.03], + [0.40165, 0.03], + [0.42173, 0.03], + [0.44282, 0.03], + [0.46496, 0.03], + [0.48821, 0.03], + [0.51262, 0.03], + [0.53825, 0.03], + [0.56516, 0.03], + [0.59342, 0.03], + ] + ), + np.array( + [ + [0.011403, 0.03], + [0.011973, 0.03], + [0.012572, 0.03], + [0.013201, 0.03], + [0.013861, 0.03], + [0.014554, 0.03], + [0.015281, 0.03], + [0.016045, 0.03], + [0.016848, 0.03], + [0.01769, 0.03], + [0.018575, 0.03], + [0.019503, 0.03], + [0.020479, 0.03], + [0.021502, 0.03], + [0.022578, 0.03], + [0.023706, 0.03], + [0.024892, 0.03], + [0.026136, 0.03], + [0.027443, 0.03], + [0.028815, 0.03], + [0.030256, 0.03], + [0.031769, 0.03], + [0.033357, 0.03], + [0.035025, 0.03], + [0.036777, 0.03], + [0.038615, 0.03], + [0.040546, 0.03], + [0.042573, 0.03], + [0.044702, 0.03], + [0.046937, 0.03], + [0.049284, 0.03], + [0.051748, 0.03], + [0.054336, 0.03], + [0.057052, 0.03], + [0.059905, 0.03], + [0.0629, 0.03], + [0.066045, 0.03], + [0.069348, 0.03], + [0.072815, 0.03], + [0.076456, 0.03], + [0.080279, 0.03], + [0.084292, 0.03], + [0.088507, 0.03], + [0.092932, 0.03], + [0.097579, 0.03], + [0.10246, 0.03], + [0.10758, 0.03], + [0.11296, 0.03], + [0.11861, 0.03], + [0.12454, 0.03], + [0.13077, 0.03], + [0.1373, 0.03], + [0.14417, 0.03], + [0.15138, 0.03], + [0.15895, 0.03], + [0.16689, 0.03], + [0.17524, 0.03], + [0.184, 0.03], + [0.1932, 0.03], + [0.20286, 0.03], + [0.213, 0.03], + [0.22365, 0.03], + [0.23484, 0.03], + [0.24658, 0.03], + [0.25891, 0.03], + [0.27185, 0.03], + [0.28544, 0.03], + [0.29972, 0.03], + [0.3147, 0.03], + [0.33044, 0.03], + [0.34696, 0.03], + [0.36431, 0.03], + [0.38252, 0.03], + [0.40165, 0.03], + [0.42173, 0.03], + [0.44282, 0.03], + [0.46496, 0.03], + [0.48821, 0.03], + [0.51262, 0.03], + [0.53825, 0.03], + [0.56516, 0.03], + [0.59342, 0.03], + ] + ), + ] results.layerSlds = [ [ np.array( @@ -3526,174 +4231,348 @@ def dream_results(): backgrounds=[ np.array( [ - [1.14030000e-02, 2.26745452e-06, 0.00000000e00], - [1.19730000e-02, 2.26745452e-06, 0.00000000e00], - [1.25720000e-02, 2.26745452e-06, 0.00000000e00], - [1.32010000e-02, 2.26745452e-06, 0.00000000e00], - [1.38610000e-02, 2.26745452e-06, 0.00000000e00], - [1.45540000e-02, 2.26745452e-06, 0.00000000e00], - [1.52810000e-02, 2.26745452e-06, 0.00000000e00], - [1.60450000e-02, 2.26745452e-06, 0.00000000e00], - [1.68480000e-02, 2.26745452e-06, 0.00000000e00], - [1.76900000e-02, 2.26745452e-06, 0.00000000e00], - [1.85750000e-02, 2.26745452e-06, 0.00000000e00], - [1.95030000e-02, 2.26745452e-06, 0.00000000e00], - [2.04790000e-02, 2.26745452e-06, 0.00000000e00], - [2.15020000e-02, 2.26745452e-06, 0.00000000e00], - [2.25780000e-02, 2.26745452e-06, 0.00000000e00], - [2.37060000e-02, 2.26745452e-06, 0.00000000e00], - [2.48920000e-02, 2.26745452e-06, 0.00000000e00], - [2.61360000e-02, 2.26745452e-06, 0.00000000e00], - [2.74430000e-02, 2.26745452e-06, 0.00000000e00], - [2.88150000e-02, 2.26745452e-06, 0.00000000e00], - [3.02560000e-02, 2.26745452e-06, 0.00000000e00], - [3.17690000e-02, 2.26745452e-06, 0.00000000e00], - [3.33570000e-02, 2.26745452e-06, 0.00000000e00], - [3.50250000e-02, 2.26745452e-06, 0.00000000e00], - [3.67770000e-02, 2.26745452e-06, 0.00000000e00], - [3.86150000e-02, 2.26745452e-06, 0.00000000e00], - [4.05460000e-02, 2.26745452e-06, 0.00000000e00], - [4.25730000e-02, 2.26745452e-06, 0.00000000e00], - [4.47020000e-02, 2.26745452e-06, 0.00000000e00], - [4.69370000e-02, 2.26745452e-06, 0.00000000e00], - [4.92840000e-02, 2.26745452e-06, 0.00000000e00], - [5.17480000e-02, 2.26745452e-06, 0.00000000e00], - [5.43360000e-02, 2.26745452e-06, 0.00000000e00], - [5.70520000e-02, 2.26745452e-06, 0.00000000e00], - [5.99050000e-02, 2.26745452e-06, 0.00000000e00], - [6.29000000e-02, 2.26745452e-06, 0.00000000e00], - [6.60450000e-02, 2.26745452e-06, 0.00000000e00], - [6.93480000e-02, 2.26745452e-06, 0.00000000e00], - [7.28150000e-02, 2.26745452e-06, 0.00000000e00], - [7.64560000e-02, 2.26745452e-06, 0.00000000e00], - [8.02790000e-02, 2.26745452e-06, 0.00000000e00], - [8.42920000e-02, 2.26745452e-06, 0.00000000e00], - [8.85070000e-02, 2.26745452e-06, 0.00000000e00], - [9.29320000e-02, 2.26745452e-06, 0.00000000e00], - [9.75790000e-02, 2.26745452e-06, 0.00000000e00], - [1.02460000e-01, 2.26745452e-06, 0.00000000e00], - [1.07580000e-01, 2.26745452e-06, 0.00000000e00], - [1.12960000e-01, 2.26745452e-06, 0.00000000e00], - [1.18610000e-01, 2.26745452e-06, 0.00000000e00], - [1.24540000e-01, 2.26745452e-06, 0.00000000e00], - [1.30770000e-01, 2.26745452e-06, 0.00000000e00], - [1.37300000e-01, 2.26745452e-06, 0.00000000e00], - [1.44170000e-01, 2.26745452e-06, 0.00000000e00], - [1.51380000e-01, 2.26745452e-06, 0.00000000e00], - [1.58950000e-01, 2.26745452e-06, 0.00000000e00], - [1.66890000e-01, 2.26745452e-06, 0.00000000e00], - [1.75240000e-01, 2.26745452e-06, 0.00000000e00], - [1.84000000e-01, 2.26745452e-06, 0.00000000e00], - [1.93200000e-01, 2.26745452e-06, 0.00000000e00], - [2.02860000e-01, 2.26745452e-06, 0.00000000e00], - [2.13000000e-01, 2.26745452e-06, 0.00000000e00], - [2.23650000e-01, 2.26745452e-06, 0.00000000e00], - [2.34840000e-01, 2.26745452e-06, 0.00000000e00], - [2.46580000e-01, 2.26745452e-06, 0.00000000e00], - [2.58910000e-01, 2.26745452e-06, 0.00000000e00], - [2.71850000e-01, 2.26745452e-06, 0.00000000e00], - [2.85440000e-01, 2.26745452e-06, 0.00000000e00], - [2.99720000e-01, 2.26745452e-06, 0.00000000e00], - [3.14700000e-01, 2.26745452e-06, 0.00000000e00], - [3.30440000e-01, 2.26745452e-06, 0.00000000e00], - [3.46960000e-01, 2.26745452e-06, 0.00000000e00], - [3.64310000e-01, 2.26745452e-06, 0.00000000e00], - [3.82520000e-01, 2.26745452e-06, 0.00000000e00], - [4.01650000e-01, 2.26745452e-06, 0.00000000e00], - [4.21730000e-01, 2.26745452e-06, 0.00000000e00], - [4.42820000e-01, 2.26745452e-06, 0.00000000e00], - [4.64960000e-01, 2.26745452e-06, 0.00000000e00], - [4.88210000e-01, 2.26745452e-06, 0.00000000e00], - [5.12620000e-01, 2.26745452e-06, 0.00000000e00], - [5.38250000e-01, 2.26745452e-06, 0.00000000e00], - [5.65160000e-01, 2.26745452e-06, 0.00000000e00], - [5.93420000e-01, 2.26745452e-06, 0.00000000e00], + [1.14030000e-02, 2.37401704e-06, 0.00000000e00], + [1.19730000e-02, 2.37401704e-06, 0.00000000e00], + [1.25720000e-02, 2.37401704e-06, 0.00000000e00], + [1.32010000e-02, 2.37401704e-06, 0.00000000e00], + [1.38610000e-02, 2.37401704e-06, 0.00000000e00], + [1.45540000e-02, 2.37401704e-06, 0.00000000e00], + [1.52810000e-02, 2.37401704e-06, 0.00000000e00], + [1.60450000e-02, 2.37401704e-06, 0.00000000e00], + [1.68480000e-02, 2.37401704e-06, 0.00000000e00], + [1.76900000e-02, 2.37401704e-06, 0.00000000e00], + [1.85750000e-02, 2.37401704e-06, 0.00000000e00], + [1.95030000e-02, 2.37401704e-06, 0.00000000e00], + [2.04790000e-02, 2.37401704e-06, 0.00000000e00], + [2.15020000e-02, 2.37401704e-06, 0.00000000e00], + [2.25780000e-02, 2.37401704e-06, 0.00000000e00], + [2.37060000e-02, 2.37401704e-06, 0.00000000e00], + [2.48920000e-02, 2.37401704e-06, 0.00000000e00], + [2.61360000e-02, 2.37401704e-06, 0.00000000e00], + [2.74430000e-02, 2.37401704e-06, 0.00000000e00], + [2.88150000e-02, 2.37401704e-06, 0.00000000e00], + [3.02560000e-02, 2.37401704e-06, 0.00000000e00], + [3.17690000e-02, 2.37401704e-06, 0.00000000e00], + [3.33570000e-02, 2.37401704e-06, 0.00000000e00], + [3.50250000e-02, 2.37401704e-06, 0.00000000e00], + [3.67770000e-02, 2.37401704e-06, 0.00000000e00], + [3.86150000e-02, 2.37401704e-06, 0.00000000e00], + [4.05460000e-02, 2.37401704e-06, 0.00000000e00], + [4.25730000e-02, 2.37401704e-06, 0.00000000e00], + [4.47020000e-02, 2.37401704e-06, 0.00000000e00], + [4.69370000e-02, 2.37401704e-06, 0.00000000e00], + [4.92840000e-02, 2.37401704e-06, 0.00000000e00], + [5.17480000e-02, 2.37401704e-06, 0.00000000e00], + [5.43360000e-02, 2.37401704e-06, 0.00000000e00], + [5.70520000e-02, 2.37401704e-06, 0.00000000e00], + [5.99050000e-02, 2.37401704e-06, 0.00000000e00], + [6.29000000e-02, 2.37401704e-06, 0.00000000e00], + [6.60450000e-02, 2.37401704e-06, 0.00000000e00], + [6.93480000e-02, 2.37401704e-06, 0.00000000e00], + [7.28150000e-02, 2.37401704e-06, 0.00000000e00], + [7.64560000e-02, 2.37401704e-06, 0.00000000e00], + [8.02790000e-02, 2.37401704e-06, 0.00000000e00], + [8.42920000e-02, 2.37401704e-06, 0.00000000e00], + [8.85070000e-02, 2.37401704e-06, 0.00000000e00], + [9.29320000e-02, 2.37401704e-06, 0.00000000e00], + [9.75790000e-02, 2.37401704e-06, 0.00000000e00], + [1.02460000e-01, 2.37401704e-06, 0.00000000e00], + [1.07580000e-01, 2.37401704e-06, 0.00000000e00], + [1.12960000e-01, 2.37401704e-06, 0.00000000e00], + [1.18610000e-01, 2.37401704e-06, 0.00000000e00], + [1.24540000e-01, 2.37401704e-06, 0.00000000e00], + [1.30770000e-01, 2.37401704e-06, 0.00000000e00], + [1.37300000e-01, 2.37401704e-06, 0.00000000e00], + [1.44170000e-01, 2.37401704e-06, 0.00000000e00], + [1.51380000e-01, 2.37401704e-06, 0.00000000e00], + [1.58950000e-01, 2.37401704e-06, 0.00000000e00], + [1.66890000e-01, 2.37401704e-06, 0.00000000e00], + [1.75240000e-01, 2.37401704e-06, 0.00000000e00], + [1.84000000e-01, 2.37401704e-06, 0.00000000e00], + [1.93200000e-01, 2.37401704e-06, 0.00000000e00], + [2.02860000e-01, 2.37401704e-06, 0.00000000e00], + [2.13000000e-01, 2.37401704e-06, 0.00000000e00], + [2.23650000e-01, 2.37401704e-06, 0.00000000e00], + [2.34840000e-01, 2.37401704e-06, 0.00000000e00], + [2.46580000e-01, 2.37401704e-06, 0.00000000e00], + [2.58910000e-01, 2.37401704e-06, 0.00000000e00], + [2.71850000e-01, 2.37401704e-06, 0.00000000e00], + [2.85440000e-01, 2.37401704e-06, 0.00000000e00], + [2.99720000e-01, 2.37401704e-06, 0.00000000e00], + [3.14700000e-01, 2.37401704e-06, 0.00000000e00], + [3.30440000e-01, 2.37401704e-06, 0.00000000e00], + [3.46960000e-01, 2.37401704e-06, 0.00000000e00], + [3.64310000e-01, 2.37401704e-06, 0.00000000e00], + [3.82520000e-01, 2.37401704e-06, 0.00000000e00], + [4.01650000e-01, 2.37401704e-06, 0.00000000e00], + [4.21730000e-01, 2.37401704e-06, 0.00000000e00], + [4.42820000e-01, 2.37401704e-06, 0.00000000e00], + [4.64960000e-01, 2.37401704e-06, 0.00000000e00], + [4.88210000e-01, 2.37401704e-06, 0.00000000e00], + [5.12620000e-01, 2.37401704e-06, 0.00000000e00], + [5.38250000e-01, 2.37401704e-06, 0.00000000e00], + [5.65160000e-01, 2.37401704e-06, 0.00000000e00], + [5.93420000e-01, 2.37401704e-06, 0.00000000e00], + ] + ), + np.array( + [ + [1.14030000e-02, 2.19553929e-06, 0.00000000e00], + [1.19730000e-02, 2.19553929e-06, 0.00000000e00], + [1.25720000e-02, 2.19553929e-06, 0.00000000e00], + [1.32010000e-02, 2.19553929e-06, 0.00000000e00], + [1.38610000e-02, 2.19553929e-06, 0.00000000e00], + [1.45540000e-02, 2.19553929e-06, 0.00000000e00], + [1.52810000e-02, 2.19553929e-06, 0.00000000e00], + [1.60450000e-02, 2.19553929e-06, 0.00000000e00], + [1.68480000e-02, 2.19553929e-06, 0.00000000e00], + [1.76900000e-02, 2.19553929e-06, 0.00000000e00], + [1.85750000e-02, 2.19553929e-06, 0.00000000e00], + [1.95030000e-02, 2.19553929e-06, 0.00000000e00], + [2.04790000e-02, 2.19553929e-06, 0.00000000e00], + [2.15020000e-02, 2.19553929e-06, 0.00000000e00], + [2.25780000e-02, 2.19553929e-06, 0.00000000e00], + [2.37060000e-02, 2.19553929e-06, 0.00000000e00], + [2.48920000e-02, 2.19553929e-06, 0.00000000e00], + [2.61360000e-02, 2.19553929e-06, 0.00000000e00], + [2.74430000e-02, 2.19553929e-06, 0.00000000e00], + [2.88150000e-02, 2.19553929e-06, 0.00000000e00], + [3.02560000e-02, 2.19553929e-06, 0.00000000e00], + [3.17690000e-02, 2.19553929e-06, 0.00000000e00], + [3.33570000e-02, 2.19553929e-06, 0.00000000e00], + [3.50250000e-02, 2.19553929e-06, 0.00000000e00], + [3.67770000e-02, 2.19553929e-06, 0.00000000e00], + [3.86150000e-02, 2.19553929e-06, 0.00000000e00], + [4.05460000e-02, 2.19553929e-06, 0.00000000e00], + [4.25730000e-02, 2.19553929e-06, 0.00000000e00], + [4.47020000e-02, 2.19553929e-06, 0.00000000e00], + [4.69370000e-02, 2.19553929e-06, 0.00000000e00], + [4.92840000e-02, 2.19553929e-06, 0.00000000e00], + [5.17480000e-02, 2.19553929e-06, 0.00000000e00], + [5.43360000e-02, 2.19553929e-06, 0.00000000e00], + [5.70520000e-02, 2.19553929e-06, 0.00000000e00], + [5.99050000e-02, 2.19553929e-06, 0.00000000e00], + [6.29000000e-02, 2.19553929e-06, 0.00000000e00], + [6.60450000e-02, 2.19553929e-06, 0.00000000e00], + [6.93480000e-02, 2.19553929e-06, 0.00000000e00], + [7.28150000e-02, 2.19553929e-06, 0.00000000e00], + [7.64560000e-02, 2.19553929e-06, 0.00000000e00], + [8.02790000e-02, 2.19553929e-06, 0.00000000e00], + [8.42920000e-02, 2.19553929e-06, 0.00000000e00], + [8.85070000e-02, 2.19553929e-06, 0.00000000e00], + [9.29320000e-02, 2.19553929e-06, 0.00000000e00], + [9.75790000e-02, 2.19553929e-06, 0.00000000e00], + [1.02460000e-01, 2.19553929e-06, 0.00000000e00], + [1.07580000e-01, 2.19553929e-06, 0.00000000e00], + [1.12960000e-01, 2.19553929e-06, 0.00000000e00], + [1.18610000e-01, 2.19553929e-06, 0.00000000e00], + [1.24540000e-01, 2.19553929e-06, 0.00000000e00], + [1.30770000e-01, 2.19553929e-06, 0.00000000e00], + [1.37300000e-01, 2.19553929e-06, 0.00000000e00], + [1.44170000e-01, 2.19553929e-06, 0.00000000e00], + [1.51380000e-01, 2.19553929e-06, 0.00000000e00], + [1.58950000e-01, 2.19553929e-06, 0.00000000e00], + [1.66890000e-01, 2.19553929e-06, 0.00000000e00], + [1.75240000e-01, 2.19553929e-06, 0.00000000e00], + [1.84000000e-01, 2.19553929e-06, 0.00000000e00], + [1.93200000e-01, 2.19553929e-06, 0.00000000e00], + [2.02860000e-01, 2.19553929e-06, 0.00000000e00], + [2.13000000e-01, 2.19553929e-06, 0.00000000e00], + [2.23650000e-01, 2.19553929e-06, 0.00000000e00], + [2.34840000e-01, 2.19553929e-06, 0.00000000e00], + [2.46580000e-01, 2.19553929e-06, 0.00000000e00], + [2.58910000e-01, 2.19553929e-06, 0.00000000e00], + [2.71850000e-01, 2.19553929e-06, 0.00000000e00], + [2.85440000e-01, 2.19553929e-06, 0.00000000e00], + [2.99720000e-01, 2.19553929e-06, 0.00000000e00], + [3.14700000e-01, 2.19553929e-06, 0.00000000e00], + [3.30440000e-01, 2.19553929e-06, 0.00000000e00], + [3.46960000e-01, 2.19553929e-06, 0.00000000e00], + [3.64310000e-01, 2.19553929e-06, 0.00000000e00], + [3.82520000e-01, 2.19553929e-06, 0.00000000e00], + [4.01650000e-01, 2.19553929e-06, 0.00000000e00], + [4.21730000e-01, 2.19553929e-06, 0.00000000e00], + [4.42820000e-01, 2.19553929e-06, 0.00000000e00], + [4.64960000e-01, 2.19553929e-06, 0.00000000e00], + [4.88210000e-01, 2.19553929e-06, 0.00000000e00], + [5.12620000e-01, 2.19553929e-06, 0.00000000e00], + [5.38250000e-01, 2.19553929e-06, 0.00000000e00], + [5.65160000e-01, 2.19553929e-06, 0.00000000e00], + [5.93420000e-01, 2.19553929e-06, 0.00000000e00], + ] + ), + ], + resolutions=[ + np.array( + [ + [0.011403, 0.03], + [0.011973, 0.03], + [0.012572, 0.03], + [0.013201, 0.03], + [0.013861, 0.03], + [0.014554, 0.03], + [0.015281, 0.03], + [0.016045, 0.03], + [0.016848, 0.03], + [0.01769, 0.03], + [0.018575, 0.03], + [0.019503, 0.03], + [0.020479, 0.03], + [0.021502, 0.03], + [0.022578, 0.03], + [0.023706, 0.03], + [0.024892, 0.03], + [0.026136, 0.03], + [0.027443, 0.03], + [0.028815, 0.03], + [0.030256, 0.03], + [0.031769, 0.03], + [0.033357, 0.03], + [0.035025, 0.03], + [0.036777, 0.03], + [0.038615, 0.03], + [0.040546, 0.03], + [0.042573, 0.03], + [0.044702, 0.03], + [0.046937, 0.03], + [0.049284, 0.03], + [0.051748, 0.03], + [0.054336, 0.03], + [0.057052, 0.03], + [0.059905, 0.03], + [0.0629, 0.03], + [0.066045, 0.03], + [0.069348, 0.03], + [0.072815, 0.03], + [0.076456, 0.03], + [0.080279, 0.03], + [0.084292, 0.03], + [0.088507, 0.03], + [0.092932, 0.03], + [0.097579, 0.03], + [0.10246, 0.03], + [0.10758, 0.03], + [0.11296, 0.03], + [0.11861, 0.03], + [0.12454, 0.03], + [0.13077, 0.03], + [0.1373, 0.03], + [0.14417, 0.03], + [0.15138, 0.03], + [0.15895, 0.03], + [0.16689, 0.03], + [0.17524, 0.03], + [0.184, 0.03], + [0.1932, 0.03], + [0.20286, 0.03], + [0.213, 0.03], + [0.22365, 0.03], + [0.23484, 0.03], + [0.24658, 0.03], + [0.25891, 0.03], + [0.27185, 0.03], + [0.28544, 0.03], + [0.29972, 0.03], + [0.3147, 0.03], + [0.33044, 0.03], + [0.34696, 0.03], + [0.36431, 0.03], + [0.38252, 0.03], + [0.40165, 0.03], + [0.42173, 0.03], + [0.44282, 0.03], + [0.46496, 0.03], + [0.48821, 0.03], + [0.51262, 0.03], + [0.53825, 0.03], + [0.56516, 0.03], + [0.59342, 0.03], ] ), np.array( [ - [1.1403000e-02, 2.0963874e-06, 0.0000000e00], - [1.1973000e-02, 2.0963874e-06, 0.0000000e00], - [1.2572000e-02, 2.0963874e-06, 0.0000000e00], - [1.3201000e-02, 2.0963874e-06, 0.0000000e00], - [1.3861000e-02, 2.0963874e-06, 0.0000000e00], - [1.4554000e-02, 2.0963874e-06, 0.0000000e00], - [1.5281000e-02, 2.0963874e-06, 0.0000000e00], - [1.6045000e-02, 2.0963874e-06, 0.0000000e00], - [1.6848000e-02, 2.0963874e-06, 0.0000000e00], - [1.7690000e-02, 2.0963874e-06, 0.0000000e00], - [1.8575000e-02, 2.0963874e-06, 0.0000000e00], - [1.9503000e-02, 2.0963874e-06, 0.0000000e00], - [2.0479000e-02, 2.0963874e-06, 0.0000000e00], - [2.1502000e-02, 2.0963874e-06, 0.0000000e00], - [2.2578000e-02, 2.0963874e-06, 0.0000000e00], - [2.3706000e-02, 2.0963874e-06, 0.0000000e00], - [2.4892000e-02, 2.0963874e-06, 0.0000000e00], - [2.6136000e-02, 2.0963874e-06, 0.0000000e00], - [2.7443000e-02, 2.0963874e-06, 0.0000000e00], - [2.8815000e-02, 2.0963874e-06, 0.0000000e00], - [3.0256000e-02, 2.0963874e-06, 0.0000000e00], - [3.1769000e-02, 2.0963874e-06, 0.0000000e00], - [3.3357000e-02, 2.0963874e-06, 0.0000000e00], - [3.5025000e-02, 2.0963874e-06, 0.0000000e00], - [3.6777000e-02, 2.0963874e-06, 0.0000000e00], - [3.8615000e-02, 2.0963874e-06, 0.0000000e00], - [4.0546000e-02, 2.0963874e-06, 0.0000000e00], - [4.2573000e-02, 2.0963874e-06, 0.0000000e00], - [4.4702000e-02, 2.0963874e-06, 0.0000000e00], - [4.6937000e-02, 2.0963874e-06, 0.0000000e00], - [4.9284000e-02, 2.0963874e-06, 0.0000000e00], - [5.1748000e-02, 2.0963874e-06, 0.0000000e00], - [5.4336000e-02, 2.0963874e-06, 0.0000000e00], - [5.7052000e-02, 2.0963874e-06, 0.0000000e00], - [5.9905000e-02, 2.0963874e-06, 0.0000000e00], - [6.2900000e-02, 2.0963874e-06, 0.0000000e00], - [6.6045000e-02, 2.0963874e-06, 0.0000000e00], - [6.9348000e-02, 2.0963874e-06, 0.0000000e00], - [7.2815000e-02, 2.0963874e-06, 0.0000000e00], - [7.6456000e-02, 2.0963874e-06, 0.0000000e00], - [8.0279000e-02, 2.0963874e-06, 0.0000000e00], - [8.4292000e-02, 2.0963874e-06, 0.0000000e00], - [8.8507000e-02, 2.0963874e-06, 0.0000000e00], - [9.2932000e-02, 2.0963874e-06, 0.0000000e00], - [9.7579000e-02, 2.0963874e-06, 0.0000000e00], - [1.0246000e-01, 2.0963874e-06, 0.0000000e00], - [1.0758000e-01, 2.0963874e-06, 0.0000000e00], - [1.1296000e-01, 2.0963874e-06, 0.0000000e00], - [1.1861000e-01, 2.0963874e-06, 0.0000000e00], - [1.2454000e-01, 2.0963874e-06, 0.0000000e00], - [1.3077000e-01, 2.0963874e-06, 0.0000000e00], - [1.3730000e-01, 2.0963874e-06, 0.0000000e00], - [1.4417000e-01, 2.0963874e-06, 0.0000000e00], - [1.5138000e-01, 2.0963874e-06, 0.0000000e00], - [1.5895000e-01, 2.0963874e-06, 0.0000000e00], - [1.6689000e-01, 2.0963874e-06, 0.0000000e00], - [1.7524000e-01, 2.0963874e-06, 0.0000000e00], - [1.8400000e-01, 2.0963874e-06, 0.0000000e00], - [1.9320000e-01, 2.0963874e-06, 0.0000000e00], - [2.0286000e-01, 2.0963874e-06, 0.0000000e00], - [2.1300000e-01, 2.0963874e-06, 0.0000000e00], - [2.2365000e-01, 2.0963874e-06, 0.0000000e00], - [2.3484000e-01, 2.0963874e-06, 0.0000000e00], - [2.4658000e-01, 2.0963874e-06, 0.0000000e00], - [2.5891000e-01, 2.0963874e-06, 0.0000000e00], - [2.7185000e-01, 2.0963874e-06, 0.0000000e00], - [2.8544000e-01, 2.0963874e-06, 0.0000000e00], - [2.9972000e-01, 2.0963874e-06, 0.0000000e00], - [3.1470000e-01, 2.0963874e-06, 0.0000000e00], - [3.3044000e-01, 2.0963874e-06, 0.0000000e00], - [3.4696000e-01, 2.0963874e-06, 0.0000000e00], - [3.6431000e-01, 2.0963874e-06, 0.0000000e00], - [3.8252000e-01, 2.0963874e-06, 0.0000000e00], - [4.0165000e-01, 2.0963874e-06, 0.0000000e00], - [4.2173000e-01, 2.0963874e-06, 0.0000000e00], - [4.4282000e-01, 2.0963874e-06, 0.0000000e00], - [4.6496000e-01, 2.0963874e-06, 0.0000000e00], - [4.8821000e-01, 2.0963874e-06, 0.0000000e00], - [5.1262000e-01, 2.0963874e-06, 0.0000000e00], - [5.3825000e-01, 2.0963874e-06, 0.0000000e00], - [5.6516000e-01, 2.0963874e-06, 0.0000000e00], - [5.9342000e-01, 2.0963874e-06, 0.0000000e00], + [0.011403, 0.03], + [0.011973, 0.03], + [0.012572, 0.03], + [0.013201, 0.03], + [0.013861, 0.03], + [0.014554, 0.03], + [0.015281, 0.03], + [0.016045, 0.03], + [0.016848, 0.03], + [0.01769, 0.03], + [0.018575, 0.03], + [0.019503, 0.03], + [0.020479, 0.03], + [0.021502, 0.03], + [0.022578, 0.03], + [0.023706, 0.03], + [0.024892, 0.03], + [0.026136, 0.03], + [0.027443, 0.03], + [0.028815, 0.03], + [0.030256, 0.03], + [0.031769, 0.03], + [0.033357, 0.03], + [0.035025, 0.03], + [0.036777, 0.03], + [0.038615, 0.03], + [0.040546, 0.03], + [0.042573, 0.03], + [0.044702, 0.03], + [0.046937, 0.03], + [0.049284, 0.03], + [0.051748, 0.03], + [0.054336, 0.03], + [0.057052, 0.03], + [0.059905, 0.03], + [0.0629, 0.03], + [0.066045, 0.03], + [0.069348, 0.03], + [0.072815, 0.03], + [0.076456, 0.03], + [0.080279, 0.03], + [0.084292, 0.03], + [0.088507, 0.03], + [0.092932, 0.03], + [0.097579, 0.03], + [0.10246, 0.03], + [0.10758, 0.03], + [0.11296, 0.03], + [0.11861, 0.03], + [0.12454, 0.03], + [0.13077, 0.03], + [0.1373, 0.03], + [0.14417, 0.03], + [0.15138, 0.03], + [0.15895, 0.03], + [0.16689, 0.03], + [0.17524, 0.03], + [0.184, 0.03], + [0.1932, 0.03], + [0.20286, 0.03], + [0.213, 0.03], + [0.22365, 0.03], + [0.23484, 0.03], + [0.24658, 0.03], + [0.25891, 0.03], + [0.27185, 0.03], + [0.28544, 0.03], + [0.29972, 0.03], + [0.3147, 0.03], + [0.33044, 0.03], + [0.34696, 0.03], + [0.36431, 0.03], + [0.38252, 0.03], + [0.40165, 0.03], + [0.42173, 0.03], + [0.44282, 0.03], + [0.46496, 0.03], + [0.48821, 0.03], + [0.51262, 0.03], + [0.53825, 0.03], + [0.56516, 0.03], + [0.59342, 0.03], ] ), ], diff --git a/tests/test_convert.py b/tests/test_convert.py index 6e80d81d..bb157c2f 100644 --- a/tests/test_convert.py +++ b/tests/test_convert.py @@ -102,7 +102,7 @@ def mock_load(ignored_filename, **ignored_settings): def test_invalid_constraints(): """Test that invalid constraints are fixed where necessary.""" with pytest.warns( - match="The parameter Background parameter 1 has invalid constraints," + match=r"The parameter (.+) has invalid constraints," " these have been adjusted to satisfy the current value of the parameter." ): output_project = r1_to_project_class(pathlib.Path(TEST_DIR_PATH, "R1DoubleBilayerVolumeModel.mat")) @@ -119,9 +119,9 @@ def test_invalid_constraints(): "r1_orso_polymer", "r1_motofit_bench_mark", "dspc_bilayer", - # "dspc_standard_layers", - # "dspc_custom_layers", - # "dspc_custom_xy", + "dspc_standard_layers", + "dspc_custom_layers", + "dspc_custom_xy", "domains_standard_layers", "domains_custom_layers", "domains_custom_xy", diff --git a/tests/test_events.py b/tests/test_events.py index 551b9d42..7baa3e32 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -23,9 +23,7 @@ def test_event_register() -> None: RATapi.events.register(RATapi.events.EventTypes.Message, second_callback) # the list is not guaranteed to be in the same order as inputted hence the set - assert set(RATapi.events.get_event_callback(RATapi.events.EventTypes.Message)) == set( - [first_callback, second_callback] - ) + assert set(RATapi.events.get_event_callback(RATapi.events.EventTypes.Message)) == {first_callback, second_callback} RATapi.events.clear(RATapi.events.EventTypes.Message, second_callback) result = RATapi.events.get_event_callback(RATapi.events.EventTypes.Message) diff --git a/tests/test_examples.py b/tests/test_examples.py index cb5425b5..de2a4e5a 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1,6 +1,7 @@ """Test the RAT examples.""" import importlib +from pathlib import Path import pytest @@ -31,13 +32,25 @@ def test_rat_examples(example_name): "example_name", [ "DSPC_function_background", - # FIXME: https://github.com/RascalSoftware/python-RAT/issues/102 - # "convert_rascal", ], ) @pytest.mark.skipif(importlib.util.find_spec("matlab") is None, reason="Matlab not installed") -def test_matlab_examples(example_name): +def test_function_background(example_name): """Test examples which rely on MATLAB engine being installed.""" p, r = getattr(examples, example_name)() assert p is not None assert r is not None + + +@pytest.mark.parametrize( + "example_name", + [ + "convert_rascal", + ], +) +@pytest.mark.skipif(importlib.util.find_spec("matlab") is None, reason="Matlab not installed") +def test_matlab_examples(example_name, temp_dir): + """Test convert_rascal example, directing the output to a temporary directory.""" + p, r = examples.convert_rascal(Path(temp_dir, "lipid_bilayer.mat")) + assert p is not None + assert r is not None diff --git a/tests/test_inputs.py b/tests/test_inputs.py index f77919ac..32fc4835 100644 --- a/tests/test_inputs.py +++ b/tests/test_inputs.py @@ -9,7 +9,7 @@ import RATapi import RATapi.wrappers from RATapi.inputs import FileHandles, check_indices, make_controls, make_input, make_problem -from RATapi.rat_core import Checks, Control, Limits, Priors, ProblemDefinition +from RATapi.rat_core import Checks, Control, Limits, NameStore, Priors, ProblemDefinition from RATapi.utils.enums import ( BackgroundActions, BoundHandling, @@ -112,7 +112,40 @@ def custom_xy_project(): @pytest.fixture -def standard_layers_problem(): +def test_names(): + """The expected NameStore object from "standard_layers_project", "domains_project" and "custom_xy_project".""" + names = NameStore() + names.params = ["Substrate Roughness", "Test Thickness", "Test SLD", "Test Roughness"] + names.backgroundParams = ["Background Param 1"] + names.scalefactors = ["Scalefactor 1"] + names.qzshifts = [] + names.bulkIns = ["SLD Air"] + names.bulkOuts = ["SLD D2O"] + names.resolutionParams = ["Resolution Param 1"] + names.domainRatios = [] + names.contrasts = ["Test Contrast"] + + return names + + +@pytest.fixture +def test_checks(): + """The expected checks object from "standard_layers_project", "domains_project" and "custom_xy_project".""" + checks = Checks() + checks.params = np.array([1, 0, 0, 0]) + checks.backgroundParams = np.array([0]) + checks.scalefactors = np.array([0]) + checks.qzshifts = np.array([]) + checks.bulkIns = np.array([0]) + checks.bulkOuts = np.array([0]) + checks.resolutionParams = np.array([0]) + checks.domainRatios = np.array([]) + + return checks + + +@pytest.fixture +def standard_layers_problem(test_names, test_checks): """The expected problem object from "standard_layers_project".""" problem = ProblemDefinition() problem.TF = Calculations.Normal @@ -140,10 +173,17 @@ def standard_layers_problem(): problem.contrastDomainRatios = [0] problem.resample = [False] problem.dataPresent = [1] + problem.data = [np.array([[1.0, 1.0, 1.0, 0.0, 0.0, 0.0]])] + problem.dataLimits = [[1.0, 1.0]] + problem.simulationLimits = [[1.0, 1.0]] problem.oilChiDataPresent = [0] problem.numberOfContrasts = 1 problem.numberOfLayers = 1 + problem.repeatLayers = [[0, 1]] + problem.layersDetails = [[2, 3, 4, float("NaN"), 2]] + problem.contrastLayers = [[1]] problem.numberOfDomainContrasts = 0 + problem.domainContrastLayers = [] problem.fitParams = [3.0] problem.otherParams = [0.0, 0.0, 0.0, 1e-06, 0.23, 0.0, 6.35e-06, 0.03] problem.fitLimits = [[1.0, 5.0]] @@ -158,13 +198,15 @@ def standard_layers_problem(): [0.01, 0.05], ] problem.customFiles = FileHandles([]) + problem.names = test_names + problem.checks = test_checks return problem @pytest.fixture -def domains_problem(): - """The expected problem object from "standard_layers_project".""" +def domains_problem(test_names, test_checks): + """The expected problem object from "domains_project".""" problem = ProblemDefinition() problem.TF = Calculations.Domains problem.modelType = LayerModels.StandardLayers @@ -191,10 +233,17 @@ def domains_problem(): problem.contrastDomainRatios = [1] problem.resample = [False] problem.dataPresent = [1] + problem.data = [np.array([[1.0, 1.0, 1.0, 0.0, 0.0, 0.0]])] + problem.dataLimits = [[1.0, 1.0]] + problem.simulationLimits = [[1.0, 1.0]] problem.oilChiDataPresent = [0] problem.numberOfContrasts = 1 problem.numberOfLayers = 1 + problem.repeatLayers = [[0, 1]] + problem.layersDetails = [[2, 3, 4, float("NaN"), 2]] + problem.contrastLayers = [[2, 1]] problem.numberOfDomainContrasts = 2 + problem.domainContrastLayers = [[1], [1]] problem.fitParams = [3.0] problem.otherParams = [0.0, 0.0, 0.0, 1e-06, 0.23, 0.0, 6.35e-06, 0.03, 0.5] problem.fitLimits = [[1.0, 5.0]] @@ -210,12 +259,15 @@ def domains_problem(): [0.4, 0.6], ] problem.customFiles = FileHandles([]) + problem.names = test_names + problem.names.domainRatios = ["Domain Ratio 1"] + problem.checks = test_checks return problem @pytest.fixture -def custom_xy_problem(): +def custom_xy_problem(test_names, test_checks): """The expected problem object from "custom_xy_project".""" problem = ProblemDefinition() problem.TF = Calculations.Normal @@ -243,10 +295,17 @@ def custom_xy_problem(): problem.contrastDomainRatios = [0] problem.resample = [False] problem.dataPresent = [0] + problem.data = [np.empty([0, 6])] + problem.dataLimits = [[0.0, 0.0]] + problem.simulationLimits = [[0.005, 0.7]] problem.oilChiDataPresent = [0] + problem.repeatLayers = [[0, 1]] + problem.layersDetails = [] + problem.contrastLayers = [[]] problem.numberOfContrasts = 1 problem.numberOfLayers = 0 problem.numberOfDomainContrasts = 0 + problem.domainContrastLayers = [] problem.fitParams = [3.0] problem.otherParams = [0.0, 0.0, 0.0, 1e-06, 0.23, 0.0, 6.35e-06, 0.03] problem.fitLimits = [[1.0, 5.0]] @@ -263,6 +322,8 @@ def custom_xy_problem(): problem.customFiles = FileHandles( [RATapi.models.CustomFile(name="Test Custom File", filename="cpp_test.dll", language="cpp")] ) + problem.names = test_names + problem.checks = test_checks return problem @@ -273,8 +334,8 @@ def normal_limits(): limits = Limits() limits.params = [[1.0, 5.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]] limits.backgroundParams = [[1e-7, 1e-5]] - limits.qzshifts = [] limits.scalefactors = [[0.02, 0.25]] + limits.qzshifts = [] limits.bulkIns = [[0.0, 0.0]] limits.bulkOuts = [[6.2e-6, 6.35e-6]] limits.resolutionParams = [[0.01, 0.05]] @@ -289,8 +350,8 @@ def domains_limits(): limits = Limits() limits.params = [[1.0, 5.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]] limits.backgroundParams = [[1e-7, 1e-5]] - limits.qzshifts = [] limits.scalefactors = [[0.02, 0.25]] + limits.qzshifts = [] limits.bulkIns = [[0.0, 0.0]] limits.bulkOuts = [[6.2e-6, 6.35e-6]] limits.resolutionParams = [[0.01, 0.05]] @@ -310,8 +371,8 @@ def normal_priors(): ["Test Roughness", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf], ] priors.backgroundParams = [["Background Param 1", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] - priors.qzshifts = [] priors.scalefactors = [["Scalefactor 1", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] + priors.qzshifts = [] priors.bulkIns = [["SLD Air", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] priors.bulkOuts = [["SLD D2O", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] priors.resolutionParams = [["Resolution Param 1", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] @@ -353,8 +414,8 @@ def domains_priors(): ["Test Roughness", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf], ] priors.backgroundParams = [["Background Param 1", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] - priors.qzshifts = [] priors.scalefactors = [["Scalefactor 1", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] + priors.qzshifts = [] priors.bulkIns = [["SLD Air", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] priors.bulkOuts = [["SLD D2O", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] priors.resolutionParams = [["Resolution Param 1", RATapi.utils.enums.Priors.Uniform, 0.0, np.inf]] @@ -463,22 +524,6 @@ def custom_xy_controls(): return controls -@pytest.fixture -def test_checks(): - """The expected checks object from "standard_layers_project", "domains_project" and "custom_xy_project".""" - checks = Checks() - checks.params = [1, 0, 0, 0] - checks.backgroundParams = [0] - checks.qzshifts = [] - checks.scalefactors = [0] - checks.bulkIns = [0] - checks.bulkOuts = [0] - checks.resolutionParams = [0] - checks.domainRatios = [] - - return checks - - @pytest.mark.parametrize( ["test_project", "test_problem", "test_limits", "test_priors", "test_controls"], [ @@ -725,19 +770,49 @@ def check_problem_equal(actual_problem, expected_problem) -> None: "contrastDomainRatios", "resample", "dataPresent", + "dataLimits", + "simulationLimits", "oilChiDataPresent", + "repeatLayers", + "contrastLayers", + "domainContrastLayers", "fitParams", "otherParams", "fitLimits", "otherLimits", ] + checks_fields = [ + "params", + "backgroundParams", + "scalefactors", + "qzshifts", + "bulkIns", + "bulkOuts", + "resolutionParams", + "domainRatios", + ] + names_fields = [*checks_fields, "contrasts"] for scalar_field in scalar_fields: assert getattr(actual_problem, scalar_field) == getattr(expected_problem, scalar_field) for array_field in array_fields: assert np.all(getattr(actual_problem, array_field) == getattr(expected_problem, array_field)) + for field in names_fields: + assert getattr(actual_problem.names, field) == getattr(expected_problem.names, field) + for field in checks_fields: + assert (getattr(actual_problem.checks, field) == getattr(expected_problem.checks, field)).all() + + # Data field is a numpy array + assert [ + actual_data == expected_data for (actual_data, expected_data) in zip(actual_problem.data, expected_problem.data) + ] + + # Need to account for "NaN" entries in layersDetails and contrastCustomFiles field + for actual_layer, expected_layer in zip(actual_problem.layersDetails, expected_problem.layersDetails): + assert (actual_layer == expected_layer) or ["NaN" if np.isnan(el) else el for el in actual_layer] == [ + "NaN" if np.isnan(el) else el for el in expected_layer + ] - # Need to account for "NaN" entries in contrastCustomFiles field assert (actual_problem.contrastCustomFiles == expected_problem.contrastCustomFiles).all() or [ "NaN" if np.isnan(el) else el for el in actual_problem.contrastCustomFiles ] == ["NaN" if np.isnan(el) else el for el in expected_problem.contrastCustomFiles] diff --git a/tests/test_models.py b/tests/test_models.py index 476ebbad..aa133c79 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -335,6 +335,7 @@ def test_contrast_bad_ratio(): @pytest.mark.parametrize("model", [RATapi.models.Background, RATapi.models.Resolution]) +@pytest.mark.filterwarnings("ignore:The following values are not recognised by this*:UserWarning") def test_type_change_clear(model): """If the type of a background or resolution is changed, it should wipe the other fields and warn the user.""" diff --git a/tests/test_outputs.py b/tests/test_outputs.py index 7123981f..7d9a0afd 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -23,6 +23,7 @@ def reflectivity_calculation_str(): "simulation = [Data array: [21 x 2], Data array: [21 x 2]],\n" "shiftedData = [Data array: [21 x 3], Data array: [21 x 3]],\n" "backgrounds = [Data array: [82 x 3], Data array: [82 x 3]],\n" + "resolutions = [Data array: [82 x 2], Data array: [82 x 2]],\n" "layerSlds = [[Data array: [8 x 3]], [Data array: [8 x 3]]],\n" "sldProfiles = [[Data array: [25 x 2], Data array: [25 x 2]]],\n" "resampledLayers = [[Data array: [1 x 3]], [Data array: [1 x 3]]],\n" @@ -57,6 +58,7 @@ def dream_str(): "simulation = [Data array: [21 x 2], Data array: [21 x 2]],\n" "shiftedData = [Data array: [21 x 3], Data array: [21 x 3]],\n" "backgrounds = [Data array: [82 x 3], Data array: [82 x 3]],\n" + "resolutions = [Data array: [82 x 2], Data array: [82 x 2]],\n" "layerSlds = [[Data array: [8 x 3]], [Data array: [8 x 3]]],\n" "sldProfiles = [[Data array: [29 x 2], Data array: [29 x 2]]],\n" "resampledLayers = [[Data array: [1 x 3]], [Data array: [1 x 3]]],\n" diff --git a/tests/test_project.py b/tests/test_project.py index 6ec58075..19ef7aa1 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -1,8 +1,6 @@ """Test the project module.""" import copy -import shutil -import tempfile from pathlib import Path from typing import Callable @@ -136,13 +134,6 @@ def default_project_str(): ) -@pytest.fixture -def temp_dir(): - path = tempfile.mkdtemp() - yield path - shutil.rmtree(path) - - def test_classlists(test_project) -> None: """The ClassLists in the "Project" model should contain instances of the models given by the dictionary "model_in_classlist". @@ -630,7 +621,7 @@ def test_check_protected_parameters(delete_operation) -> None: ("background_parameters", ["source"]), ("resolution_parameters", ["source"]), ("parameters", ["roughness"]), - ("data", ["data", "source", "source"]), + ("data", ["data", "source"]), ("custom_files", ["source", "source"]), ("backgrounds", ["background"]), ("bulk_in", ["bulk_in"]), @@ -645,7 +636,6 @@ def test_rename_models(test_project, model: str, fields: list[str]) -> None: """ if model == "data": test_project.backgrounds[0] = RATapi.models.Background(type="data", source="Simulation") - test_project.resolutions[0] = RATapi.models.Resolution(type="data", source="Simulation") if model == "custom_files": test_project.backgrounds[0] = RATapi.models.Background(type="function", source="Test Custom File") # workaround until function resolutions are added @@ -753,7 +743,6 @@ def test_allowed_absorption_layers(field: str) -> None: "resolution_type, expected_field", [ [TypeOptions.Constant, "resolution_parameters"], - [TypeOptions.Data, "data"], # uncomment when function resolutions are added! # [TypeOptions.Function, "custom_files"], ], @@ -1168,6 +1157,7 @@ def test_write_script_wrong_extension(test_project, extension: str) -> None: ("contrasts", "", "resolution"), ], ) +@pytest.mark.filterwarnings("ignore:The following values are not recognised by this*:UserWarning") def test_wrap_set(test_project, class_list: str, model_type: str, field: str) -> None: """If we set the field values of a model in a ClassList as undefined values, we should raise a ValidationError.""" test_attribute = getattr(test_project, class_list) @@ -1246,6 +1236,7 @@ def test_wrap_del(test_project, class_list: str, parameter: str, field: str) -> ("contrasts", "", "resolution", {}), ], ) +@pytest.mark.filterwarnings("ignore:The following values are not recognised by this*:UserWarning") def test_wrap_iadd(test_project, class_list: str, model_type: str, field: str, model_params: dict) -> None: """If we add a model containing undefined values to a ClassList, we should raise a ValidationError.""" test_attribute = getattr(test_project, class_list) @@ -1292,6 +1283,7 @@ def test_wrap_iadd(test_project, class_list: str, model_type: str, field: str, m ("contrasts", "", "resolution", {}), ], ) +@pytest.mark.filterwarnings("ignore:The following values are not recognised by this*:UserWarning") def test_wrap_append(test_project, class_list: str, model_type: str, field: str, model_params: dict) -> None: """If we append a model containing undefined values to a ClassList, we should raise a ValidationError.""" test_attribute = getattr(test_project, class_list) @@ -1339,6 +1331,7 @@ def test_wrap_append(test_project, class_list: str, model_type: str, field: str, ("contrasts", "", "resolution", {}), ], ) +@pytest.mark.filterwarnings("ignore:The following values are not recognised by this*:UserWarning") def test_wrap_insert(test_project, class_list: str, model_type: str, field: str, model_params: dict) -> None: """If we insert a model containing undefined values into a ClassList, we should raise a ValidationError.""" test_attribute = getattr(test_project, class_list) @@ -1382,6 +1375,7 @@ def test_wrap_insert(test_project, class_list: str, model_type: str, field: str, ("contrasts", "resolution"), ], ) +@pytest.mark.filterwarnings("ignore:The following values are not recognised by this*:UserWarning") def test_wrap_insert_type_error(test_project, class_list: str, field: str) -> None: """If we raise a TypeError using the wrapped insert routine, we should re-raise the error.""" test_attribute = getattr(test_project, class_list) @@ -1518,6 +1512,7 @@ def test_wrap_clear(test_project, class_list: str, parameter: str, field: str) - ("contrasts", "", "resolution", {}), ], ) +@pytest.mark.filterwarnings("ignore:The following values are not recognised by this*:UserWarning") def test_wrap_extend(test_project, class_list: str, model_type: str, field: str, model_params: dict) -> None: """If we extend a ClassList with model containing undefined values, we should raise a ValidationError.""" test_attribute = getattr(test_project, class_list) diff --git a/tests/test_run.py b/tests/test_run.py index 20a07e66..85f7b64c 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -66,16 +66,34 @@ def reflectivity_calculation_problem(): problem.contrastQzshifts = np.array([0.0, 0.0]) problem.contrastScalefactors = np.array([1.0, 2.0]) problem.contrastBackgroundParams = [[1.0], [2.0]] + problem.contrastBackgroundTypes = ["constant", "constant"] problem.contrastBackgroundActions = [1.0, 1.0] problem.contrastResolutionParams = [[1.0], [1.0]] + problem.contrastResolutionTypes = ["constant", "constant"] problem.contrastCustomFiles = np.array([np.nan, np.nan]) problem.contrastDomainRatios = np.array([0.0, 0.0]) problem.resample = np.array([0.0, 0.0]) problem.dataPresent = np.array([1.0, 1.0]) + problem.dataLimits = [[0.011403, 0.59342], [0.011403, 0.59342]] + problem.simulationLimits = [[0.011403, 0.59342], [0.011403, 0.59342]] problem.oilChiDataPresent = np.array([0.0, 0.0]) problem.numberOfContrasts = 2.0 problem.numberOfLayers = 6.0 + problem.repeatLayers = [[0.0, 1.0], [0.0, 1.0]] + problem.layersDetails = [ + np.array([2.0]), + np.array([4.0]), + np.array([10.0]), + np.array([8.0]), + np.array([13.0]), + np.array([16.0]), + ] + problem.contrastLayers = [ + np.array([[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 6.0, 5.0]]), + np.array([[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 6.0, 5.0]]), + ] problem.numberOfDomainContrasts = 0.0 + problem.domainContrastLayers = [] problem.fitParams = np.array( [ 3.000e00, @@ -150,6 +168,47 @@ def reflectivity_calculation_problem(): [1.00e-02, 5.00e-02], ], ) + problem.names.params = [ + "Substrate Roughness", + "Oxide Thickness", + "Oxide SLD", + "SAM Tails Thickness", + "SAM Tails SLD", + "SAM Tails Hydration", + "SAM Roughness", + "CW Thickness", + "CW SLD", + "SAM Heads Thickness", + "SAM Heads SLD", + "SAM Heads Hydration", + "Bilayer Heads Thickness", + "Bilayer Heads SLD", + "Bilayer Roughness", + "Bilayer Tails Thickness", + "Bilayer Tails SLD", + "Bilayer Tails Hydration", + "Bilayer Heads Hydration", + "CW Hydration", + "Oxide Hydration", + ] + problem.names.backgroundParams = ["Background parameter D2O", "Background parameter SMW"] + problem.names.scalefactors = ["Scalefactor 1", "Scalefactor 2"] + problem.names.qzshifts = [] + problem.names.bulkIns = ["Silicon"] + problem.names.bulkOuts = ["D2O", "SMW"] + problem.names.resolutionParams = ["Resolution Param 1"] + problem.names.domainRatios = [] + problem.names.contrasts = ["D2O", "SMW"] + problem.checks.params = np.array( + [1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0] + ) + problem.checks.backgroundParams = np.array([1.0, 1.0]) + problem.checks.scalefactors = np.array([0.0, 0.0]) + problem.checks.qzshifts = np.array([]) + problem.checks.bulkIns = np.array([0.0]) + problem.checks.bulkOuts = np.array([1.0, 1.0]) + problem.checks.resolutionParams = np.array([0.0]) + problem.checks.domainRatios = np.array([]) return problem @@ -203,16 +262,34 @@ def dream_problem(): problem.contrastQzshifts = np.array([0.0, 0.0]) problem.contrastScalefactors = np.array([1.0, 2.0]) problem.contrastBackgroundParams = [[1.0], [2.0]] + problem.contrastBackgroundTypes = ["constant", "constant"] problem.contrastBackgroundActions = [1.0, 1.0] problem.contrastResolutionParams = [[1.0], [1.0]] + problem.contrastResolutionTypes = ["constant", "constant"] problem.contrastCustomFiles = np.array([np.nan, np.nan]) problem.contrastDomainRatios = np.array([0.0, 0.0]) problem.resample = np.array([0.0, 0.0]) problem.dataPresent = np.array([1.0, 1.0]) + problem.dataLimits = [[0.011403, 0.59342], [0.011403, 0.59342]] + problem.simulationLimits = [[0.011403, 0.59342], [0.011403, 0.59342]] problem.oilChiDataPresent = np.array([0.0, 0.0]) problem.numberOfContrasts = 2.0 problem.numberOfLayers = 6.0 + problem.repeatLayers = [[0.0, 1.0], [0.0, 1.0]] + problem.layersDetails = [ + np.array([2.0]), + np.array([4.0]), + np.array([10.0]), + np.array([8.0]), + np.array([13.0]), + np.array([16.0]), + ] + problem.contrastLayers = [ + np.array([[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 6.0, 5.0]]), + np.array([[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 6.0, 5.0]]), + ] problem.numberOfDomainContrasts = 0.0 + problem.domainContrastLayers = [] problem.fitParams = np.array( [ 6.19503045e00, @@ -289,6 +366,47 @@ def dream_problem(): [0.00e00, 0.00e00], ], ) + problem.names.params = [ + "Substrate Roughness", + "Oxide Thickness", + "Oxide SLD", + "SAM Tails Thickness", + "SAM Tails SLD", + "SAM Tails Hydration", + "SAM Roughness", + "CW Thickness", + "CW SLD", + "SAM Heads Thickness", + "SAM Heads SLD", + "SAM Heads Hydration", + "Bilayer Heads Thickness", + "Bilayer Heads SLD", + "Bilayer Roughness", + "Bilayer Tails Thickness", + "Bilayer Tails SLD", + "Bilayer Tails Hydration", + "Bilayer Heads Hydration", + "CW Hydration", + "Oxide Hydration", + ] + problem.names.backgroundParams = ["Background parameter D2O", "Background parameter SMW"] + problem.names.scalefactors = ["Scalefactor 1", "Scalefactor 2"] + problem.names.qzshifts = [] + problem.names.bulkIns = ["Silicon"] + problem.names.bulkOuts = ["D2O", "SMW"] + problem.names.resolutionParams = ["Resolution Param 1"] + problem.names.domainRatios = [] + problem.names.contrasts = ["D2O", "SMW"] + problem.checks.params = np.array( + [1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0] + ) + problem.checks.backgroundParams = np.array([1.0, 1.0]) + problem.checks.scalefactors = np.array([0.0, 0.0]) + problem.checks.qzshifts = np.array([]) + problem.checks.bulkIns = np.array([0.0]) + problem.checks.bulkOuts = np.array([1.0, 1.0]) + problem.checks.resolutionParams = np.array([0.0]) + problem.checks.domainRatios = np.array([]) return problem diff --git a/tests/utils.py b/tests/utils.py index 8d24992a..a9411aac 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -30,7 +30,7 @@ def check_results_equal(actual_results, expected_results) -> None: We focus here on the fields common to both results objects, and also check the equality of the subclasses "CalculationResults" and "ContrastParams". """ - list_fields = ["reflectivity", "simulation", "shiftedData"] + list_fields = ["reflectivity", "simulation", "shiftedData", "backgrounds", "resolutions"] double_list_fields = ["layerSlds", "sldProfiles", "resampledLayers"] contrast_param_fields = [ "scalefactors",