Skip to main content
Version: Next

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.

Classes
NameDescription
DesignOfExperimentsEventsSegment continuous process data into DOE runs and estimate effects.

DesignOfExperimentsEvents​

classsource
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.

Functions
NameDescription
detect_runsIdentify DOE runs as stable intervals across all factor signals.
effectsAggregate the response signal per factor level (main effects).
Parameters
NameTypeDescriptionDefault
dataframeDataFrameLong-format timeseries frame (one row per sample, uuid identifies the signal).required
factor_uuidslist[str]UUIDs of the factor signals (at least one). Each must be present in dataframe.required
event_uuidstrUUID stamped on emitted events.'dev:doe_run'
value_columnstrColumn holding the signal values.'value_double'
time_columnstrTimestamp column.'systime'

detect_runs​

methodsource
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.

Parameters
NameTypeDescriptionDefault
min_durationstrMinimum run length to be reported (e.g. "5min"). Shorter stable intervals are treated as transients.'5min'
stability_tolfloatMaximum relative range ``(max - min) / (mean
n_levelsdict[str, int] | NoneOptional {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
Returns
TypeDescription
DataFrameInterval-shape DataFrame with columns: start, end,
DataFrameduration_seconds, uuid, source_uuid (the comma-joined
DataFramefactor UUIDs), run_id, and one factor__<uuid>_level column
DataFrameper factor.

effects​

methodsource
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).

Parameters
NameTypeDescriptionDefault
response_uuidstrUUID of the response (output) signal.required
statisticstrAggregation 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_durationstrForwarded to :meth:detect_runs.'5min'
stability_tolfloatForwarded to :meth:detect_runs.0.02
n_levelsdict[str, int] | NoneForwarded to :meth:detect_runs.None
Returns
TypeDescription
DataFrameSummary DataFrame with one row per (factor, level), columns:
DataFramefactor, level, n_runs, run_count (runs at the
DataFramelevel), response_mean, response_std, main_effect.
DataFramemain_effect is response_mean minus the grand mean
DataFrameacross all runs.
DataFrameCanonical twin columns: run_count (after n_runs); it holds
DataFramethe same values as the deprecated column right before it, which is
DataFrameremoved in the next major release.