OzWrapper.OzAnomaly.checks¶
The ten statistical / heuristic anomaly checks (e1..e10).
Each public check_* function consumes a column-oriented numpy
Window (plus the device config where needed) and returns a
dict whose keys are the error-coded field names the detector will
emit. Every function handles the empty / None window case by
returning {}.
The error codes are:
e1constant data (per parameter)e2threshold breach, lower/upper (per parameter,_l/_usuffix)e3data completeness (global)e4dust-order violation (global)e5low humidity / low t2 (single flag)e6missing parameter keys (per parameter) — delegatede7temperature below dew point (condensing environment)e8RH-affected dust (global flag)e9VOC sensor fault (v21)e10RH-affected VOC (global flag)
Attributes¶
Functions¶
|
Total rows in the window (uses the |
|
Return True when the constant-data check (e1) should skip |
|
Return True when the threshold-breach check (e2) should skip |
|
Detect long runs of identical values per sensor column (e1). |
|
Report the shortfall from expected sample count (e3). |
|
Flag violations of the dust-size ordering invariant (e4). |
|
Flag parameters expected by config but absent from the window (e6). |
|
Humidity vs dust (e8). Wraps |
|
Humidity vs VOC (e10). Wraps |
|
Flag a likely condensing environment (e7). |
|
Flag columns where >30% of samples sit outside their bounds (e2, e5). |
|
Flag a stuck VOC sensor (e9). |
|
Test whether humidity drives PM (mode="pm") or VOC (mode="voc") signal. |
Module Contents¶
- OzWrapper.OzAnomaly.checks._row_count(window: OzWrapper.OzAnomaly.data_provider.Window) int[source]¶
Total rows in the window (uses the
tcolumn which is always present).
- OzWrapper.OzAnomaly.checks._skip_evaluation_constant(ogs_list: list, sensor_code: str) bool[source]¶
Return True when the constant-data check (e1) should skip
sensor_code.
- OzWrapper.OzAnomaly.checks._skip_evaluation_threshold(ogs_label: str | None, sensor_code: str) bool[source]¶
Return True when the threshold-breach check (e2) should skip
sensor_code.
- OzWrapper.OzAnomaly.checks.check_constant_instances(config: Dict[str, Any], device_type: str | None, window: OzWrapper.OzAnomaly.data_provider.Window | None) Dict[str, int][source]¶
Detect long runs of identical values per sensor column (e1).
- OzWrapper.OzAnomaly.checks.check_data_completeness(config: Dict[str, Any], window: OzWrapper.OzAnomaly.data_provider.Window | None) Dict[str, int][source]¶
Report the shortfall from expected sample count (e3).
- OzWrapper.OzAnomaly.checks.check_dust_order(window: OzWrapper.OzAnomaly.data_provider.Window | None) Dict[str, float][source]¶
Flag violations of the dust-size ordering invariant (e4).
- OzWrapper.OzAnomaly.checks.check_missing_parameters(window: OzWrapper.OzAnomaly.data_provider.Window | None, config: Dict[str, Any]) Dict[str, int][source]¶
Flag parameters expected by config but absent from the window (e6).
- OzWrapper.OzAnomaly.checks.check_rh_affected_dust(window: OzWrapper.OzAnomaly.data_provider.Window | None) Dict[str, Any][source]¶
Humidity vs dust (e8). Wraps
detect_pm_voc()withmode='pm'.
- OzWrapper.OzAnomaly.checks.check_rh_affected_voc(window: OzWrapper.OzAnomaly.data_provider.Window | None) Dict[str, Any][source]¶
Humidity vs VOC (e10). Wraps
detect_pm_voc()withmode='voc'.
- OzWrapper.OzAnomaly.checks.check_temp_dewpoint(window: OzWrapper.OzAnomaly.data_provider.Window | None) Dict[str, int][source]¶
Flag a likely condensing environment (e7).
- OzWrapper.OzAnomaly.checks.check_threshold_breach(config: Dict[str, Any], device_type: str | None, window: OzWrapper.OzAnomaly.data_provider.Window | None) Dict[str, int][source]¶
Flag columns where >30% of samples sit outside their bounds (e2, e5).
- OzWrapper.OzAnomaly.checks.check_voc_sensor_fault(window: OzWrapper.OzAnomaly.data_provider.Window | None) Dict[str, int][source]¶
Flag a stuck VOC sensor (e9).
If the max-min range of
v21across the window is below 3 mV, the sensor is treated as faulty.
- OzWrapper.OzAnomaly.checks.detect_pm_voc(window: OzWrapper.OzAnomaly.data_provider.Window | None, mode: str, rh_col: str = 'hum', cols: list | None = None, degree: int = 2, rh_threshold: Tuple[float, float] | None = None, r2_threshold: float = 0.3, spike_rh_min: float = 80, spike_z_thresh: float = 1.0, cluster_dist: float = 1.0, min_cluster_points: int = 3) Dict[str, Any][source]¶
Test whether humidity drives PM (mode=”pm”) or VOC (mode=”voc”) signal.
Pure numpy implementation — no scikit-learn. Polynomial fit via
np.polyfit; R² computed manually; spike detection via z-score threshold; cluster decision via O(n²) distance check.
- OzWrapper.OzAnomaly.checks.CONSTANT_CHECK_COL_IGNORE_LIST = ['v25']¶
- OzWrapper.OzAnomaly.checks.logger¶