Skip to content

Commit

Permalink
Merge pull request #4 from catalystneuro/lfp
Browse files Browse the repository at this point in the history
Lfp
  • Loading branch information
pauladkisson authored Jan 15, 2025
2 parents 0cafde8 + 7944693 commit 1b2b8d3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ classifiers = [
]

dependencies = [
"neuroconv[tdt_fp,video]",
"neuroconv[tdt,tdt_fp,video]",
"nwbinspector",
"pre-commit",
"pymatreader",
Expand Down
29 changes: 22 additions & 7 deletions src/dan_lab_to_nwb/huang_2025/huang_2025_convert_session.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Primary script to run to convert an entire session for of data using the NWBConverter."""
import datetime
import shutil
from pathlib import Path
from zoneinfo import ZoneInfo

Expand All @@ -13,13 +14,15 @@
def session_to_nwb(
info_file_path: FilePath,
video_file_path: FilePath,
tdt_folder_path: DirectoryPath,
tdt_fp_folder_path: DirectoryPath,
tdt_ephys_folder_path: DirectoryPath,
output_dir_path: DirectoryPath,
stub_test: bool = False,
):
info_file_path = Path(info_file_path)
video_file_path = Path(video_file_path)
tdt_folder_path = Path(tdt_folder_path)
tdt_fp_folder_path = Path(tdt_fp_folder_path)
tdt_ephys_folder_path = Path(tdt_ephys_folder_path)
output_dir_path = Path(output_dir_path)
if stub_test:
output_dir_path = output_dir_path / "nwb_stub"
Expand All @@ -28,8 +31,12 @@ def session_to_nwb(
source_data = dict()
conversion_options = dict()

# Add TDT LFP
source_data["Recording"] = dict(folder_path=tdt_ephys_folder_path, gain=1.0, stream_id="4")
conversion_options["Recording"] = dict()

# Add Fiber Photometry
source_data["FiberPhotometry"] = dict(folder_path=tdt_folder_path)
source_data["FiberPhotometry"] = dict(folder_path=tdt_fp_folder_path)
conversion_options["FiberPhotometry"] = dict()

# Add Video
Expand Down Expand Up @@ -61,13 +68,15 @@ def session_to_nwb(
converter.run_conversion(metadata=metadata, nwbfile_path=nwbfile_path, conversion_options=conversion_options)


if __name__ == "__main__":

def main():
# Parameters for conversion
data_dir_path = Path("/Volumes/T7/CatalystNeuro/Dan/Test - TDT data")
output_dir_path = Path("/Volumes/T7/CatalystNeuro/Dan/conversion_nwb")
stub_test = False

if output_dir_path.exists():
shutil.rmtree(output_dir_path)

# Example Session
info_file_path = data_dir_path / "Lindsay_SBO_op1-E_2in1_pTra_con-241101-072001" / "M301-241108-072001" / "Info.mat"
video_file_path = (
Expand All @@ -76,11 +85,17 @@ def session_to_nwb(
/ "M301-241108-072001"
/ "Lindsay_SBO_op1-E_2in1_pTra_con-241101-072001_M301-241108-072001_Cam1.avi"
)
tdt_folder_path = data_dir_path / "Lindsay_SBO_op1-E_2in1_pTra_con-241101-072001" / "M301-241108-072001"
tdt_fp_folder_path = data_dir_path / "Lindsay_SBO_op1-E_2in1_pTra_con-241101-072001" / "M301-241108-072001"
tdt_ephys_folder_path = data_dir_path / "Lindsay_SBO_op1-E_2in1_pTra_con-241101-072001"
session_to_nwb(
info_file_path=info_file_path,
video_file_path=video_file_path,
tdt_folder_path=tdt_folder_path,
tdt_fp_folder_path=tdt_fp_folder_path,
tdt_ephys_folder_path=tdt_ephys_folder_path,
output_dir_path=output_dir_path,
stub_test=stub_test,
)


if __name__ == "__main__":
main()
8 changes: 8 additions & 0 deletions src/dan_lab_to_nwb/huang_2025/huang_2025_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
- Info.mat contains various metadata info such as session start time and date
- Most of the content in Notes.txt and StoreListing.txt appear to be replicated in Info.mat --> ignore in favor of the .mat file
- What is Box1-M301sncCalibrationData.mat?
- Reorganized folders to match expected structure from neo for TDT data.
- Where is EMG data?

## LFP
- Are the lfp channels eeg?
- Where are the electrodes?
- Need device and location metadata
- Is it filtered or raw acquisition?

## Fiber Photometry
- TODO: Add stub option
Expand Down
8 changes: 6 additions & 2 deletions src/dan_lab_to_nwb/huang_2025/huang_2025_nwbconverter.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
"""Primary NWBConverter class for this dataset."""
from dan_lab_to_nwb.huang_2025 import Huang2025BehaviorInterface
from neuroconv import NWBConverter

from neuroconv.datainterfaces import TDTFiberPhotometryInterface, VideoInterace
from neuroconv.datainterfaces import (
TDTFiberPhotometryInterface,
TdtRecordingInterface,
VideoInterface,
)


class Huang2025NWBConverter(NWBConverter):
"""Primary conversion class for my extracellular electrophysiology dataset."""

data_interface_classes = dict(
Behavior=Huang2025BehaviorInterface,
Recording=TdtRecordingInterface,
FiberPhotometry=TDTFiberPhotometryInterface,
Video=VideoInterface,
)

0 comments on commit 1b2b8d3

Please sign in to comment.