ts_shape.events.development.design_of_experiments
Design-of-Experiments (DOE) run segmentation and effect estimation.
A DOE campaign sweeps one or more factor signals through discrete levels while a response signal is measured. This detector recovers the run structure from continuous process data: contiguous time intervals where every factor signal is stationary at a recognizable level. Each run is tagged with its factor-level combination, and a follow-up method aggregates the response per factor level to expose main effects.
The detector is deliberately classical -- no regression model fit, no fractional factorial enumeration -- so it works on any factor pattern an experimenter actually ran on the line, including OFAT, full factorial, fractional, and Latin square designs.
| Name | Description |
|---|---|
DesignOfExperimentsEvents | Segment continuous process data into DOE runs and estimate effects. |
DesignOfExperimentsEvents
DesignOfExperimentsEvents(
dataframe: pd.DataFrame,
factor_uuids: list[str],
*,
event_uuid: str = "dev:doe_run",
value_column: str = "value_double",
time_column: str = "systime"
) -> None
Bases: Base
Segment continuous process data into DOE runs and estimate effects.
A run is a contiguous interval during which every factor signal sits on a single discrete level (low rolling std relative to its tolerance) long enough to be a deliberate experimental setting rather than a transient. Tagging each run with its factor-level combination produces an experimental dataset that downstream effect estimation can act on.
| Name | Description |
|---|---|
detect_runs | Identify DOE runs as stable intervals across all factor signals. |
effects | Aggregate the response signal per factor level (main effects). |
| Name | Type | Description | Default |
|---|---|---|---|
dataframe | DataFrame | Long-format timeseries frame (one row per sample, uuid identifies the signal). | required |
factor_uuids | list[str] | UUIDs of the factor signals (at least one). Each must be present in dataframe. | required |
event_uuid | str | UUID stamped on emitted events. | 'dev:doe_run' |
value_column | str | Column holding the signal values. | 'value_double' |
time_column | str | Timestamp column. | 'systime' |
detect_runs
detect_runs(
*,
min_duration: str = "5min",
stability_tol: float = 0.02,
n_levels: dict[str, int] | None = None
) -> pd.DataFrame
Identify DOE runs as stable intervals across all factor signals.
| Name | Type | Description | Default |
|---|---|---|---|
min_duration | str | Minimum run length to be reported (e.g. "5min"). Shorter stable intervals are treated as transients. | '5min' |
stability_tol | float | Maximum relative range ``(max - min) / ( | mean |
n_levels | dict[str, int] | None | Optional {factor_uuid: k} mapping. When given, the factor values are quantile-binned into k levels; otherwise the rounded observed value is used as the level. | None |
| Type | Description |
|---|---|
DataFrame | Interval-shape DataFrame with columns: start, end, |
DataFrame | duration_seconds, uuid, source_uuid (the comma-joined |
DataFrame | factor UUIDs), run_id, and one factor__<uuid>_level column |
DataFrame | per factor. |
effects
effects(
response_uuid: str,
*,
statistic: str = "mean",
min_duration: str = "5min",
stability_tol: float = 0.02,
n_levels: dict[str, int] | None = None
) -> pd.DataFrame
Aggregate the response signal per factor level (main effects).
| Name | Type | Description | Default |
|---|---|---|---|
response_uuid | str | UUID of the response (output) signal. | required |
statistic | str | Aggregation applied to the response within each run. One of "mean" (default), "median", "max", "min", or "settled" -- the latter takes the mean of the final third of the run, useful for response signals that need to stabilise after a factor change. | 'mean' |
min_duration | str | Forwarded to :meth:detect_runs. | '5min' |
stability_tol | float | Forwarded to :meth:detect_runs. | 0.02 |
n_levels | dict[str, int] | None | Forwarded to :meth:detect_runs. | None |
| Type | Description |
|---|---|
DataFrame | Summary DataFrame with one row per (factor, level), columns: |
DataFrame | factor, level, n_runs, run_count (runs at the |
DataFrame | level), response_mean, response_std, main_effect. |
DataFrame | main_effect is response_mean minus the grand mean |
DataFrame | across all runs. |
DataFrame | Canonical twin columns: run_count (after n_runs); it holds |
DataFrame | the same values as the deprecated column right before it, which is |
DataFrame | removed in the next major release. |