diff --git a/micro_manager/snapshot/dataset.py b/micro_manager/snapshot/dataset.py index a2463a0..b5d131a 100644 --- a/micro_manager/snapshot/dataset.py +++ b/micro_manager/snapshot/dataset.py @@ -40,7 +40,7 @@ def collect_output_files( file_list : list List of files to be combined. dataset_length : int - Number of snapshots. + Global number of snapshots. """ # Create a output file main_file = h5py.File(os.path.join(dir_name, "snapshot_data.hdf5"), "w") @@ -109,11 +109,11 @@ def write_output_to_hdf( macro_data : dict Dict of macro simulation input. micro_data : dict | None - Dict of micro simulation output. + Dict of micro simulation output. If None, only the macro data is written. idx: int Local index of the current snapshot. length : int - Number of snapshots. + Local number of snapshots. """ parameter_file = h5py.File(file_path, "a") if micro_data is None: @@ -178,7 +178,7 @@ def read_hdf(self, file_path: str, data_names: dict, start: int, end: int) -> li output.append(current_data) return output - def get_length(self, file_path: str) -> int: + def get_parameter_space_size(self, file_path: str) -> int: """ Get the length of the parameter space from the HDF5 file. diff --git a/micro_manager/snapshot/snapshot.py b/micro_manager/snapshot/snapshot.py index 2a680e8..28e4bac 100644 --- a/micro_manager/snapshot/snapshot.py +++ b/micro_manager/snapshot/snapshot.py @@ -6,9 +6,6 @@ - solve - initialize -This file is directly executable as it consists of a main() function. Upon execution, an object of the class SnapshotComputation is created using a given JSON file, -the solve method is called. - Detailed documentation: https://precice.org/tooling-micro-manager-overview.html """ @@ -153,7 +150,7 @@ def initialize(self) -> None: - Distribute the parameter data equally if the snapshot creation is executed in parallel. - Read macro parameter from parameter file. - Create output subdirectory and file paths to store output. - - Import micro simulation class. + - Import micro simulation. """ # Create subdirectory to store output files in @@ -164,7 +161,9 @@ def initialize(self) -> None: # Create object responsible for reading parameters and writing simulation output self._data_storage = ReadWriteHDF(self._logger) - self._parameter_space_size = self._data_storage.get_length(self._parameter_file) + self._parameter_space_size = self._data_storage.get_parameter_space_size( + self._parameter_file + ) # Read macro parameters from the parameter file # Decompose parameters if the snapshot creation is executed in parallel if self._is_parallel: @@ -258,7 +257,7 @@ def _solve_micro_simulation(self, micro_sims_input: dict) -> dict | None: Returns ------- micro_sims_output : dict | None - Dicts in which keys are names of data and the values are the data of the output of the micro + Dict in which keys are names of data and the values are the data of the output of the micro simulations. The return type is None if the simulation has crashed. """ try: diff --git a/tests/unit/test_hdf5_functionality.py b/tests/unit/test_hdf5_functionality.py index 01e4572..67a23bc 100644 --- a/tests/unit/test_hdf5_functionality.py +++ b/tests/unit/test_hdf5_functionality.py @@ -168,6 +168,4 @@ def test_get_parameter_space_length(self): "test_parameter.hdf5", ) data_manager = ReadWriteHDF(MagicMock()) - - data_manager.get_length(file_name) - self.assertEqual(data_manager.get_length(file_name), 1) + self.assertEqual(data_manager.get_parameter_space_size(file_name), 1)