tsdive.switchback.verify_plan
¶
verify_plan(plan: SwitchbackPlan) -> Design
The design the plan's seed draws, after checking the plan against it.
Checked in this order: the digest against the canonical schedule, each
block's index and times against start, block_s and
washout_s, the balance of the settings, and the settings against
the ones the seed draws.
Raises:
| Type | Description |
|---|---|
ScheduleMismatch
|
any check fails. |
DesignTooSmall
|
the plan's block count is too small for a randomization test. |
Examples:
>>> import dataclasses
>>> import pandas as pd
>>> from tsdive.switchback import make_plan, verify_plan
>>> plan = make_plan(pd.Timestamp("2024-06-03T00:00:00Z"),
... pd.Timestamp("2024-06-04T00:00:00Z"),
... block_s=3600, washout_s=900, seed=7)
>>> design = verify_plan(plan)
>>> design.k, bool((design.observed == plan.observed).all())
(24, True)
>>> verify_plan(dataclasses.replace(plan, seed=8))
Traceback (most recent call last):
...
tsdive.errors.ScheduleMismatch: ...