Skip to content

Commit aa4f357

Browse files
committed
Ensure output collection exists
1 parent e35abd1 commit aa4f357

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

projects/_sp_passiveVideo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ def extract_frame_times(self, save=True, frame_rate=None, display=False, **kwarg
130130
sync, chmap = load_timeline_sync_and_chmap(sync_path, timeline=self.timeline)
131131

132132
# Attempt to get the frame rate from the video file if not provided
133-
video_file = next(self.session_path.joinpath(self.collection).glob('_sp_video.raw.*'))
134-
if video_file.exists():
133+
if video_file := next(self.session_path.joinpath(self.collection).glob('_sp_video.raw.*'), None):
135134
video_meta = get_video_meta(video_file)
136135
if frame_rate is not None and frame_rate != video_meta.fps:
137136
_logger.warning(
@@ -258,7 +257,7 @@ def extract_frame_times(self, save=True, frame_rate=None, display=False, **kwarg
258257
plt.legend(markerfirst=False, title='repeat #', loc='upper right', facecolor='white')
259258

260259
# Check the sync sequence from the video
261-
if video_file.exists():
260+
if video_file:
262261
observed = self.load_sync_sequence_from_video(video_file)
263262
_, ax = plt.subplots(2, 1, sharex=True)
264263
ax[0].title.set_text('generated sync square sequence')
@@ -278,6 +277,7 @@ def extract_frame_times(self, save=True, frame_rate=None, display=False, **kwarg
278277

279278
if save:
280279
filename = self.session_path.joinpath(self.output_collection, '_sp_video.times.npy')
280+
filename.parent.mkdir(exist_ok=True, parents=True)
281281
np.save(filename, frame_times)
282282
out_files = [filename]
283283
else:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "project_extraction"
7-
version = "0.8"
7+
version = "0.8.1"
88
description = "Custom extractors for satellite tasks"
99
dynamic = [ "readme" ]
1010
keywords = [ "IBL", "neuro-science" ]

0 commit comments

Comments
 (0)