Skip to content

pecos-neo IdleChannel::from_t1_t2 derives a dimensionally inconsistent quadratic rate and silently clamps short T1/T2 #438

Description

@ciaranra

The T1/T2 convenience constructor produces rates that do not match how the rest of IdleChannel interprets them.

// exp/pecos-neo/src/noise/idle.rs:140-151
pub fn from_t1_t2(t1: f64, t2: f64) -> Self {
    // Approximate error rate from T1/T2
    // This is a simplified model
    let linear_rate = 1.0 / t1.max(1.0);
    let quadratic_rate = 1.0 / (t2 * t2).max(1.0);
    ...
}

Two separate problems:

  1. Dimensional inconsistency. quadratic_rate is consumed elsewhere as an angle per unit
    time: coherent mode computes quadratic_rate * duration as an RZ angle, and incoherent
    mode computes sin(quadratic_rate * factor * duration / 2)^2. A value of 1/t2^2 has
    units of inverse time squared, so the resulting angle is not a physically meaningful
    function of the requested T2.

  2. Silent clamping. .max(1.0) is applied to the denominators, not the results. For any
    t1 < 1.0 or t2 < 1.0 in abstract time units, the derived rate saturates at 1.0 and
    stops responding to the input entirely -- a shorter coherence time produces the same noise
    as t1 = 1.0. Nothing reports that the requested value was ignored.

The docstring says "simplified model", which covers approximation but not a rate that does not
track its own input.

Workaround: set linear_rate and quadratic_rate directly rather than deriving them from
T1/T2.

Suggested direction: derive the quadratic rate with units consistent with its consumers,
and either reject non-positive/very short times explicitly or let the rates scale as given
instead of clamping. Note that general_builder.rs also exposes with_idle_t1_t2, so any fix
should cover both entry points.

Found while reviewing after-2q idle noise in exp/pecos-neo; not addressed there because it
is independent of that change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrustPull requests that update rust codeseverity:mediumDegraded or awkward behavior with a workaround

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions