From ef4b29c81e59e574bfe3eafe83de49a2e4e4ca6e Mon Sep 17 00:00:00 2001 From: weiglszonja Date: Tue, 23 Jul 2024 11:15:20 +0200 Subject: [PATCH] update conversion script --- .../he_embargo_2024_convert_session.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/dombeck_lab_to_nwb/he_embargo_2024/he_embargo_2024_convert_session.py b/src/dombeck_lab_to_nwb/he_embargo_2024/he_embargo_2024_convert_session.py index 8e467d3..8628822 100644 --- a/src/dombeck_lab_to_nwb/he_embargo_2024/he_embargo_2024_convert_session.py +++ b/src/dombeck_lab_to_nwb/he_embargo_2024/he_embargo_2024_convert_session.py @@ -11,6 +11,7 @@ def session_to_nwb( abf_file_path: Union[str, Path], optogenetic_stimulation_file_path: Union[str, Path], + fiber_photometry_file_path: Union[str, Path], nwbfile_path: Union[str, Path], stub_test: bool = False, ): @@ -52,6 +53,13 @@ def session_to_nwb( ) ) + # Add fiber photometry data + source_data.update( + dict( + FiberPhotometry=dict(file_path=str(fiber_photometry_file_path), session_id=session_id), + ) + ) + converter = HeEmbargo2024NWBConverter(source_data=source_data) # Add datetime to conversion @@ -72,6 +80,13 @@ def session_to_nwb( ophys_metadata = load_dict_from_file(ophys_metadata_path) metadata = dict_deep_update(metadata, ophys_metadata) + # Update fiber photometry metadata + fiber_photometry_metadata_path = ( + Path(__file__).parent / "metadata" / "he_embargo_2024_fiber_photometry_metadata.yaml" + ) + fiber_photometry_metadata = load_dict_from_file(fiber_photometry_metadata_path) + metadata = dict_deep_update(metadata, fiber_photometry_metadata) + # Update conversion options # Retrieve the sampling frequency from the abf file sampling_frequency = converter.data_interface_objects["AxonBinaryTimeSeries"]._sampling_frequency @@ -87,6 +102,10 @@ def session_to_nwb( stub_test=stub_test, ), TTL=dict(stub_test=stub_test), + FiberPhotometry=dict( + sampling_frequency=100.0, + stub_test=stub_test, + ), ) ) @@ -107,6 +126,10 @@ def session_to_nwb( # The path to the opto file opto_file_path = "/Volumes/LaCie/CN_GCP/Dombeck/sample_data/AnT60/stimulation/processed/AnT60-new.mat" + fiber_photometry_file_path = ( + "/Volumes/LaCie/CN_GCP/Dombeck/sample_data/AnT60/stimulation/processed/AnT60_data4-new.mat" + ) + # The path to the NWB file to be created. nwbfile_path = Path("/Volumes/LaCie/CN_GCP/Dombeck/nwbfiles/AnT60-2024-01-09-0003.nwb") @@ -115,6 +138,7 @@ def session_to_nwb( session_to_nwb( abf_file_path=abf_file_path, optogenetic_stimulation_file_path=opto_file_path, + fiber_photometry_file_path=fiber_photometry_file_path, nwbfile_path=nwbfile_path, stub_test=stub_test, )