tsdive.SegmentAnalysis
dataclass
¶
SegmentAnalysis(
window: Window,
found: Segmentation,
penalty_is_default: bool,
)
One window cut into piecewise-constant segments.
frame holds one row per segment with the columns to_dict()
lists under segments.
Methods:
| Name | Description |
|---|---|
render |
The report |
to_dict |
The document |
write_mode_archive |
Write the segments as a MODE archive at |
Attributes:
| Name | Type | Description |
|---|---|---|
window |
Window
|
|
found |
Segmentation
|
|
penalty_is_default |
bool
|
|
identity |
TagIdentity
|
|
frame |
DataFrame
|
|
render
¶
render() -> str
The report tsdive segment prints for this window, without colour.
Examples:
>>> import tsdive
>>> s = tsdive.segment("data/demo/fic101_demo.parquet")
>>> print(s.render().splitlines()[0])
demo:FIC101.PV 6 segments 5 breakpoints censored yes
to_dict
¶
to_dict() -> dict[str, object]
The document tsdive segment --json prints, ready for json.dumps.
The command adds result_kind and tsdive_version in front.
write_mode_archive
¶
write_mode_archive(
path: str | Path, *, overwrite: bool = False
) -> Path
Write the segments as a MODE archive at path and return it.
One row per row of the segmented window's frame, so screen
--mode joins every timestamp the window read. value holds the
segment label S1, S2, ... in the order the segment table
numbers them; a row before the first breakpoint is S1.
quality is GOOD with quality_assumed set on the meta:
the label is derived from the samples, not measured.
Raises:
| Type | Description |
|---|---|
FileExistsError
|
|