Skip to content

Commit

Permalink
add key_name argument to convert_nwb_to_movement
Browse files Browse the repository at this point in the history
  • Loading branch information
niksirbi committed Nov 29, 2024
1 parent f6246d6 commit 37bb555
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion movement/io/nwb.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,17 @@ def _convert_pose_estimation_series(

def convert_nwb_to_movement(
nwb_filepaths: str | list[str] | list[Path],
key_name: str = "PoseEstimation",
) -> xr.Dataset:
"""Convert a list of NWB files to a single ``movement`` dataset.
Parameters
----------
nwb_filepaths : str | Path | list[str] | list[Path]
List of paths to NWB files to be converted.
key_name: str, optional
Name of the PoseEstimation object in the NWB "behavior"
processing module, by default "PoseEstimation".
Returns
-------
Expand All @@ -273,7 +277,7 @@ def convert_nwb_to_movement(
for path in nwb_filepaths:
with pynwb.NWBHDF5IO(path, mode="r") as io:
nwbfile = io.read()
pose_estimation = nwbfile.processing["behavior"]["PoseEstimation"]
pose_estimation = nwbfile.processing["behavior"][key_name]
source_software = pose_estimation.fields["source_software"]
pose_estimation_series = pose_estimation.fields[
"pose_estimation_series"
Expand Down

0 comments on commit 37bb555

Please sign in to comment.