File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -211,17 +211,18 @@ def _parse_header(self):
211211 labels = d ["labels" ]
212212 rising = np .where (states > 0 )[0 ]
213213 falling = np .where (states < 0 )[0 ]
214- # make sure first event is rising and last is falling
215- if states [0 ] < 0 :
216- falling = falling [1 :]
217- if states [- 1 ] > 0 :
218- rising = rising [:- 1 ]
219-
220- if len (rising ) == len (falling ):
221- durations = timestamps [falling ] - timestamps [rising ]
222- else :
223- # something wrong if we get here
224- durations = None
214+
215+ # infer durations
216+ durations = None
217+ if len (states ) > 0 :
218+ # make sure first event is rising and last is falling
219+ if states [0 ] < 0 :
220+ falling = falling [1 :]
221+ if states [- 1 ] > 0 :
222+ rising = rising [:- 1 ]
223+
224+ if len (rising ) == len (falling ):
225+ durations = timestamps [falling ] - timestamps [rising ]
225226
226227 d ["rising" ] = rising
227228 d ["timestamps" ] = timestamps [rising ]
You can’t perform that action at this time.
0 commit comments