Skip to content

Commit

Permalink
Add try except for runs with no channels
Browse files Browse the repository at this point in the history
see notes in issue #175
  • Loading branch information
kkappler committed Dec 8, 2023
1 parent 484acb9 commit 80bdfac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mth5/groups/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,12 @@ def update_run_metadata(self):
channel_summary.start.min().isoformat()
)
self._metadata.time_period.end = channel_summary.end.max().isoformat()
self._metadata.sample_rate = channel_summary.sample_rate.unique()[0]
try:
self._metadata.sample_rate = channel_summary.sample_rate.unique()[0]
except IndexError:
msg = "There maybe no channels associated with this run -- setting sample_rate to 0"
self.logger.critical(msg)
self._metadata.sample_rate = 0
self.write_metadata()

def plot(self, start=None, end=None, n_samples=None):
Expand Down

0 comments on commit 80bdfac

Please sign in to comment.