Skip to content

Commit a7d18bb

Browse files
committed
Try to fix recursion error in NWB
1 parent 30a2862 commit a7d18bb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/npc_sessions/sessions.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def write_nwb(
390390
) # link_data=False so that lazily-opened zarrays are read and copied into nwb (instead of being added as a link, which is currently broken)
391391
else:
392392
with pynwb.NWBHDF5IO(path.as_posix(), "w") as io:
393-
io.write(nwb)
393+
io.write(nwb, link_data=False)
394394
logger.info(
395395
f"Saved NWB file to {path}: {npc_io.get_size(path) // 1024 ** 2} MB"
396396
)
@@ -2965,7 +2965,7 @@ def _lp(self) -> tuple[pynwb.core.DynamicTable, ...]:
29652965
"""
29662966
LP_face_parts_dynamic_tables = []
29672967
if not self.is_video:
2968-
raise ValueError(f"{self.id} is not a session with video")
2968+
return ()
29692969

29702970
for video_path in self.video_paths:
29712971
camera_name = npc_mvr.get_camera_name(video_path.name)
@@ -3052,6 +3052,8 @@ def _eye_tracking(self) -> pynwb.core.DynamicTable:
30523052

30533053
@npc_io.cached_property
30543054
def _facemap(self) -> tuple[pynwb.TimeSeries, ...]:
3055+
if not self.is_video:
3056+
return ()
30553057
facemap_series = []
30563058
for video_path in self.video_paths:
30573059
camera_name = npc_mvr.get_camera_name(video_path.name)
@@ -3131,7 +3133,6 @@ def _dlc(self) -> tuple[pynwb.core.DynamicTable, ...]:
31313133
)
31323134
else:
31333135
# Get rid of unecessary column "scorer"
3134-
original_df = df
31353136
df = df.droplevel(level=0, axis=1)
31363137
# give the index an informative name
31373138
df.index.name = "frame_index"
@@ -3157,6 +3158,7 @@ def _dlc(self) -> tuple[pynwb.core.DynamicTable, ...]:
31573158
table = pynwb.core.DynamicTable.from_dataframe(
31583159
name=f"dlc_{nwb_camera_name}",
31593160
df=df,
3161+
columns=None,
31603162
table_description=(
31613163
f"DeepLabCut tracking model fit to each frame of {nwb_camera_name.replace('_', ' ')} video. "
31623164
"Output for every frame includes: "

0 commit comments

Comments
 (0)