detect_seq#
- pyCGM2.Signal.detector.detect_seq(x, value=nan, index=False, min_seq=1, max_alert=0, show=False, ax=None)#
Detects indices in x of sequential data identical to a specified value.
- Parameters:
x (np.ndarray) – Data to analyze.
value (float, optional) – Value to be found in data. Default is np.nan.
index (bool, optional) – If True, returns 2D array of initial and final indices where data equals value. If False, returns 1D array of Boolean values. Default is False.
min_seq (int, optional) – Minimum number of sequential values to detect. Default is 1.
max_alert (int, optional) – Minimal number of sequential data for an alert message. Set to 0 to disable alerts. Default is 0.
show (bool, optional) – If True, plots the data. Default is False.
ax (Optional[plt.Axes], optional) – Matplotlib axis object for plotting. Default is None.
- Returns:
np.ndarray – Either a 2D array [indi, indf] of initial and final indices (if index=True) or a 1D array of Boolean values (if index=False).
References
[Detect Seq Notebook](demotu/detecta)
Examples
>>> x = [1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0] >>> # various examples using the function with different parameters
- Version history:
‘1.0.1’: Part of the detecta module - [Detecta PyPI](https://pypi.org/project/detecta/)