Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions strax/plugins/down_chunking_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ def _fix_output(self, result, start, end, superrun, subruns, _dtype=None):
f"Plugin {self.__class__.__name__} should yield (dict of) "
"strax.Chunk in compute method."
)
self._check_sorted(_result)
yield self.superrun_transformation(_result, superrun, subruns)
13 changes: 13 additions & 0 deletions strax/plugins/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,18 @@ def _check_dtype(self, x, d=None):
f"Delivered: {got}."
)

def _check_sorted(self, result):
# check the result is sorted in time
if self.multi_output:
for d in self.provides:
self._check_sorted(result[d])

if len(result.data) < 2:
return

if np.diff(result.data["time"]).min() < 0:
raise ValueError(f"Plugin {self.__class__.__name__} did not return sorted time!")

@staticmethod
def _check_subruns_uniqueness(kwargs, subrunses):
"""Check if the subruns of the all inputs are the same."""
Expand Down Expand Up @@ -788,6 +800,7 @@ def _fix_output(self, result, start, end, superrun, subruns, _dtype=None):
f"{self.__class__.__name__} returned a Chunk with data_type "
f"{result.data_type} instead of {_dtype}."
)
self._check_sorted(result)
return self.superrun_transformation(result, superrun, subruns)

def chunk(self, *, start, end, data, data_type=None, run_id=None):
Expand Down
Loading