tsdive.segment
¶
segment(
archive: str | Path,
window: str | None = None,
*,
penalty: float | None = None,
min_size: int = 10,
basis: str
| CalculationBasis = CalculationBasis.TIME_WEIGHTED,
stepped: bool = False,
) -> SegmentAnalysis
Segment one window of a single-tag archive into regimes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
archive
|
str | Path
|
parquet archive carrying |
required |
window
|
str | None
|
|
None
|
penalty
|
float | None
|
penalty added for each breakpoint. Omitted, the default
multiplier times |
None
|
min_size
|
int
|
samples a segment must hold, at least. |
10
|
basis
|
str | CalculationBasis
|
calculation basis declared on the read. |
TIME_WEIGHTED
|
stepped
|
bool
|
stepped interpolation between samples. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
malformed or naive window. |
TSDiveError
|
any typed refusal from the read path. |
Examples:
>>> import tsdive
>>> s = tsdive.segment("data/demo/fic101_demo.parquet")
>>> len(s.found.breakpoints), len(s.frame)
(5, 6)
>>> list(s.frame.columns)
['index', 'start', 'end', 'n', 'median', 'mad']