Skip to content

Commit

Permalink
Merge pull request #94 from catalystneuro/adjust_processing_submodules
Browse files Browse the repository at this point in the history
Adjust behavior modules
  • Loading branch information
CodyCBakerPhD authored Sep 29, 2024
2 parents 4f72ddf + 66ab4a7 commit 6978fe4
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 247 deletions.
228 changes: 0 additions & 228 deletions src/ibl_to_nwb/_scripts/convert_brainwide_map.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
one=ibl_client,
session=session_id,
camera_name=camera_name,
include_video=False,
include_pose=True,
revision=revision,
)
)
Expand Down
4 changes: 2 additions & 2 deletions src/ibl_to_nwb/datainterfaces/_lick_times.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict):
],
)

behavior_module = get_module(nwbfile=nwbfile, name="behavior", description="Processed behavioral data.")
behavior_module.add(lick_events_table)
camera_module = get_module(nwbfile=nwbfile, name="camera", description="Processed camera data.")
camera_module.add(lick_events_table)
5 changes: 3 additions & 2 deletions src/ibl_to_nwb/datainterfaces/_pose_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict) -> None:
nodes=body_parts,
)
pose_estimation_container = PoseEstimation(**pose_estimation_kwargs)
behavior_module = get_module(nwbfile=nwbfile, name="behavior", description="Processed behavioral data.")
behavior_module.add(pose_estimation_container)

camera_module = get_module(nwbfile=nwbfile, name="camera", description="Processed camera data.")
camera_module.add(pose_estimation_container)
4 changes: 2 additions & 2 deletions src/ibl_to_nwb/datainterfaces/_pupil_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ def add_to_nwbfile(self, nwbfile, metadata: dict):
# in this case I'd say LeftPupilTracking and RightPupilTracking reads better
pupil_tracking = PupilTracking(name=f"{left_or_right.capitalize()}PupilTracking", time_series=pupil_time_series)

behavior_module = get_module(nwbfile=nwbfile, name="behavior", description="Processed behavioral data.")
behavior_module.add(pupil_tracking)
camera_module = get_module(nwbfile=nwbfile, name="camera", description="Processed camera data.")
camera_module.add(pupil_tracking)
4 changes: 2 additions & 2 deletions src/ibl_to_nwb/datainterfaces/_roi_motion_energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ def add_to_nwbfile(self, nwbfile, metadata: dict):
unit="a.u.",
)

behavior_module = get_module(nwbfile=nwbfile, name="behavior", description="Processed behavioral data.")
behavior_module.add(motion_energy_series)
camera_module = get_module(nwbfile=nwbfile, name="camera", description="Processed camera data.")
camera_module.add(motion_energy_series)
2 changes: 1 addition & 1 deletion src/ibl_to_nwb/datainterfaces/_wheel_movement.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def add_to_nwbfile(self, nwbfile, metadata: dict):
unit="rad/s^2",
)

behavior_module = get_module(nwbfile=nwbfile, name="behavior", description="Processed behavioral data.")
behavior_module = get_module(nwbfile=nwbfile, name="wheel", description="Processed wheel data.")
behavior_module.add(wheel_movement_intervals)
behavior_module.add(compass_direction)
behavior_module.add(velocity_series)
Expand Down
15 changes: 7 additions & 8 deletions src/ibl_to_nwb/testing/_consistency_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def check_written_nwbfile_for_consistency(*, one: ONE, nwbfile_path: Path):


def _check_wheel_data(*, eid: str, one: ONE, nwbfile: NWBFile, revision: str = None):
processing_module = nwbfile.processing["behavior"]
processing_module = nwbfile.processing["wheel"]
wheel_position_series = processing_module.data_interfaces["CompassDirection"].spatial_series["WheelPositionSeries"]
wheel_movement_table = nwbfile.processing["behavior"].data_interfaces["WheelMovementIntervals"][:]
wheel_movement_table = processing_module.data_interfaces["WheelMovementIntervals"][:]

# wheel position
data_from_ONE = one.load_dataset(id=eid, dataset="_ibl_wheel.position", collection="alf")
Expand All @@ -44,7 +44,7 @@ def _check_wheel_data(*, eid: str, one: ONE, nwbfile: NWBFile, revision: str = N
# wheel movement intervals
data_from_ONE = one.load_dataset(id=eid, dataset="_ibl_wheelMoves.intervals", collection="alf")
data_from_NWB = wheel_movement_table[["start_time", "stop_time"]].values
assert_frame_equal(left=data_from_ONE, right=data_from_NWB)
assert_array_equal(x=data_from_ONE, y=data_from_NWB)

# peak amplitude of wheel movement
data_from_ONE = one.load_dataset(id=eid, dataset="_ibl_wheelMoves.peakAmplitude", collection="alf")
Expand All @@ -53,7 +53,7 @@ def _check_wheel_data(*, eid: str, one: ONE, nwbfile: NWBFile, revision: str = N


def _check_lick_data(*, eid: str, one: ONE, nwbfile: NWBFile):
processing_module = nwbfile.processing["behavior"]
processing_module = nwbfile.processing["camera"]
lick_times_table = processing_module.data_interfaces["LickTimes"][:]

data_from_NWB = lick_times_table["lick_time"].values
Expand All @@ -62,7 +62,7 @@ def _check_lick_data(*, eid: str, one: ONE, nwbfile: NWBFile):


def _check_roi_motion_energy_data(*, eid: str, one: ONE, nwbfile: NWBFile):
processing_module = nwbfile.processing["behavior"]
processing_module = nwbfile.processing["camera"]

camera_views = ["body", "left", "right"]
for view in camera_views:
Expand All @@ -80,7 +80,7 @@ def _check_roi_motion_energy_data(*, eid: str, one: ONE, nwbfile: NWBFile):


def _check_pose_estimation_data(*, eid: str, one: ONE, nwbfile: NWBFile, revision: str = None):
processing_module = nwbfile.processing["behavior"]
processing_module = nwbfile.processing["camera"]

camera_views = ["body", "left", "right"]
for view in camera_views:
Expand Down Expand Up @@ -142,7 +142,7 @@ def _check_trials_data(*, eid: str, one: ONE, nwbfile: NWBFile):


def _check_pupil_tracking_data(*, eid: str, one: ONE, nwbfile: NWBFile):
processing_module = nwbfile.processing["behavior"]
processing_module = nwbfile.processing["camera"]

camera_views = ["left", "right"]
for view in camera_views:
Expand All @@ -165,7 +165,6 @@ def _check_pupil_tracking_data(*, eid: str, one: ONE, nwbfile: NWBFile):


def _check_spike_sorting_data(*, eid: str, one: ONE, nwbfile: NWBFile, revision: str = None):

units_table = nwbfile.units[:]
probe_names = units_table["probe_name"].unique()

Expand Down

0 comments on commit 6978fe4

Please sign in to comment.