Skip to content
Snippets Groups Projects
Commit 5f0c832b authored by Wernle, Alexandra Nicole's avatar Wernle, Alexandra Nicole
Browse files

Added error handling for if window>period.

parent 81d90bd9
No related branches found
No related tags found
1 merge request!344New MetadataAlgorithm, SpikesAlgorithm, and flag-spikes application
......@@ -99,7 +99,13 @@ class SpikesAlgorithm(MetadataAlgorithm):
timestamps = trace.times("UTCDateTime")
signal = trace.data
# TODO: throw error if singal len < window!
# throw error if singal len < window
if len(signal) < self.window_size:
raise ValueError(
f"Signal length ({len(signal)}) must be at least as large as the window size ({self.window_size})."
)
spike_timestamps = self._despike(signal, timestamps)
# check existing metadata
......@@ -119,7 +125,7 @@ class SpikesAlgorithm(MetadataAlgorithm):
return None
def check_existing_spike_metadata(self, trace: Trace) -> str | None:
def check_existing_spike_metadata(self, trace: Trace) -> Optional[str] | None:
"""
Find existing spike metadata for a specified period.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment