Skip to content

Commit 9f73677

Browse files
authored
Updates API and tests with recently added input and output objects (#124)
* Converts background function to python * Adds resolutions to inputs and outputs * Adds additional problem_definition fields to test data * Updates submodule * Adds names to "test_inputs.py" * Fixes pickle bug * Renames "non_polarised" to "normal_reflectivity" * Adds names and checks to "test_run.py" * Suppresses warnings in tests * Adds backgrounds and resolutions to "check_results_equal" * Addresses review comments
1 parent 265668a commit 9f73677

30 files changed

+1354
-270
lines changed

RATapi/examples/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from RATapi.examples.domains.domains_custom_layers import domains_custom_layers
44
from RATapi.examples.domains.domains_custom_XY import domains_custom_XY
55
from RATapi.examples.domains.domains_standard_layers import domains_standard_layers
6-
from RATapi.examples.non_polarised.DSPC_custom_layers import DSPC_custom_layers
7-
from RATapi.examples.non_polarised.DSPC_custom_XY import DSPC_custom_XY
8-
from RATapi.examples.non_polarised.DSPC_data_background import DSPC_data_background
9-
from RATapi.examples.non_polarised.DSPC_function_background import DSPC_function_background
10-
from RATapi.examples.non_polarised.DSPC_standard_layers import DSPC_standard_layers
6+
from RATapi.examples.normal_reflectivity.DSPC_custom_layers import DSPC_custom_layers
7+
from RATapi.examples.normal_reflectivity.DSPC_custom_XY import DSPC_custom_XY
8+
from RATapi.examples.normal_reflectivity.DSPC_data_background import DSPC_data_background
9+
from RATapi.examples.normal_reflectivity.DSPC_function_background import DSPC_function_background
10+
from RATapi.examples.normal_reflectivity.DSPC_standard_layers import DSPC_standard_layers
1111

1212
__all__ = [
1313
"absorption",

RATapi/examples/convert_rascal_project/convert_rascal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
# convert R1 project to Project class
8-
def convert_rascal():
8+
def convert_rascal(mat_filename="lipid_bilayer.mat"):
99
project_path = pathlib.Path(__file__).parent / "R1monolayerVolumeModel.mat"
1010
project = RAT.utils.convert.r1_to_project_class(project_path)
1111

@@ -16,7 +16,7 @@ def convert_rascal():
1616

1717
# convert DSPC standard layers example to a struct and save as file
1818
lipid_bilayer_project = RAT.examples.DSPC_standard_layers()[0]
19-
RAT.utils.convert.project_class_to_r1(lipid_bilayer_project, filename="lipid_bilayer.mat")
19+
RAT.utils.convert.project_class_to_r1(lipid_bilayer_project, filename=mat_filename)
2020

2121
# convert and return as a Python dictionary
2222
struct = RAT.utils.convert.project_class_to_r1(lipid_bilayer_project, return_struct=True)

RATapi/examples/non_polarised/backgroundFunction.m

Lines changed: 0 additions & 14 deletions
This file was deleted.

RATapi/examples/non_polarised/DSPC_function_background.py renamed to RATapi/examples/normal_reflectivity/DSPC_function_background.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,10 @@ def DSPC_function_background():
142142
)
143143
problem.backgrounds.append(name="SMW Background", type="constant", source="Background parameter SMW")
144144

145-
# FIXME: replace this with a Python custom file when Python backgrounds are added!
146145
problem.custom_files.append(
147146
name="D2O Background Function",
148-
filename="backgroundFunction.m",
149-
language="matlab",
147+
filename="background_function.py",
148+
language="python",
150149
path=pathlib.Path(__file__).parent.resolve(),
151150
)
152151

0 commit comments

Comments
 (0)