From ae83880618896529d03ccc1ce7d6b57f553edb09 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Tue, 22 Oct 2024 11:14:40 -0600 Subject: [PATCH] use frame rate from metadata --- src/cai_lab_to_nwb/zaki_2024/imaginginterface.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cai_lab_to_nwb/zaki_2024/imaginginterface.py b/src/cai_lab_to_nwb/zaki_2024/imaginginterface.py index fdf5c24..472b8ac 100644 --- a/src/cai_lab_to_nwb/zaki_2024/imaginginterface.py +++ b/src/cai_lab_to_nwb/zaki_2024/imaginginterface.py @@ -201,7 +201,13 @@ def __init__(self, folder_path: DirectoryPath): self.session_folder = self.miniscope_folder.parent self._miniscope_config = read_miniscope_config(folder_path=self.miniscope_folder) - + + # use the frame rate of the json configuration to set the metadata + frame_rate_string = self._miniscope_config["frameRate"] + # frame_rate_string look like "30.0FPS", extract the float part + self._metadata_frame_rate = float(frame_rate_string.split("FPS")[0]) + + self.photon_series_type = "OnePhotonSeries" def _get_session_start_time(self): @@ -244,7 +250,7 @@ def get_metadata(self) -> DeepDict: imaging_plane_metadata = metadata["Ophys"]["ImagingPlane"][0] imaging_plane_metadata.update( device=device_name, - imaging_rate=self.imaging_extractor.get_sampling_frequency(), + imaging_rate=self._metadata_frame_rate, ) one_photon_series_metadata = metadata["Ophys"]["OnePhotonSeries"][0] one_photon_series_metadata.update(unit="px")