Skip to content

Commit

Permalink
Merge pull request #110 from catalystneuro/keypoint
Browse files Browse the repository at this point in the history
Switch keypoint timestamps to rate
  • Loading branch information
CodyCBakerPhD authored Apr 25, 2024
2 parents 7540d94 + ae9e085 commit 47c681e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,20 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict) -> None:
coordinates=(0.260, 2.550, -2.40), # (AP, ML, DV)
)

keypoint_sessions = [
"keypoint-dls-dlight-9",
"keypoint-dls-dlight-10",
"keypoint-dls-dlight-11",
"keypoint-dls-dlight-12",
"keypoint-dls-dlight-13",
]
skip = (
self.source_data["tdt_path"] is None
or not Path(self.source_data["tdt_path"]).exists()
or not (Path(self.source_data["tdt_path"]).parent / "alignment_df.parquet").exists()
or (
not (Path(self.source_data["tdt_path"]).parent / "alignment_df.parquet").exists()
and self.source_data["session_id"] not in keypoint_sessions
)
)
if skip:
excitation_sources_table.add_row(peak_wavelength=470.0, source_type="LED")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict) -> None:
SAMPLING_RATE = metadata["Constants"]["VIDEO_SAMPLING_RATE"]
keypoint_dict = joblib.load(self.source_data["file_path"])
raw_keypoints = keypoint_dict["positions_median"]
timestamps = H5DataIO(np.arange(raw_keypoints.shape[0]) / SAMPLING_RATE, compression=True)

index_to_name = metadata["Keypoint"]["index_to_name"]
camera_names = ["bottom", "side1", "side2", "side3", "side4", "top"] # as confirmed by email with authors
Expand All @@ -64,7 +63,7 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict) -> None:
name=keypoint_name,
description=f"Keypoint corresponding to {keypoint_name}",
data=H5DataIO(raw_keypoints[:, keypoint_index, :], compression=True),
timestamps=timestamps,
rate=SAMPLING_RATE,
unit="mm",
reference_frame=metadata["Keypoint"]["reference_frame"],
)
Expand Down

0 comments on commit 47c681e

Please sign in to comment.