conatus.expert.ThresholdBisection¶
- class conatus.expert.ThresholdBisection(fate, *, rtol, scale='linear', known=None, log=None)[source]¶
Bases:
objectBisection on one amplitude (e.g. the seed energy E0 of a minimal seed) between a value that relaminarizes and one that transitions: the transition threshold as a bracket ]lo, hi], never as a single guessed number.
fate(a) -> -1(relaminarizes) /+1(transitions) /0(undecided) is the user’s declared verdict for amplitudea(e.g. one forward DNS of the seed rescaled to E0 = a, classified with declared thresholds); an undecided run stops the bisection (UndecidedTrajectory), it is never counted on either side.knowngives fates already computed (e.g. by finished jobs): they are used first (no run is repeated, an end of [lo, hi] already settled by a known fate is not recomputed) and checked for consistency (a transitioning amplitude below a relaminarizing one is refused: the threshold would not be a single crossing on this family). Bisection is in the middle of the bracket (scale= "linear") or of its logarithm ("log") until (hi - lo) / hi <=rtol.tb = ThresholdBisection(fate, rtol=1e-3, known={1.576778e-7: -1, 1.60e-7: +1}) lo, hi = tb.run(1.5e-7, 1.7e-7); print(tb.explain())
- Parameters:
fate (Callable)
rtol (float)
scale (str)
known (dict | None)
- run(lo, hi)[source]¶
Bracket ]lo, hi] of the threshold in [lo, hi]: lo must relaminarize and hi transition. Known fates inside [lo, hi] narrow the bracket first; an end is run only when no known fate settles it (monotonicity: a relaminarizing amplitude >= lo settles lo).
- Parameters:
lo (float)
hi (float)
- Return type:
tuple[float, float]