Skip to content

Rename the DEM-construction NoiseModel to say it is a parameter set, not a simulator noise model #433

Description

@ciaranra

Problem

pecos.qec.surface.NoiseModel collides conceptually with the simulator-side noise
models while being a different kind of object:

name what it is
GeneralNoiseModel / DepolarizingNoiseModel (via general_noise(), depolarizing_noise()) executable models that apply noise during simulation; fluent Rust-backed builders, 47 and 7 with_* methods
pecos.qec.surface.NoiseModel a parameter bag consumed at DEM construction; a Python dataclass, 30 fields plus derived properties

The confusion is live rather than theoretical: docs/workflows/guppy-dem-decoding.md
now imports NoiseModel from pecos.qec.surface in a section that also discusses
simulator noise, and since #422 this dataclass is the shared idle-noise vocabulary for
both the Guppy and native-surface DEM routes — so it is no longer a surface-code detail
either.

NoiseParameters (or similar) would say what it is.

Two separable questions

  1. The rename. ~240 references across ~34 files (source, tests, docs, examples).
    Public, so it needs an alias plus a deprecation ramp rather than a hard rename —
    same discipline as Deprecation ramp: align pecos-engines GeneralNoiseModel idle-noise API with the structured vocabulary #424.
  2. Whether it should gain with_* setters to mirror general_noise(). Recommend
    no: it is a dataclass, so dataclasses.replace(params, p1=...) already provides
    what .with_p1(...) would, and 30 setters would restate the field list a third time
    (fields, docstring, methods) with three places to drift. The conveniences that earn
    their place already exist: uniform(), is_noiseless, physical_error_rate,
    for_runtime_idle_time_units().

Note for whoever picks this up: a "user-facing uses bare setters, low-level uses
with_*" rule does not hold in this repo. sim()'s noise builders are user-facing
and use with_*; the Rust-backed BpOsdBuilder uses bare. The convention is genuinely
inconsistent, so a naming decision here should be made deliberately rather than by
appeal to an existing rule.

Why this belongs with #425

#425 already covers aligning the non-idle GeneralNoiseModel surfaces with the
structured vocabulary. The DEM-side and engines-side names should be settled once,
together
— otherwise this gets renamed to NoiseParameters now and possibly again
when the unified vocabulary lands. Deliberately kept out of PR #420 for that reason,
and because a 240-site public rename mixed into a large functional PR is hard to review.

Related: #422 (which made this dataclass the shared idle vocabulary), #424, #425.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpythonPull requests that update python code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions