From 6d52bf1347c053d33a831bfd9130b86705424fce Mon Sep 17 00:00:00 2001 From: Jeremie Gillet Date: Tue, 4 Feb 2025 16:12:18 +0100 Subject: [PATCH 1/4] pushing the required modifications --- .../optical_module/optical_adapter_base.py | 24 ++++++++++++++++--- simpa/utils/tags.py | 3 ++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/simpa/core/simulation_modules/optical_module/optical_adapter_base.py b/simpa/core/simulation_modules/optical_module/optical_adapter_base.py index bc231a98..2ec04c01 100644 --- a/simpa/core/simulation_modules/optical_module/optical_adapter_base.py +++ b/simpa/core/simulation_modules/optical_module/optical_adapter_base.py @@ -91,12 +91,30 @@ def run(self, device: Union[IlluminationGeometryBase, PhotoacousticDevice]) -> N assert_array_well_defined(fluence, assume_non_negativity=True, array_name="fluence") if Tags.LASER_PULSE_ENERGY_IN_MILLIJOULE in self.component_settings: + laser_energies = self.component_settings[Tags.LASER_PULSE_ENERGY_IN_MILLIJOULE] + + if type(laser_energies) in (list, range, tuple, np.ndarray): + + list_laser_energies = list(laser_energies) + wls = self.global_settings[Tags.WAVELENGTHS] + + if len(list_laser_energies) != len(wls): + raise ValueError("The wavelength dependant laser energies need to have compatible dimension with the wavelengths.") + else: + laser_energy = laser_energies[wls.index(wl)] + + elif type(laser_energies) in (float, int, np.integer) : + laser_energy = laser_energies + + else: + raise TypeError("The laser energies need to be specified as a constant (int, float) or a list if they are \ + considered wavelength dependant.") + units = Tags.UNITS_PRESSURE # Initial pressure should be given in units of Pascale conversion_factor = 1e6 # 1 J/cm^3 = 10^6 N/m^2 = 10^6 Pa - initial_pressure = (absorption * fluence * gruneisen_parameter * - (self.component_settings[Tags.LASER_PULSE_ENERGY_IN_MILLIJOULE] / 1000) - * conversion_factor) + initial_pressure = (absorption * fluence * gruneisen_parameter * (laser_energy / 1000) * conversion_factor) + else: units = Tags.UNITS_ARBITRARY initial_pressure = absorption * fluence diff --git a/simpa/utils/tags.py b/simpa/utils/tags.py index c8e29025..4161c6cd 100644 --- a/simpa/utils/tags.py +++ b/simpa/utils/tags.py @@ -374,7 +374,8 @@ class Tags: LASER_PULSE_ENERGY_IN_MILLIJOULE = ("laser_pulse_energy_in_millijoule", (int, np.integer, float, list, range, tuple, np.ndarray)) """ - Laser pulse energy used in the optical simulation.\n + Laser pulse energy used in the optical simulation. If it is considered wavelength dependant, should be + an iterable compatible with the size of the wavelength list. \n Usage: module optical_simulation_module """ From 58d1a9f0ad6eb00c015915fde874edd97ae7fce7 Mon Sep 17 00:00:00 2001 From: Jeremie Gillet Date: Wed, 5 Feb 2025 15:47:11 +0100 Subject: [PATCH 2/4] ready for PR #417 --- .gitignore | 3 + ...ore.simulation_modules.acoustic_module.rst | 24 +++ ...core.simulation_modules.optical_module.rst | 30 +++ docs/source/simpa_examples.rst | 25 +-- docs/source/simpa_examples/__init__.rst | 7 + .../create_a_custom_digital_device_twin.rst | 7 + .../simpa_examples/create_custom_tissues.rst | 7 + .../source/simpa_examples/linear_unmixing.rst | 7 + .../minimal_optical_simulation.rst | 7 + ...ptical_simulation_heterogeneous_tissue.rst | 7 + ...inimal_optical_simulation_uniform_cube.rst | 7 + .../msot_invision_simulation.rst | 7 + .../optical_and_acoustic_simulation.rst | 7 + .../perform_image_reconstruction.rst | 7 + .../perform_iterative_qPAI_reconstruction.rst | 7 + .../simpa_examples/segmentation_loader.rst | 7 + ..._vs_two_dimensional_simulation_example.rst | 7 + .../optical_module/optical_adapter_base.py | 25 ++- .../benchmarking/benchmarking_mean.md | 22 +++ simpa_examples/path_config.env.example | 7 - .../automatic_tests/test_laser_energy.py | 181 ++++++++++++++++++ .../PointSourceReconstruction.py | 164 ++++++++-------- 22 files changed, 458 insertions(+), 114 deletions(-) create mode 100644 docs/source/simpa.core.simulation_modules.acoustic_module.rst create mode 100644 docs/source/simpa.core.simulation_modules.optical_module.rst create mode 100644 docs/source/simpa_examples/__init__.rst create mode 100644 docs/source/simpa_examples/create_a_custom_digital_device_twin.rst create mode 100644 docs/source/simpa_examples/create_custom_tissues.rst create mode 100644 docs/source/simpa_examples/linear_unmixing.rst create mode 100644 docs/source/simpa_examples/minimal_optical_simulation.rst create mode 100644 docs/source/simpa_examples/minimal_optical_simulation_heterogeneous_tissue.rst create mode 100644 docs/source/simpa_examples/minimal_optical_simulation_uniform_cube.rst create mode 100644 docs/source/simpa_examples/msot_invision_simulation.rst create mode 100644 docs/source/simpa_examples/optical_and_acoustic_simulation.rst create mode 100644 docs/source/simpa_examples/perform_image_reconstruction.rst create mode 100644 docs/source/simpa_examples/perform_iterative_qPAI_reconstruction.rst create mode 100644 docs/source/simpa_examples/segmentation_loader.rst create mode 100644 docs/source/simpa_examples/three_vs_two_dimensional_simulation_example.rst create mode 100644 simpa_examples/benchmarking/benchmarking_mean.md delete mode 100644 simpa_examples/path_config.env.example create mode 100644 simpa_tests/automatic_tests/test_laser_energy.py diff --git a/.gitignore b/.gitignore index 79570db7..41230e26 100644 --- a/.gitignore +++ b/.gitignore @@ -157,3 +157,6 @@ dmypy.json # numpy files *npy /.mailmap + +# Data +data/ \ No newline at end of file diff --git a/docs/source/simpa.core.simulation_modules.acoustic_module.rst b/docs/source/simpa.core.simulation_modules.acoustic_module.rst new file mode 100644 index 00000000..43ede865 --- /dev/null +++ b/docs/source/simpa.core.simulation_modules.acoustic_module.rst @@ -0,0 +1,24 @@ +acoustic\_module +======================================================= + +.. automodule:: simpa.core.simulation_modules.acoustic_module + :members: + :undoc-members: + :show-inheritance: + +.. automodule:: simpa.core.simulation_modules.acoustic_module.acoustic_adapter_base + :members: + :undoc-members: + :show-inheritance: + + +.. automodule:: simpa.core.simulation_modules.acoustic_module.acoustic_test_adapter + :members: + :undoc-members: + :show-inheritance: + + +.. automodule:: simpa.core.simulation_modules.acoustic_module.k_wave_adapter + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/simpa.core.simulation_modules.optical_module.rst b/docs/source/simpa.core.simulation_modules.optical_module.rst new file mode 100644 index 00000000..749260fa --- /dev/null +++ b/docs/source/simpa.core.simulation_modules.optical_module.rst @@ -0,0 +1,30 @@ +optical\_module +====================================================== + +.. automodule:: simpa.core.simulation_modules.optical_module + :members: + :undoc-members: + :show-inheritance: + +.. automodule:: simpa.core.simulation_modules.optical_module.mcx_adapter + :members: + :undoc-members: + :show-inheritance: + + +.. automodule:: simpa.core.simulation_modules.optical_module.mcx_reflectance_adapter + :members: + :undoc-members: + :show-inheritance: + + +.. automodule:: simpa.core.simulation_modules.optical_module.optical_adapter_base + :members: + :undoc-members: + :show-inheritance: + + +.. automodule:: simpa.core.simulation_modules.optical_module.optical_test_adapter + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/simpa_examples.rst b/docs/source/simpa_examples.rst index 06c1cb14..2dd56fde 100644 --- a/docs/source/simpa_examples.rst +++ b/docs/source/simpa_examples.rst @@ -4,15 +4,16 @@ simpa\_examples .. toctree:: :maxdepth: 2 - create_a_custom_digital_device_twin - create_custom_tissues - linear_unmixing - minimal_optical_simulation - minimal_optical_simulation_heterogeneous_tissue - minimal_optical_simulation_uniform_cube - msot_invision_simulation - optical_and_acoustic_simulation - perform_image_reconstruction - perform_iterative_qPAI_reconstruction - segmentation_loader - three_vs_two_dimensional_simulation_example + simpa_examples\__init__ + simpa_examples\create_a_custom_digital_device_twin + simpa_examples\create_custom_tissues + simpa_examples\linear_unmixing + simpa_examples\minimal_optical_simulation + simpa_examples\minimal_optical_simulation_heterogeneous_tissue + simpa_examples\minimal_optical_simulation_uniform_cube + simpa_examples\msot_invision_simulation + simpa_examples\optical_and_acoustic_simulation + simpa_examples\perform_image_reconstruction + simpa_examples\perform_iterative_qPAI_reconstruction + simpa_examples\segmentation_loader + simpa_examples\three_vs_two_dimensional_simulation_example diff --git a/docs/source/simpa_examples/__init__.rst b/docs/source/simpa_examples/__init__.rst new file mode 100644 index 00000000..b081b270 --- /dev/null +++ b/docs/source/simpa_examples/__init__.rst @@ -0,0 +1,7 @@ +simpa_examples\__init__ +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\__init__.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/create_a_custom_digital_device_twin.rst b/docs/source/simpa_examples/create_a_custom_digital_device_twin.rst new file mode 100644 index 00000000..44f26e7f --- /dev/null +++ b/docs/source/simpa_examples/create_a_custom_digital_device_twin.rst @@ -0,0 +1,7 @@ +simpa_examples\create_a_custom_digital_device_twin +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\create_a_custom_digital_device_twin.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/create_custom_tissues.rst b/docs/source/simpa_examples/create_custom_tissues.rst new file mode 100644 index 00000000..3cd1fa99 --- /dev/null +++ b/docs/source/simpa_examples/create_custom_tissues.rst @@ -0,0 +1,7 @@ +simpa_examples\create_custom_tissues +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\create_custom_tissues.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/linear_unmixing.rst b/docs/source/simpa_examples/linear_unmixing.rst new file mode 100644 index 00000000..d17b7723 --- /dev/null +++ b/docs/source/simpa_examples/linear_unmixing.rst @@ -0,0 +1,7 @@ +simpa_examples\linear_unmixing +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\linear_unmixing.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/minimal_optical_simulation.rst b/docs/source/simpa_examples/minimal_optical_simulation.rst new file mode 100644 index 00000000..378b18d0 --- /dev/null +++ b/docs/source/simpa_examples/minimal_optical_simulation.rst @@ -0,0 +1,7 @@ +simpa_examples\minimal_optical_simulation +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\minimal_optical_simulation.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/minimal_optical_simulation_heterogeneous_tissue.rst b/docs/source/simpa_examples/minimal_optical_simulation_heterogeneous_tissue.rst new file mode 100644 index 00000000..8d037217 --- /dev/null +++ b/docs/source/simpa_examples/minimal_optical_simulation_heterogeneous_tissue.rst @@ -0,0 +1,7 @@ +simpa_examples\minimal_optical_simulation_heterogeneous_tissue +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\minimal_optical_simulation_heterogeneous_tissue.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/minimal_optical_simulation_uniform_cube.rst b/docs/source/simpa_examples/minimal_optical_simulation_uniform_cube.rst new file mode 100644 index 00000000..be05f042 --- /dev/null +++ b/docs/source/simpa_examples/minimal_optical_simulation_uniform_cube.rst @@ -0,0 +1,7 @@ +simpa_examples\minimal_optical_simulation_uniform_cube +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\minimal_optical_simulation_uniform_cube.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/msot_invision_simulation.rst b/docs/source/simpa_examples/msot_invision_simulation.rst new file mode 100644 index 00000000..72a40c69 --- /dev/null +++ b/docs/source/simpa_examples/msot_invision_simulation.rst @@ -0,0 +1,7 @@ +simpa_examples\msot_invision_simulation +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\msot_invision_simulation.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/optical_and_acoustic_simulation.rst b/docs/source/simpa_examples/optical_and_acoustic_simulation.rst new file mode 100644 index 00000000..68421270 --- /dev/null +++ b/docs/source/simpa_examples/optical_and_acoustic_simulation.rst @@ -0,0 +1,7 @@ +simpa_examples\optical_and_acoustic_simulation +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\optical_and_acoustic_simulation.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/perform_image_reconstruction.rst b/docs/source/simpa_examples/perform_image_reconstruction.rst new file mode 100644 index 00000000..7cdee15e --- /dev/null +++ b/docs/source/simpa_examples/perform_image_reconstruction.rst @@ -0,0 +1,7 @@ +simpa_examples\perform_image_reconstruction +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\perform_image_reconstruction.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/perform_iterative_qPAI_reconstruction.rst b/docs/source/simpa_examples/perform_iterative_qPAI_reconstruction.rst new file mode 100644 index 00000000..3c563b2d --- /dev/null +++ b/docs/source/simpa_examples/perform_iterative_qPAI_reconstruction.rst @@ -0,0 +1,7 @@ +simpa_examples\perform_iterative_qPAI_reconstruction +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\perform_iterative_qPAI_reconstruction.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/segmentation_loader.rst b/docs/source/simpa_examples/segmentation_loader.rst new file mode 100644 index 00000000..89bc1b67 --- /dev/null +++ b/docs/source/simpa_examples/segmentation_loader.rst @@ -0,0 +1,7 @@ +simpa_examples\segmentation_loader +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\segmentation_loader.py + :language: python + :lines: 1- + diff --git a/docs/source/simpa_examples/three_vs_two_dimensional_simulation_example.rst b/docs/source/simpa_examples/three_vs_two_dimensional_simulation_example.rst new file mode 100644 index 00000000..243e54cc --- /dev/null +++ b/docs/source/simpa_examples/three_vs_two_dimensional_simulation_example.rst @@ -0,0 +1,7 @@ +simpa_examples\three_vs_two_dimensional_simulation_example +========================================= + +.. literalinclude:: ../../simpa_examples/simpa_examples\three_vs_two_dimensional_simulation_example.py + :language: python + :lines: 1- + diff --git a/simpa/core/simulation_modules/optical_module/optical_adapter_base.py b/simpa/core/simulation_modules/optical_module/optical_adapter_base.py index 2ec04c01..0a503f9e 100644 --- a/simpa/core/simulation_modules/optical_module/optical_adapter_base.py +++ b/simpa/core/simulation_modules/optical_module/optical_adapter_base.py @@ -66,11 +66,11 @@ def run(self, device: Union[IlluminationGeometryBase, PhotoacousticDevice]) -> N self.logger.info("Simulating the optical forward process...") file_path = self.global_settings[Tags.SIMPA_OUTPUT_FILE_PATH] - wl = str(self.global_settings[Tags.WAVELENGTH]) + wl = self.global_settings[Tags.WAVELENGTH] - absorption = load_data_field(file_path, Tags.DATA_FIELD_ABSORPTION_PER_CM, wl) - scattering = load_data_field(file_path, Tags.DATA_FIELD_SCATTERING_PER_CM, wl) - anisotropy = load_data_field(file_path, Tags.DATA_FIELD_ANISOTROPY, wl) + absorption = load_data_field(file_path, Tags.DATA_FIELD_ABSORPTION_PER_CM, str(wl)) + scattering = load_data_field(file_path, Tags.DATA_FIELD_SCATTERING_PER_CM, str(wl)) + anisotropy = load_data_field(file_path, Tags.DATA_FIELD_ANISOTROPY, str(wl)) gruneisen_parameter = load_data_field(file_path, Tags.DATA_FIELD_GRUNEISEN_PARAMETER) _device = None @@ -94,26 +94,25 @@ def run(self, device: Union[IlluminationGeometryBase, PhotoacousticDevice]) -> N laser_energies = self.component_settings[Tags.LASER_PULSE_ENERGY_IN_MILLIJOULE] if type(laser_energies) in (list, range, tuple, np.ndarray): - + list_laser_energies = list(laser_energies) wls = self.global_settings[Tags.WAVELENGTHS] if len(list_laser_energies) != len(wls): - raise ValueError("The wavelength dependant laser energies need to have compatible dimension with the wavelengths.") + raise ValueError( + "The wavelength dependant laser energies need to have compatible dimension \ + with the wavelengths.") else: laser_energy = laser_energies[wls.index(wl)] - elif type(laser_energies) in (float, int, np.integer) : + elif type(laser_energies) in (float, int, np.integer): laser_energy = laser_energies - - else: - raise TypeError("The laser energies need to be specified as a constant (int, float) or a list if they are \ - considered wavelength dependant.") - + units = Tags.UNITS_PRESSURE # Initial pressure should be given in units of Pascale conversion_factor = 1e6 # 1 J/cm^3 = 10^6 N/m^2 = 10^6 Pa - initial_pressure = (absorption * fluence * gruneisen_parameter * (laser_energy / 1000) * conversion_factor) + initial_pressure = (absorption * fluence * gruneisen_parameter * (laser_energy / 1000) + * conversion_factor) else: units = Tags.UNITS_ARBITRARY diff --git a/simpa_examples/benchmarking/benchmarking_mean.md b/simpa_examples/benchmarking/benchmarking_mean.md new file mode 100644 index 00000000..8602c886 --- /dev/null +++ b/simpa_examples/benchmarking/benchmarking_mean.md @@ -0,0 +1,22 @@ +| Example | Spacing | MEMORY_mean | MEMORY_std | TIME_mean | TIME_std | +|:----------------------------------------------------------------------------------------------------------------|----------:|--------------:|-------------:|------------:|-----------:| +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\minimal_optical_simulation | 0.2 | nan | nan | 19107.2 | nan | +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\minimal_optical_simulation | 0.25 | nan | nan | 9383.2 | nan | +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\minimal_optical_simulation_uniform_cube | 0.2 | nan | nan | 12850.5 | nan | +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\minimal_optical_simulation_uniform_cube | 0.25 | nan | nan | 6496.2 | nan | +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\optical_and_acoustic_simulation | 0.2 | nan | nan | 60223.9 | nan | +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\optical_and_acoustic_simulation | 0.25 | nan | nan | 39334.8 | nan | +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\segmentation_loader | 0.2 | nan | nan | 11956.5 | nan | +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\segmentation_loader | 0.25 | nan | nan | 7739.1 | nan | +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\three_vs_two_dimensional_simulation_example | 0.2 | nan | nan | 172377 | nan | +| File: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\three_vs_two_dimensional_simulation_example | 0.25 | nan | nan | 85203.1 | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\minimal_optical_simulation | 0.2 | 419.1 | nan | nan | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\minimal_optical_simulation | 0.25 | 224.5 | nan | nan | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\minimal_optical_simulation_uniform_cube | 0.2 | -43.7 | nan | nan | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\minimal_optical_simulation_uniform_cube | 0.25 | 24.1 | nan | nan | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\optical_and_acoustic_simulation | 0.2 | 4.9 | nan | nan | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\optical_and_acoustic_simulation | 0.25 | -15.5 | nan | nan | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\segmentation_loader | 0.2 | 153.8 | nan | nan | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\segmentation_loader | 0.25 | 85 | nan | nan | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\three_vs_two_dimensional_simulation_example | 0.2 | -132.1 | nan | nan | nan | +| Filename: C:\Users\jeremie.gillet\Desktop\T417\simpa\simpa_examples\three_vs_two_dimensional_simulation_example | 0.25 | -29.8 | nan | nan | nan | \ No newline at end of file diff --git a/simpa_examples/path_config.env.example b/simpa_examples/path_config.env.example deleted file mode 100644 index 0a9e3d41..00000000 --- a/simpa_examples/path_config.env.example +++ /dev/null @@ -1,7 +0,0 @@ -# Example path_config file. Please define all required paths for your simulation here. -# Afterwards, either copy this file to your current working directory, to your home directory, -# or to the SIMPA base directory, and rename it to path_config.env - -SIMPA_SAVE_DIRECTORY=/workplace/data # Path to a directory where all data will be stored. This path is always required. -MCX_BINARY_PATH=/workplace/mcx # On Linux systems, the .exe at the end must be omitted. This path is required if you plan to run optical simulations. -MATLAB_BINARY_PATH=/path/to/matlab.exe # On Linux systems, the .exe at the end must be omitted. This path is required if you plan to run acoustic simulations. diff --git a/simpa_tests/automatic_tests/test_laser_energy.py b/simpa_tests/automatic_tests/test_laser_energy.py new file mode 100644 index 00000000..61b22c17 --- /dev/null +++ b/simpa_tests/automatic_tests/test_laser_energy.py @@ -0,0 +1,181 @@ +# SPDX-FileCopyrightText: 2021 Division of Intelligent Medical Systems, DKFZ +# SPDX-FileCopyrightText: 2021 Janek Groehl +# SPDX-License-Identifier: MIT + +from simpa import Tags, Settings, ModelBasedAdapter, PathManager +from simpa_tests.test_utils import create_test_structure_parameters +from simpa.core.simulation_modules.optical_module.optical_test_adapter import \ + OpticalTestAdapter +from simpa.core.simulation_modules.acoustic_module.acoustic_test_adapter import \ + AcousticTestAdapter +from simpa.core.simulation import simulate +from simpa.core.device_digital_twins import RSOMExplorerP50 + +import unittest +import numpy as np +import logging + + +class TestLaserEnergy(unittest.TestCase): + """ + Class of tests regarding the laser energy inputted to the model. + + Attributes : + VOLUME_WIDTH_IN_MM (int | float) : volume dimension (in mm) in the x and y direction + VOLUME_HEIGHT_IN_MM (int | float) : volume dimension (in mm) in the z direction + SPACING (int | float) : width of a voxel (in mm) + RANDOM_SEED (int) : seed of the simulation + """ + + def setUp(self): + + print("setUp") + + self.VOLUME_WIDTH_IN_MM = 4 + self.VOLUME_HEIGHT_IN_MM = 3 + self.SPACING = 0.25 + self.RANDOM_SEED = 4711 + + def test_base(self, test_name: str, laser_energies: int | np.integer | float | list | range | tuple | np.ndarray): + """ + Base for all the tests that follow : defines a simple simulation pipeline + with optical and acoustic forward simulations. + + :param test_name: name of the performed test + :type test_name: str + :param laser_energies: laser energies specified (type varies in the tests) + :type laser_energies: str + + :returns: launches a simulation + :rtype: None + """ + + # Configuring the logger : + # nothing will be displayed except if there is a problem in the simulation + logger = logging.getLogger("SIMPA Logger") + logger.setLevel(logging.WARNING) + + np.random.seed(self.RANDOM_SEED) + path_manager = PathManager() + + settings = { + Tags.RANDOM_SEED: self.RANDOM_SEED, + Tags.VOLUME_NAME: test_name + '_' + str(self.RANDOM_SEED), + Tags.SIMULATION_PATH: path_manager.get_hdf5_file_save_path(), + Tags.SPACING_MM: self.SPACING, + Tags.DIM_VOLUME_Z_MM: self.VOLUME_HEIGHT_IN_MM, + Tags.DIM_VOLUME_X_MM: self.VOLUME_WIDTH_IN_MM, + Tags.DIM_VOLUME_Y_MM: self.VOLUME_WIDTH_IN_MM, + Tags.WAVELENGTHS: [800, 850, 900], + } + settings = Settings(settings) + + settings.set_volume_creation_settings( + {Tags.STRUCTURES: create_test_structure_parameters()} + ) + + settings.set_optical_settings({ + Tags.OPTICAL_MODEL_NUMBER_PHOTONS: 1e7, + Tags.OPTICAL_MODEL: Tags.OPTICAL_MODEL_TEST, + Tags.ILLUMINATION_TYPE: Tags.ILLUMINATION_TYPE_PENCIL, + Tags.LASER_PULSE_ENERGY_IN_MILLIJOULE: laser_energies + }) + + settings.set_acoustic_settings({}) + + pipeline = [ + ModelBasedAdapter(settings), + OpticalTestAdapter(settings), + AcousticTestAdapter(settings), + ] + + simulate(pipeline, settings, RSOMExplorerP50(0.1, 1, 1)) + + def test_laser_energy_int(self): + """ + Checks if we can specify the laser energy as an int, which will be the + uniform value for every wavelength. + Passed if the simulations is launched properly. + """ + + print("Test that the laser energy can be set as an int.") + self.test_base(test_name="TestLaserEnergyInt", laser_energies=10) + print("PASSED !") + + def test_laser_energy_float(self): + """ + Checks if we can specify the laser energy as a float, which will be the + uniform value for every wavelength. + Passed if the simulations is launched properly. + """ + + print("Test that the laser energy can be set as a float.") + self.test_base(test_name="TestLaserEnergyFloat", laser_energies=10.5) + print("PASSED !") + + def test_laser_energy_list(self): + """ + Checks if we can specify the laser energy as a list of wavelength-dependant + energies. + Passed if the simulations is launched properly. + """ + + print("Test that the laser energy can be set as a list.") + self.test_base(test_name="TestLaserEnergyList", laser_energies=[10, 11, 12]) + print("PASSED !") + + def test_laser_energy_array(self): + """ + Checks if we can specify the laser energy as an array of wavelength-dependant + energies. + Passed if the simulations is launched properly. + """ + + print("Test that the laser energy can be set as an array.") + self.test_base(test_name="TestLaserEnergyArray", laser_energies=np.array([10, 11, 12])) + print("PASSED !") + + def test_laser_energy_range(self): + """ + Checks if we can specify the laser energy as a range of wavelength-dependant + energies. + Passed if the simulations is launched properly. + """ + + print("Test that the laser energy can be set as a range.") + self.test_base(test_name="TestLaserEnergyRange", laser_energies=range(10, 13)) + print("PASSED !") + + def test_laser_energy_tuple(self): + """ + Checks if we can specify the laser energy as a range of wavelength-dependant + energies. + Passed if the simulations is launched properly. + """ + + print("Test that the laser energy can be set as a range.") + self.test_base(test_name="TestLaserEnergyRange", laser_energies=(10, 11, 12)) + print("PASSED !") + + def test_laser_energy_wrong_size(self): + """ + Checks if an incorrect size for the laser energy list gives an error. + Passed if the error is raised correctly. + """ + + print("Test that specifying a laser energy list of wrong size will raise an error.") + with self.assertRaises(ValueError): + self.test_base(test_name="TestLaserEnergyWrongSize", laser_energies=[10, 11, 12, 13]) + print("PASSED !") + + +if __name__ == "__main__": + test = TestLaserEnergy() + settings = test.setUp() + test.test_laser_energy_int() + test.test_laser_energy_float() + test.test_laser_energy_list() + test.test_laser_energy_array() + test.test_laser_energy_range() + test.test_laser_energy_tuple() + test.test_laser_energy_wrong_size() diff --git a/simpa_tests/manual_tests/image_reconstruction/PointSourceReconstruction.py b/simpa_tests/manual_tests/image_reconstruction/PointSourceReconstruction.py index dc17dea2..83cc94b2 100644 --- a/simpa_tests/manual_tests/image_reconstruction/PointSourceReconstruction.py +++ b/simpa_tests/manual_tests/image_reconstruction/PointSourceReconstruction.py @@ -31,11 +31,12 @@ class PointSourceReconstruction(ReconstructionAlgorithmTestBaseClass): TODO """ + def __init__(self, speed_of_sound: float = 1470, volume_transducer_dim_in_mm: float = 90, volume_planar_dim_in_mm: float = 20, volume_height_in_mm: float = 90, spacing: float = 0.4): - - self.reconstructed_image_pipeline = None # TODO REMOVE + + self.reconstructed_image_pipeline = None # TODO REMOVE self.SPEED_OF_SOUND = speed_of_sound self.VOLUME_TRANSDUCER_DIM_IN_MM = volume_transducer_dim_in_mm @@ -76,11 +77,12 @@ def create_point_source(self): vessel_1_dictionary = Settings() vessel_1_dictionary[Tags.PRIORITY] = 3 vessel_1_dictionary[Tags.STRUCTURE_START_MM] = [self.VOLUME_TRANSDUCER_DIM_IN_MM/2-10, 0, 35] - vessel_1_dictionary[Tags.STRUCTURE_END_MM] = [self.VOLUME_TRANSDUCER_DIM_IN_MM/2-10, self.VOLUME_PLANAR_DIM_IN_MM, 35] + vessel_1_dictionary[Tags.STRUCTURE_END_MM] = [ + self.VOLUME_TRANSDUCER_DIM_IN_MM/2-10, self.VOLUME_PLANAR_DIM_IN_MM, 35] vessel_1_dictionary[Tags.STRUCTURE_RADIUS_MM] = self.SPACING vessel_1_dictionary[Tags.MOLECULE_COMPOSITION] = (MolecularCompositionGenerator(). - append(vessel_molecule). - get_molecular_composition(-1)) + append(vessel_molecule). + get_molecular_composition(-1)) vessel_1_dictionary[Tags.CONSIDER_PARTIAL_VOLUME] = True vessel_1_dictionary[Tags.STRUCTURE_TYPE] = Tags.CIRCULAR_TUBULAR_STRUCTURE @@ -95,7 +97,6 @@ def setup(self): # point to the correct file in the PathManager(). self.path_manager = PathManager() - # Seed the numpy random configuration prior to creating the global_settings file in # order to ensure that the same volume # is generated with the same random seed every time. @@ -173,58 +174,56 @@ def setup(self): self.settings = settings def simulate_and_evaluate_with_device(self, _device): - SIMULATION_PIPELINE = [ - ModelBasedAdapter(self.settings), - MCXAdapter(self.settings), - KWaveAdapter(self.settings), - FieldOfViewCropping(self.settings), - DelayAndSumAdapter(self.settings) - ] - - print("Simulating for device:", _device) - simulate(SIMULATION_PIPELINE, self.settings, _device) - - if Tags.WAVELENGTH in self.settings: - wavelength = self.settings[Tags.WAVELENGTH] - else: - wavelength = 700 - - initial_pressure = load_data_field(self.path_manager.get_hdf5_file_save_path() + "/" + self.VOLUME_NAME + ".hdf5", - data_field=Tags.DATA_FIELD_INITIAL_PRESSURE, - wavelength=wavelength) - reconstruction = load_data_field(self.path_manager.get_hdf5_file_save_path() + "/" + self.VOLUME_NAME + ".hdf5", - data_field=Tags.DATA_FIELD_RECONSTRUCTED_DATA, - wavelength=wavelength) - - p0_idx = np.unravel_index(np.argmax(initial_pressure), np.shape(initial_pressure)) - re_idx = np.unravel_index(np.argmax(reconstruction), np.shape(reconstruction)) - - print("x/y in initial pressure map:", p0_idx) - print("x/y in reconstruction map:", re_idx) - distance = np.sqrt((re_idx[0] - p0_idx[0]) ** 2 + (re_idx[1] - p0_idx[1]) ** 2) - print("Distance:", distance) - - if self.save_path is not None: - save_path = self.save_path + f"PointSourceReconstruction_{self.figure_number}.png" - else: - save_path = self.save_path - - visualise_data(path_to_hdf5_file=self.path_manager.get_hdf5_file_save_path() + "/" + self.VOLUME_NAME + ".hdf5", - wavelength=wavelength, - show_time_series_data=True, - show_absorption=False, - show_reconstructed_data=True, - show_xz_only=True, - show_initial_pressure=True, - show_segmentation_map=False, - log_scale=False, - save_path=save_path) - self.figure_number += 1 - return distance - - - def test_reconstruction_of_simulation(self): - + SIMULATION_PIPELINE = [ + ModelBasedAdapter(self.settings), + MCXAdapter(self.settings), + KWaveAdapter(self.settings), + FieldOfViewCropping(self.settings), + DelayAndSumAdapter(self.settings) + ] + + print("Simulating for device:", _device) + simulate(SIMULATION_PIPELINE, self.settings, _device) + + if Tags.WAVELENGTH in self.settings: + wavelength = self.settings[Tags.WAVELENGTH] + else: + wavelength = 700 + + initial_pressure = load_data_field(self.path_manager.get_hdf5_file_save_path() + "/" + self.VOLUME_NAME + ".hdf5", + data_field=Tags.DATA_FIELD_INITIAL_PRESSURE, + wavelength=wavelength) + reconstruction = load_data_field(self.path_manager.get_hdf5_file_save_path() + "/" + self.VOLUME_NAME + ".hdf5", + data_field=Tags.DATA_FIELD_RECONSTRUCTED_DATA, + wavelength=wavelength) + + p0_idx = np.unravel_index(np.argmax(initial_pressure), np.shape(initial_pressure)) + re_idx = np.unravel_index(np.argmax(reconstruction), np.shape(reconstruction)) + + print("x/y in initial pressure map:", p0_idx) + print("x/y in reconstruction map:", re_idx) + distance = np.sqrt((re_idx[0] - p0_idx[0]) ** 2 + (re_idx[1] - p0_idx[1]) ** 2) + print("Distance:", distance) + + if self.save_path is not None: + save_path = self.save_path + f"PointSourceReconstruction_{self.figure_number}.png" + else: + save_path = self.save_path + + visualise_data(path_to_hdf5_file=self.path_manager.get_hdf5_file_save_path() + "/" + self.VOLUME_NAME + ".hdf5", + wavelength=wavelength, + show_time_series_data=True, + show_absorption=False, + show_reconstructed_data=True, + show_xz_only=True, + show_initial_pressure=True, + show_segmentation_map=False, + log_scale=False, + save_path=save_path) + self.figure_number += 1 + return distance + + def test_reconstruction_of_simulation(self): dist = list() @@ -248,52 +247,52 @@ def test_reconstruction_of_simulation(self): # seed=1234, field_of_view_extent_mm=fov_e)) # device.add_illumination_geometry(PencilBeamIlluminationGeometry()) # dist.append(self.simulate_and_evaluate_with_device(device)) - + dist.append(self.simulate_and_evaluate_with_device(MSOTAcuityEcho(device_position_mm=np.array([self.VOLUME_TRANSDUCER_DIM_IN_MM/2, - self.VOLUME_PLANAR_DIM_IN_MM/2, - 35]), - field_of_view_extent_mm=np.array([-(2 * np.sin(0.34 / 40 * 128) * 40) / 2, - (2 * np.sin(0.34 / - 40 * 128) * 40) / 2, - 0, 0, -25, 25])))) + self.VOLUME_PLANAR_DIM_IN_MM/2, + 35]), + field_of_view_extent_mm=np.array([-(2 * np.sin(0.34 / 40 * 128) * 40) / 2, + (2 * np.sin(0.34 / + 40 * 128) * 40) / 2, + 0, 0, -25, 25])))) dist.append(self.simulate_and_evaluate_with_device(InVision256TF(device_position_mm=np.array([self.VOLUME_TRANSDUCER_DIM_IN_MM/2, - self.VOLUME_PLANAR_DIM_IN_MM/2, - self.VOLUME_HEIGHT_IN_MM/2])))) + self.VOLUME_PLANAR_DIM_IN_MM/2, + self.VOLUME_HEIGHT_IN_MM/2])))) device = PhotoacousticDevice(device_position_mm=np.array([self.VOLUME_TRANSDUCER_DIM_IN_MM/2, - self.VOLUME_PLANAR_DIM_IN_MM/2, - 30]), - field_of_view_extent_mm=np.asarray([-self.VOLUME_TRANSDUCER_DIM_IN_MM/2, + self.VOLUME_PLANAR_DIM_IN_MM/2, + 30]), + field_of_view_extent_mm=np.asarray([-self.VOLUME_TRANSDUCER_DIM_IN_MM/2, self.VOLUME_TRANSDUCER_DIM_IN_MM/2, 0, 0, 0, self.VOLUME_HEIGHT_IN_MM])) device.set_detection_geometry(LinearArrayDetectionGeometry(device_position_mm=device.device_position_mm, - pitch_mm=0.2, - number_detector_elements=256)) + pitch_mm=0.2, + number_detector_elements=256)) device.add_illumination_geometry(PencilBeamIlluminationGeometry(device_position_mm=device.device_position_mm)) dist.append(self.simulate_and_evaluate_with_device(device)) device = PhotoacousticDevice(device_position_mm=np.array([self.VOLUME_TRANSDUCER_DIM_IN_MM/2, - self.VOLUME_PLANAR_DIM_IN_MM/2, - 5]), - field_of_view_extent_mm=np.asarray([-self.VOLUME_TRANSDUCER_DIM_IN_MM / 2, + self.VOLUME_PLANAR_DIM_IN_MM/2, + 5]), + field_of_view_extent_mm=np.asarray([-self.VOLUME_TRANSDUCER_DIM_IN_MM / 2, self.VOLUME_TRANSDUCER_DIM_IN_MM / 2, 0, 0, 0, self.VOLUME_HEIGHT_IN_MM])) device.set_detection_geometry(LinearArrayDetectionGeometry(device_position_mm=device.device_position_mm, - pitch_mm=0.2, - number_detector_elements=256)) + pitch_mm=0.2, + number_detector_elements=256)) device.add_illumination_geometry(PencilBeamIlluminationGeometry()) dist.append(self.simulate_and_evaluate_with_device(device)) device = PhotoacousticDevice(device_position_mm=np.array([self.VOLUME_TRANSDUCER_DIM_IN_MM/2, - self.VOLUME_PLANAR_DIM_IN_MM/2, - 10]), - field_of_view_extent_mm=np.asarray([-self.VOLUME_TRANSDUCER_DIM_IN_MM / 2, + self.VOLUME_PLANAR_DIM_IN_MM/2, + 10]), + field_of_view_extent_mm=np.asarray([-self.VOLUME_TRANSDUCER_DIM_IN_MM / 2, self.VOLUME_TRANSDUCER_DIM_IN_MM / 2, 0, 0, 0, self.VOLUME_HEIGHT_IN_MM])) device.set_detection_geometry(LinearArrayDetectionGeometry(device_position_mm=device.device_position_mm, - pitch_mm=0.2, - number_detector_elements=256)) + pitch_mm=0.2, + number_detector_elements=256)) device.add_illumination_geometry(PencilBeamIlluminationGeometry()) dist.append(self.simulate_and_evaluate_with_device(device)) print("") @@ -319,6 +318,7 @@ def run_test(self, show_figure_on_screen=True, save_path=None): self.perform_test() self.tear_down() + if __name__ == '__main__': test = PointSourceReconstruction() test.run_test(show_figure_on_screen=True) From b30a2fa65095c10e1fac554e3d8e18d69a5d07b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20Gr=C3=B6hl?= Date: Tue, 18 Nov 2025 13:49:37 +0100 Subject: [PATCH 3/4] Re-add example path_config.env file Added an example path configuration file with required paths for simulations. --- simpa_examples/path_config.env.example | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 simpa_examples/path_config.env.example diff --git a/simpa_examples/path_config.env.example b/simpa_examples/path_config.env.example new file mode 100644 index 00000000..0a9e3d41 --- /dev/null +++ b/simpa_examples/path_config.env.example @@ -0,0 +1,7 @@ +# Example path_config file. Please define all required paths for your simulation here. +# Afterwards, either copy this file to your current working directory, to your home directory, +# or to the SIMPA base directory, and rename it to path_config.env + +SIMPA_SAVE_DIRECTORY=/workplace/data # Path to a directory where all data will be stored. This path is always required. +MCX_BINARY_PATH=/workplace/mcx # On Linux systems, the .exe at the end must be omitted. This path is required if you plan to run optical simulations. +MATLAB_BINARY_PATH=/path/to/matlab.exe # On Linux systems, the .exe at the end must be omitted. This path is required if you plan to run acoustic simulations. From 3dcee94e68d8c292c06688781c70e6fafc6711e0 Mon Sep 17 00:00:00 2001 From: Janek Groehl Date: Tue, 18 Nov 2025 14:25:17 +0100 Subject: [PATCH 4/4] Fix laser energy tests in full pipeline setting. --- .../automatic_tests/test_laser_energy.py | 45 +++++++++---------- simpa_tests/automatic_tests/test_pipeline.py | 7 +-- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/simpa_tests/automatic_tests/test_laser_energy.py b/simpa_tests/automatic_tests/test_laser_energy.py index 61b22c17..2ea65a7a 100644 --- a/simpa_tests/automatic_tests/test_laser_energy.py +++ b/simpa_tests/automatic_tests/test_laser_energy.py @@ -2,7 +2,7 @@ # SPDX-FileCopyrightText: 2021 Janek Groehl # SPDX-License-Identifier: MIT -from simpa import Tags, Settings, ModelBasedAdapter, PathManager +from simpa import Tags, Settings, ModelBasedAdapter from simpa_tests.test_utils import create_test_structure_parameters from simpa.core.simulation_modules.optical_module.optical_test_adapter import \ OpticalTestAdapter @@ -14,6 +14,7 @@ import unittest import numpy as np import logging +import os class TestLaserEnergy(unittest.TestCase): @@ -36,7 +37,7 @@ def setUp(self): self.SPACING = 0.25 self.RANDOM_SEED = 4711 - def test_base(self, test_name: str, laser_energies: int | np.integer | float | list | range | tuple | np.ndarray): + def base_test_case(self, test_name: str, laser_energies: int | np.integer | float | list | range | tuple | np.ndarray): """ Base for all the tests that follow : defines a simple simulation pipeline with optical and acoustic forward simulations. @@ -56,12 +57,11 @@ def test_base(self, test_name: str, laser_energies: int | np.integer | float | l logger.setLevel(logging.WARNING) np.random.seed(self.RANDOM_SEED) - path_manager = PathManager() settings = { Tags.RANDOM_SEED: self.RANDOM_SEED, Tags.VOLUME_NAME: test_name + '_' + str(self.RANDOM_SEED), - Tags.SIMULATION_PATH: path_manager.get_hdf5_file_save_path(), + Tags.SIMULATION_PATH: ".", Tags.SPACING_MM: self.SPACING, Tags.DIM_VOLUME_Z_MM: self.VOLUME_HEIGHT_IN_MM, Tags.DIM_VOLUME_X_MM: self.VOLUME_WIDTH_IN_MM, @@ -89,7 +89,15 @@ def test_base(self, test_name: str, laser_energies: int | np.integer | float | l AcousticTestAdapter(settings), ] - simulate(pipeline, settings, RSOMExplorerP50(0.1, 1, 1)) + try: + simulate(pipeline, settings, RSOMExplorerP50(0.1, 1, 1)) + except ValueError as e: + raise e + finally: + if (os.path.exists(settings[Tags.SIMPA_OUTPUT_FILE_PATH]) and + os.path.isfile(settings[Tags.SIMPA_OUTPUT_FILE_PATH])): + # Always delete the created file + os.remove(settings[Tags.SIMPA_OUTPUT_FILE_PATH]) def test_laser_energy_int(self): """ @@ -99,7 +107,7 @@ def test_laser_energy_int(self): """ print("Test that the laser energy can be set as an int.") - self.test_base(test_name="TestLaserEnergyInt", laser_energies=10) + self.base_test_case(test_name="TestLaserEnergyInt", laser_energies=10) print("PASSED !") def test_laser_energy_float(self): @@ -110,7 +118,7 @@ def test_laser_energy_float(self): """ print("Test that the laser energy can be set as a float.") - self.test_base(test_name="TestLaserEnergyFloat", laser_energies=10.5) + self.base_test_case(test_name="TestLaserEnergyFloat", laser_energies=10.5) print("PASSED !") def test_laser_energy_list(self): @@ -121,7 +129,7 @@ def test_laser_energy_list(self): """ print("Test that the laser energy can be set as a list.") - self.test_base(test_name="TestLaserEnergyList", laser_energies=[10, 11, 12]) + self.base_test_case(test_name="TestLaserEnergyList", laser_energies=[10, 11, 12]) print("PASSED !") def test_laser_energy_array(self): @@ -132,7 +140,7 @@ def test_laser_energy_array(self): """ print("Test that the laser energy can be set as an array.") - self.test_base(test_name="TestLaserEnergyArray", laser_energies=np.array([10, 11, 12])) + self.base_test_case(test_name="TestLaserEnergyArray", laser_energies=np.array([10, 11, 12])) print("PASSED !") def test_laser_energy_range(self): @@ -143,7 +151,7 @@ def test_laser_energy_range(self): """ print("Test that the laser energy can be set as a range.") - self.test_base(test_name="TestLaserEnergyRange", laser_energies=range(10, 13)) + self.base_test_case(test_name="TestLaserEnergyRange", laser_energies=range(10, 13)) print("PASSED !") def test_laser_energy_tuple(self): @@ -154,7 +162,7 @@ def test_laser_energy_tuple(self): """ print("Test that the laser energy can be set as a range.") - self.test_base(test_name="TestLaserEnergyRange", laser_energies=(10, 11, 12)) + self.base_test_case(test_name="TestLaserEnergyRange", laser_energies=(10, 11, 12)) print("PASSED !") def test_laser_energy_wrong_size(self): @@ -165,17 +173,6 @@ def test_laser_energy_wrong_size(self): print("Test that specifying a laser energy list of wrong size will raise an error.") with self.assertRaises(ValueError): - self.test_base(test_name="TestLaserEnergyWrongSize", laser_energies=[10, 11, 12, 13]) - print("PASSED !") - + self.base_test_case(test_name="TestLaserEnergyWrongSize", laser_energies=[10, 11, 12, 13]) -if __name__ == "__main__": - test = TestLaserEnergy() - settings = test.setUp() - test.test_laser_energy_int() - test.test_laser_energy_float() - test.test_laser_energy_list() - test.test_laser_energy_array() - test.test_laser_energy_range() - test.test_laser_energy_tuple() - test.test_laser_energy_wrong_size() + print("PASSED !") \ No newline at end of file diff --git a/simpa_tests/automatic_tests/test_pipeline.py b/simpa_tests/automatic_tests/test_pipeline.py index 0e0213c8..498c76ad 100644 --- a/simpa_tests/automatic_tests/test_pipeline.py +++ b/simpa_tests/automatic_tests/test_pipeline.py @@ -64,12 +64,7 @@ def test_pipeline(self): Tags.ILLUMINATION_TYPE: Tags.ILLUMINATION_TYPE_PENCIL, Tags.LASER_PULSE_ENERGY_IN_MILLIJOULE: 50 }) - settings.set_acoustic_settings({ - Tags.OPTICAL_MODEL_NUMBER_PHOTONS: 1e7, - Tags.OPTICAL_MODEL: Tags.OPTICAL_MODEL_TEST, - Tags.ILLUMINATION_TYPE: Tags.ILLUMINATION_TYPE_PENCIL, - Tags.LASER_PULSE_ENERGY_IN_MILLIJOULE: 50 - }) + settings.set_acoustic_settings({}) simulation_pipeline = [ ModelBasedAdapter(settings),