Skip to content

API reference / Analyses

tsdive.mspc

mspc(
    archives: Sequence[str | Path],
    baseline: str,
    window: str,
    *,
    rate_s: int | None = None,
    variance: float = 0.95,
    quantile: float = 0.99,
    min_coverage: float = 0.95,
) -> MspcAnalysis

Detect multivariate departures over two or more single-tag archives.

Parameters:

Name Type Description Default
archives Sequence[str | Path]

parquet archives carrying tsdive.meta.

required
baseline str

START/END in ISO 8601 UTC the model is fitted on.

required
window str

START/END in ISO 8601 UTC to monitor.

required
rate_s int | None

grid rate in seconds. Omitted, the rate every archive declares.

None
variance float

cumulative variance kept, in (0, 1].

0.95
quantile float

empirical quantile for the limits, in (0, 1].

0.99
min_coverage float

grid cells that must be filled before alignment is accepted, in (0, 1].

0.95

Raises:

Type Description
ValueError

malformed window, overlapping windows, or no rate_s where an archive declares no sample_rate_s or the archives declare different ones.

TSDiveError

a censored baseline, archives that do not align, a tag that does not move over the baseline, or any typed refusal from the read path.

Examples:

>>> import tsdive
>>> m = tsdive.mspc(["data/demo/fic101_demo.parquet", "data/demo/tic101_demo.parquet"],
...                 "2024-03-30T20:00:00Z/2024-03-30T23:00:00Z",  # baseline
...                 "2024-03-31T04:00:00Z/2024-03-31T06:00:00Z")  # window
>>> len(m.found.t2_breaches), len(m.found.spe_breaches), len(m.frame)
(70, 108, 121)
>>> m.tags
['demo:FIC101.PV', 'demo:TIC101.PV']