diff --git a/RAT/inputs.py b/RAT/inputs.py index a305a1a0..a44d5816 100644 --- a/RAT/inputs.py +++ b/RAT/inputs.py @@ -207,21 +207,6 @@ def make_cells(project: RAT.Project) -> Cells: data_limits.append([0.0, 0.0]) simulation_limits.append([0.0, 0.0]) - # Set wrappers for custom function files - file_list = [] - for custom_file in project.custom_files: - - if custom_file.language == Languages.Matlab: - wrapper = RAT.wrappers.MatlabWrapper(custom_file.filename) - file = wrapper.getHandle() - elif custom_file.language == Languages.Cpp: - wrapper = RAT.wrappers.DylibWrapper(custom_file.filename, pathlib.PurePath(custom_file.filename).stem) - file = wrapper.getHandle() - else: - file = custom_file.filename - - file_list.append(pathlib.PurePath(file).stem) - # Populate the set of cells cells = Cells() cells.f1 = [[0, 1]] * len(project.contrasts) # This is marked as "to do" in RAT @@ -237,7 +222,7 @@ def make_cells(project: RAT.Project) -> Cells: cells.f11 = [param.name for param in project.bulk_in] cells.f12 = [param.name for param in project.bulk_out] cells.f13 = [param.name for param in project.resolution_parameters] - cells.f14 = file_list + cells.f14 = [pathlib.Path(file.filename).stem for file in project.custom_files] cells.f15 = [param.type for param in project.backgrounds] cells.f16 = [param.type for param in project.resolutions] diff --git a/tests/test_inputs.py b/tests/test_inputs.py index 2b445fc4..8382ee79 100644 --- a/tests/test_inputs.py +++ b/tests/test_inputs.py @@ -16,7 +16,7 @@ def standard_layers_project(): """Add parameters to the default project for a non polarised calculation.""" test_project = RAT.Project(data=RAT.ClassList([RAT.models.Data(name='Simulation', data=np.array([[1.0, 1.0, 1.0]]))])) test_project.parameters.append(name='Test SLD') - test_project.custom_files.append(name='Test Custom File') + test_project.custom_files.append(name='Test Custom File', filename='matlab_test.m', language='matlab') test_project.layers.append(name='Test Layer', SLD='Test SLD') test_project.contrasts.append(name='Test Contrast', data='Simulation', background='Background 1', bulk_in='SLD Air', bulk_out='SLD D2O', scalefactor='Scalefactor 1', resolution='Resolution 1', @@ -30,7 +30,7 @@ def domains_project(): test_project = RAT.Project(calculation=RAT.utils.enums.Calculations.Domains, data=RAT.ClassList([RAT.models.Data(name='Simulation', data=np.array([[1.0, 1.0, 1.0]]))])) test_project.parameters.append(name='Test SLD') - test_project.custom_files.append(name='Test Custom File') + test_project.custom_files.append(name='Test Custom File', filename='matlab_test.m', language='matlab') test_project.layers.append(name='Test Layer', SLD='Test SLD') test_project.domain_contrasts.append(name='up', model=['Test Layer']) test_project.domain_contrasts.append(name='down', model=['Test Layer']) @@ -45,7 +45,7 @@ def custom_xy_project(): """Add parameters to the default project for a non polarised calculation and use the custom xy model.""" test_project = RAT.Project(model=RAT.utils.enums.Models.CustomXY) test_project.parameters.append(name='Test SLD') - test_project.custom_files.append(name='Test Custom File') + test_project.custom_files.append(name='Test Custom File', filename='matlab_test.m', language='matlab') test_project.contrasts.append(name='Test Contrast', data='Simulation', background='Background 1', bulk_in='SLD Air', bulk_out='SLD D2O', scalefactor='Scalefactor 1', resolution='Resolution 1', model=['Test Custom File']) @@ -189,7 +189,7 @@ def standard_layers_cells(): cells.f11 = ['SLD Air'] cells.f12 = ['SLD D2O'] cells.f13 = ['Resolution Param 1'] - cells.f14 = [''] + cells.f14 = ['matlab_test'] cells.f15 = [RAT.models.Types.Constant] cells.f16 = [RAT.models.Types.Constant] cells.f17 = [[0.0, 0.0, 0.0]] @@ -217,7 +217,7 @@ def domains_cells(): cells.f11 = ['SLD Air'] cells.f12 = ['SLD D2O'] cells.f13 = ['Resolution Param 1'] - cells.f14 = [''] + cells.f14 = ['matlab_test'] cells.f15 = [RAT.models.Types.Constant] cells.f16 = [RAT.models.Types.Constant] cells.f17 = [[0.0, 0.0, 0.0]] @@ -245,7 +245,7 @@ def custom_xy_cells(): cells.f11 = ['SLD Air'] cells.f12 = ['SLD D2O'] cells.f13 = ['Resolution Param 1'] - cells.f14 = [''] + cells.f14 = ['matlab_test'] cells.f15 = [RAT.models.Types.Constant] cells.f16 = [RAT.models.Types.Constant] cells.f17 = [[0.0, 0.0, 0.0]]