ThresholdBlockageFinder¶
class ThresholdBlockageFinder(settings: Optional[dict] = None)
Bases: ClassicBlockageFinder
Subclass of ClassicBlockageFinder that imposes much tighter bounds on the start and end time flagged in the output.
This event finder calls the start of the event at the first threshold crossing, and the end of the event at the corresponding threshold crossing at the end through backtracking.
Public Methods¶
- ThresholdBlockageFinder.get_empty_settings(globally_available_plugins: Dict[str, List[str]] | None = None, standalone: bool = False) Dict[str, Dict[str, Any]]¶
Get a dict populated with keys needed to initialize the filter if they are not set yet. This dict must have the following structure, but Min, Max, and Options can be skipped or explicitly set to None if they are not used. Type is required; Value may be omitted or set to None, both meaning there is no default and the user must supply one. All values provided must be consistent with Type. EventFinder objects MUST include a MetaReader object in settings
settings = {'Parameter 1': {'Type': <int, float, str, bool>, 'Value': <value> or None, 'Options': [<option_1>, <option_2>, ... ] or None, 'Min': <min_value> or None, 'Max': <max_value> or None }, ... }
- Parameters:
globally_available_plugins (Optional[Dict[str, List[str]]]) – a dict containing all data plugins that exist to date, keyed by metaclass. Must include “MetaReader” as a key, with explicitly set Type MetaReader.
standalone (bool) – False if this is called as part of a GUI, True otherwise. Default False
- Returns:
the dict that must be filled in to initialize the filter
- Return type:
Private Methods¶
- ThresholdBlockageFinder._find_events_in_chunk(data: ndarray[tuple[int, ...], dtype[float64]], mean: float, std: float, offset: int, entry_state: bool = False, first_chunk: bool = False) Tuple[List[int], List[int], bool]¶
Find the start and end points of events in the provided chunk of data and returns them as separate lists, along with a boolean indicating whether or not the chunk ended in the middle of an event. Should backtrack data to the baseline, since padding logic will assume that it can use data right up to the start and end found as baseline by default
- Parameters:
data (npt.NDArray[np.float64]) – Chunk of timeseries data to analyze. Assume it is rectified so that a blockage will always represent a reduction in absolute value.
mean (float) – Mean of the baseline on the given chunk. Must be positive.
std (float) – Standard deviation of the baseline on the given chunk
offset (int) – the index of the start of the chunk in the global dataset
entry_state (bool) – Bool indicating whether we start in the middle of an event (True) or not (False)
first_chunk (bool) – Bool indicating whether this is the first chunk of data in the series to be analyzed
- Raises:
ValueError – If event_params are invalid.
- Returns:
Lists of event start and end indices, and boolean entry state.
- Return type: