Calibration

cubie.batchsolving.calibration.run_calibration(parent: Any, initial_values: Any, parameters: Any, drivers: Dict[str, Any] | None = None, duration: float = 1.0, settling_time: float = 0.0, t0: float = 0.0, grid_type: str = 'verbatim', apply: bool = True, verbose: bool = True) CalibrationResult[source]

Race solver configurations for a solver and pick the fastest.

Parameters:
  • parent – The configured Solver whose system, tolerances, and output configuration every candidate replicates.

  • initial_values – Initial state values for each integration run, as accepted by Solver.solve().

  • parameters – Parameter values for each run, as accepted by Solver.solve().

  • drivers – Driver samples or configuration matching cubie.array_interpolator.ArrayInterpolator.

  • duration – Total integration time candidates are ranked on.

  • settling_time – Warm-up period before recording outputs.

  • t0 – Initial integration time.

  • grid_type – Strategy for constructing the integration grid from inputs. Only used when dict inputs trigger grid construction.

  • apply – Apply the winner’s configuration to parent when True.

  • verbose – Print per-candidate progress lines.

Returns:

Winner, ranking, and every candidate measurement. A candidate that fails to build or integrate is reported as dropped with its error message.

Return type:

CalibrationResult

Raises:

ValueError – If the system declares drivers but none are supplied.

class cubie.batchsolving.calibration.CalibrationResult(candidates: List[CandidateResult], winner: CandidateResult | None, ranking: List[CandidateResult], features: Dict[str, Any], applied_settings: Dict[str, Any])[source]

Bases: object

Complete calibration report.

Parameters:
  • candidates (List[cubie.batchsolving.calibration.CandidateResult]) – Every candidate measurement from every stage, in run order.

  • winner (cubie.batchsolving.calibration.CandidateResult | None) – Fastest candidate that integrated the batch acceptably, or None when no candidate did.

  • ranking (List[cubie.batchsolving.calibration.CandidateResult]) – Every configuration that survived full-length timing, fastest first.

  • features (Dict[str, Any]) – System description (sizes, precision, tolerances, …) accompanying the measurements.

  • applied_settings (Dict[str, Any]) – Settings applied to the calling solver, empty when nothing was applied.

applied_settings: Dict[str, Any]
candidates: List[CandidateResult]
features: Dict[str, Any]
ranking: List[CandidateResult]
summary() str[source]

Return a formatted table of every candidate measurement.

to_records() List[Dict[str, Any]][source]

Return flat per-candidate dictionaries for tabular export.

winner: CandidateResult | None
class cubie.batchsolving.calibration.CandidateResult(spec: CandidateSpec, stage: str, times_ms: Tuple[float, ...] = (), trial_ms: float | None = None, failures: int = 0, runs: int = 0, dropped: bool = False, reason: str = '')[source]

Bases: object

Measured outcome for one candidate.

Parameters:
  • spec (cubie.batchsolving.calibration.CandidateSpec) – The candidate configuration measured.

  • stage (str) – Name of the race stage the measurement belongs to.

  • times_ms (Tuple[float, ...]) – Per-solve times in milliseconds for the full-length solves.

  • trial_ms (float | None) – Time of the last short trial solve in milliseconds; None when the candidate never ran one.

  • failures (int) – Failed-run count from the last solve inspected.

  • runs (int) – Trajectory count each solve integrated.

  • dropped (bool) – Whether the candidate was removed before full-length timing.

  • reason (str) – Why the candidate was dropped, empty otherwise.

property best_ms: float

Lowest measured solve time, inf when never timed.

dropped: bool
property failure_fraction: float

Failed runs as a fraction of the trajectory count.

failures: int
reason: str
runs: int
spec: CandidateSpec
stage: str
times_ms: Tuple[float, ...]
trial_ms: float | None
class cubie.batchsolving.calibration.CandidateSpec(label: str, family: str, algorithm: str, settings: Tuple[Tuple[str, Any], ...] = ())[source]

Bases: object

One candidate configuration in the calibration race.

Parameters:
  • label (str) – Human-readable identifier shown in reports.

  • family (str) – Algorithm family key ("erk", "dirk", "firk", or "rosenbrock").

  • algorithm (str) – Tableau alias passed to the solver as algorithm.

  • settings (Tuple[Tuple[str, Any], ...]) – (name, value) pairs of solver keyword overrides.

algorithm: str
family: str
property key: Tuple[str, Tuple[Tuple[str, Any], ...]]

Identity of the configuration, independent of its label.

label: str
settings: Tuple[Tuple[str, Any], ...]
property settings_dict: Dict[str, Any]

Settings pairs as a keyword-argument dictionary.