Skip to content

loqs.backends.model.dictmodel

Classes

Attributes

Name Type Value Doc
T TypeVar TypeVar('T', bound='DictNoiseModel')
MemberLabel TypeAlias str | tuple[str, tuple[str | int, ...]]

Functions

add_command_aliases

add_command_aliases(d: dict[MemberLabel, Any]) -> None

Add STIM command-alias keys (e.g. "CNOT" -> "CX") alongside originals.

This always adds the aliased key alongside the original rather than replacing it, so both spellings resolve to the same rep.


build_legacy_stim_dict_model

build_legacy_stim_dict_model(model_or_dicts: 'DictNoiseModel | tuple[Mapping, Mapping]', gatereps: Sequence[type[GateRep]] | None = None, instreps: Sequence[type[InstrumentRep]] | None = None, gaterep_array_cast_rep: type[UnitaryGateRep] | type[PTMGateRep] | type[QSimSuperopGateRep] | None = None, instrep_cast_reset: Literal[0, 1, None] = None, instrep_cast_include_outcomes: bool = True) -> 'DictNoiseModel'

Build a DictNoiseModel from a pre-1.2 STIMDictNoiseModel(...) call's arguments -- the build= callable behind that class's legacy construction shim (see loqs.backends.model.__init__).

STIMDictNoiseModel was removed in v1.2 because its one real feature (case/alias-insensitive STIM command lookup) is now built directly into get_reps's own STIM handling, applied uniformly regardless of how gate_dict/inst_dict were built -- so a plain DictNoiseModel needs no separate STIM-aware subclass. Positional-argument order and meaning otherwise match the old constructor exactly, except model_or_dicts accepting a DictNoiseModel instance to copy in place of the old class's own instances (never possible to receive one of those anymore).