Skip to content

API reference / Analyses

tsdive.ScreenAnalysis dataclass

ScreenAnalysis(
    baseline: Window,
    monitor: Window,
    result: ScreenResult,
    k: float,
    *,
    mode_path: str | None = None,
    provisional: ProvisionalBaseline | None = None,
    regimes: dict[str, RegimeBaseline] | None = None,
    alignment: tuple[Alignment, Alignment] | None = None,
)

One screen, whether it used one baseline or one per regime.

provisional and regimes are the two ways a baseline is built; exactly one is populated, and both the text and the JSON read the same object rather than screening the window twice. frame holds the monitored rows the screen flagged.

Methods:

Name Description
render

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

to_dict

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

Attributes:

Name Type Description
baseline Window
monitor Window
result ScreenResult
k float
mode_path str | None
provisional ProvisionalBaseline | None
regimes dict[str, RegimeBaseline] | None
alignment tuple[Alignment, Alignment] | None
identity TagIdentity
frame DataFrame

baseline instance-attribute

baseline: Window

monitor instance-attribute

monitor: Window

result instance-attribute

result: ScreenResult

k instance-attribute

k: float

_ instance-attribute

_: KW_ONLY

mode_path class-attribute instance-attribute

mode_path: str | None = None

provisional class-attribute instance-attribute

provisional: ProvisionalBaseline | None = None

regimes class-attribute instance-attribute

regimes: dict[str, RegimeBaseline] | None = None

alignment class-attribute instance-attribute

alignment: tuple[Alignment, Alignment] | None = None

identity property

identity: TagIdentity

frame property

frame: DataFrame

render

render() -> str

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

Examples:

>>> import tsdive
>>> s = tsdive.screen("data/demo/fic101_demo.parquet",
...                   "2024-03-30T20:00:00Z/2024-03-31T01:00:00Z",
...                   "2024-03-31T01:00:00Z/2024-03-31T06:00:00Z")
>>> print(s.render().splitlines()[0])
demo:FIC101.PV  flagged 29 of 300 (9.7%)

to_dict

to_dict() -> dict[str, object]

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

The command adds result_kind and tsdive_version in front.