Skip to content
Snippets Groups Projects
Commit 85040389 authored by Alán Muñoz's avatar Alán Muñoz
Browse files

fix(signal): fringe case t_min < signal.t_interval

parent 27b9c3f6
No related branches found
No related tags found
No related merge requests found
...@@ -402,18 +402,20 @@ class Signal(BridgeH5): ...@@ -402,18 +402,20 @@ class Signal(BridgeH5):
return int(self.tinterval * self.ntps / 60) return int(self.tinterval * self.ntps / 60)
@property @property
def switch_frames(self) -> t.List[int]: def switch_times(self) -> t.List[int]:
switchtimes_name = "switchtimes" switchtimes_name = "switchtimes"
switch_frames = self.meta_h5[switchtimes_name] switches_minutes = self.meta_h5[switchtimes_name]
return [ return [
tp for tp in switch_frames if tp and tp < self.max_span t_min
for t_min in switches_minutes
if t_min and t_min < self.max_span
] # Cover for t0 switches ] # Cover for t0 switches
@property @property
def stages_span(self) -> t.Tuple[t.Tuple[str, int], ...]: def stages_span(self) -> t.Tuple[t.Tuple[str, int], ...]:
# Return consecutive stages and their corresponding number of time-points # Return consecutive stages and their corresponding number of time-points
transition_tps = (0, *self.switch_frames, self.max_span) transition_tps = (0, *self.switch_times, self.max_span)
spans = [ spans = [
end - start end - start
for start, end in zip(transition_tps[:-1], transition_tps[1:]) for start, end in zip(transition_tps[:-1], transition_tps[1:])
...@@ -425,7 +427,7 @@ class Signal(BridgeH5): ...@@ -425,7 +427,7 @@ class Signal(BridgeH5):
def stages_span_tp(self) -> t.Tuple[t.Tuple[str, int], ...]: def stages_span_tp(self) -> t.Tuple[t.Tuple[str, int], ...]:
return tuple( return tuple(
[ [
(name, t_min // self.tinterval * 60) (name, (t_min * 60) // self.tinterval)
for name, t_min in self.stages_span for name, t_min in self.stages_span
] ]
) )
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