Skip to content

Commit

Permalink
Clarify text and names
Browse files Browse the repository at this point in the history
  • Loading branch information
tjwsch committed Jun 14, 2024
1 parent 703fb70 commit a26b44a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
8 changes: 4 additions & 4 deletions micro_manager/snapshot/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
11 changes: 5 additions & 6 deletions micro_manager/snapshot/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/test_hdf5_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit a26b44a

Please sign in to comment.