Skip to content

API reference / Analyses

tsdive.MspcAnalysis dataclass

MspcAnalysis(
    baseline: Window,
    monitor: Window,
    tags: list[str],
    rate_s: int,
    rate_source: str,
    quantile: float,
    train: AlignedMatrix,
    test: AlignedMatrix,
    model: PcaModel,
    found: MspcDetection,
)

PCA T2 and SPE over aligned tags: the model, and the window it graded.

baseline and monitor are the first archive's reads; tags names every archive in order. frame holds one row per aligned timestamp of the window: timestamp, t2, spe, t2_breach, spe_breach.

Methods:

Name Description
render

The report tsdive mspc prints for this window, without colour.

to_dict

The document tsdive mspc --json prints, ready for json.dumps.

Attributes:

Name Type Description
baseline Window
monitor Window
tags list[str]
rate_s int
rate_source str
quantile float
train AlignedMatrix
test AlignedMatrix
model PcaModel
found MspcDetection
ranked bool

True when the model holds more tags than a top-N list would name.

frame DataFrame

baseline instance-attribute

baseline: Window

monitor instance-attribute

monitor: Window

tags instance-attribute

tags: list[str]

rate_s instance-attribute

rate_s: int

rate_source instance-attribute

rate_source: str

quantile instance-attribute

quantile: float

train instance-attribute

train: AlignedMatrix

test instance-attribute

test: AlignedMatrix

model instance-attribute

model: PcaModel

found instance-attribute

found: MspcDetection

ranked property

ranked: bool

True when the model holds more tags than a top-N list would name.

Contributors rank the residual, so a model that keeps every component ranks none.

frame property

frame: DataFrame

render

render() -> str

The report tsdive mspc prints for this window, without colour.

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",
...                 "2024-03-31T04:00:00Z/2024-03-31T06:00:00Z")
>>> print(m.render().splitlines()[0])
demo:FIC101.PV, demo:TIC101.PV  T2 breaches 70   SPE breaches 108   of 121 rows

to_dict

to_dict() -> dict[str, object]

The document tsdive mspc --json prints, ready for json.dumps.

The command adds result_kind and tsdive_version in front.