MarkerAnomalyDetectionRollingProcedure#

class pyCGM2.Anomaly.anomalyDetectionProcedures.MarkerAnomalyDetectionRollingProcedure(markers: List, plot: bool = False, **kwargs)#

Marker anomaly detection using rolling statistics.

Each coordinate (X, Y, Z) of a marker trajectory is compared to its rolling median (or mean) with pyCGM2.Signal.anomaly.anomaly_rolling(). A frame is an anomaly if at least one coordinate is flagged (union of the 3 axes).

The Output of the anomaly dictionary is {marker: [frames]}, with frames expressed in the acquisition frame numbering.

m_markers#

List of marker labels.

Type:

List

_plot#

Flag indicating whether to enable plotting.

Type:

bool

_aprioriError#

A priori error on the marker trajectory.

Type:

float

_window#

Size of the rolling windows.

Type:

int

_threshold#

Detector threshold.

Type:

float

_method#

Method to use for rolling statistics, either ‘mean’ or ‘median’.

Type:

str

__init__(markers: List, plot: bool = False, **kwargs)#

Initialize the MarkerAnomalyDetectionRollingProcedure class with given parameters.

Parameters:
  • markers (List) – List of marker labels.

  • plot (bool, optional) – Flag indicating whether to enable plotting. Defaults to False.

  • **kwargs – aprioriError (default 3), window (default 10), threshold (default 3) and method (default ‘median’). The legacy spelling treshold is still accepted.

Methods

__init__(markers[, plot])

Initialize the MarkerAnomalyDetectionRollingProcedure class with given parameters.

getAnomaly()

Returns the detected anomaly.

run(acq, filename, options)

Run the marker anomaly detection procedure.

run(acq: btkAcquisition, filename: str, options: Dict)#

Run the marker anomaly detection procedure.

Parameters:
  • acq (btk.btkAcquisition) – A btk acquisition instance.

  • filename (str) – Filename of the data being processed.

  • options (Dict) – Additional options passed from the filter. It can include ‘frameRange’ ([firstFrame, lastFrame]) to restrict the analysis.