Skip to content

Commit

Permalink
update conversion script
Browse files Browse the repository at this point in the history
  • Loading branch information
weiglszonja committed Jul 23, 2024
1 parent 2bd35ba commit ef4b29c
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
):
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
),
)
)

Expand All @@ -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")

Expand All @@ -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,
)

0 comments on commit ef4b29c

Please sign in to comment.