Skip to content

Commit

Permalink
adapt to work with offline directories
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandratrapani committed Oct 29, 2024
1 parent 29e5abb commit a55f738
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ def session_to_nwb(
source_data = dict()
conversion_options = dict()

experiment_dir_path = data_dir_path / "Ca_EEG_Experiment" / subject_id / (subject_id + "_Sessions")
if "Offline" in session_id:
offline_day = session_id.split("Session")[0]
experiment_dir_path = data_dir_path / "Ca_EEG_Experiment" / subject_id / (subject_id + "_Offline") / offline_day
else:
experiment_dir_path = data_dir_path / "Ca_EEG_Experiment" / subject_id / (subject_id + "_Sessions") / session_id

# Add Imaging
folder_path = experiment_dir_path / session_id / date_str / time_str
folder_path = experiment_dir_path / date_str / time_str
miniscope_folder_path = get_miniscope_folder_path(folder_path)
if miniscope_folder_path is not None:
source_data.update(dict(MiniscopeImaging=dict(folder_path=miniscope_folder_path)))
Expand All @@ -79,15 +83,15 @@ def session_to_nwb(
print("No motion corrected data found at {}".format(motion_corrected_video))

# Add Behavioral Video
video_file_path = experiment_dir_path / session_id / (session_id + ".wmv")
video_file_path = experiment_dir_path / (session_id + ".wmv")
if video_file_path.is_file():
source_data.update(dict(Video=dict(file_paths=[video_file_path])))
conversion_options.update(dict(Video=dict(stub_test=stub_test)))
elif verbose:
print("No behavioral video found at {}".format(video_file_path))

# Add Freezing Analysis output
freezing_output_file_path = experiment_dir_path / session_id / (session_id + "_FreezingOutput.csv")
freezing_output_file_path = experiment_dir_path / (session_id + "_FreezingOutput.csv")
if freezing_output_file_path.is_file():
source_data.update(
dict(FreezingBehavior=dict(file_path=freezing_output_file_path, video_sampling_frequency=30.0))
Expand Down Expand Up @@ -144,7 +148,7 @@ def session_to_nwb(
# Parameters for conversion
data_dir_path = Path("D:/")
subject_id = "Ca_EEG3-4"
task = "NeutralExposure"
task = "OfflineDay1Session1"
session_id = subject_id + "_" + task
output_dir_path = Path("D:/cai_lab_conversion_nwb/")
stub_test = True
Expand Down

0 comments on commit a55f738

Please sign in to comment.