From 3421c8f955d4384ca7ab22f1e6e4dd73cd0c3595 Mon Sep 17 00:00:00 2001 From: Charlie Windolf Date: Tue, 15 Oct 2024 14:35:41 -0700 Subject: [PATCH] Initialize dataset --- src/dartsort/peel/peel_base.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dartsort/peel/peel_base.py b/src/dartsort/peel/peel_base.py index d67f62c5..3e7e5ee5 100644 --- a/src/dartsort/peel/peel_base.py +++ b/src/dartsort/peel/peel_base.py @@ -685,9 +685,7 @@ def initialize_files( ) if residual_to_h5: - if "residual" in output_h5: - pass - else: + if "residual" not in output_h5: n_chans = self.recording.get_num_channels() output_h5.create_dataset( "residual", @@ -696,6 +694,14 @@ def initialize_files( maxshape=(None, self.spike_length_samples, n_chans), chunks=(chunk_size, self.spike_length_samples, n_chans), ) + if "residual_times_seconds" not in output_h5: + output_h5.create_dataset( + "residual_times_seconds", + dtype=float, + shape=(0,), + maxshape=(None,), + chunks=(chunk_size,), + ) # residual file ignore/open/overwrite logic save_residual = residual_filename is not None