@@ -46,7 +46,7 @@ def _parse_channel_name(channel: str) -> tuple[str, str]:
4646 return channel_type , trace_type
4747
4848
49- def _get_channel_info (f : h5py .File , channel : str ):
49+ def _get_channel_info (h5py_file : h5py .File , channel : str ):
5050 """
5151 Retrieve channel-related HDF5 groups and dataset name.
5252
@@ -69,13 +69,13 @@ def _get_channel_info(f: h5py.File, channel: str):
6969 """
7070 _parse_channel_name (channel ) # just for validation
7171
72- channel_map = _discover_available_channels ( f )
72+ channel_map = _available_channels ( h5py_file )
7373 if channel not in channel_map :
7474 raise ValueError (f"'{ channel } ' not found. Available channels: { list (channel_map )} " )
7575
7676 channel_path = channel_map [channel ]
77- channel_group = f [channel_path ]
78- measurement_group = f [channel_path .split ("/" )[0 ]]
77+ channel_group = h5py_file [channel_path ]
78+ measurement_group = h5py_file [channel_path .split ("/" )[0 ]]
7979 dataset_name = channel .split ("_" )[0 ].capitalize ()
8080
8181 return channel_group , measurement_group , dataset_name
@@ -179,7 +179,7 @@ def _attr_to_bool(attr: bytes | str | bool | int | float) -> bool:
179179 return bool (attr )
180180
181181
182- def _discover_available_channels (f : h5py .File ) -> dict [str , str ]:
182+ def _available_channels (f : h5py .File ) -> dict [str , str ]:
183183 """
184184 Discover all available scan channels in the HDF5 file.
185185
@@ -263,8 +263,7 @@ def generate_timestamps(num_frames: int, line_rate: float, image_size: int) -> d
263263 dict
264264 A dictionary mapping frame labels (e.g., "frame 0") to timestamps in seconds.
265265 """
266- frame_interval = image_size / line_rate # seconds per frame (height lines / lines per second)
267- timestamps = np .arange (num_frames ) * frame_interval
266+ timestamps = np .arange (num_frames ) * (image_size / line_rate )
268267 # Compose a dictionary of timestamsps
269268 return {f"frame { i } " : timestamp for i , timestamp in enumerate (timestamps )}
270269
0 commit comments