quchip.utils

Physical constants and shared utilities.

quchip.utils.auto_label(prefix)[source]

Return the next "{prefix}_{n}" label and advance the per-prefix counter.

Parameters:

prefix (str) – The component’s _type_prefix (e.g. "duffing", "charge").

Returns:

f"{prefix}_{n}" where n starts at 0 and increments on each call with the same prefix.

Return type:

str

quchip.utils.reset_label_counters()[source]

Reset every auto-label counter to zero.

Intended for test fixtures — tests rely on deterministic labels, and the module-level counter dict is otherwise process-global.

Return type:

None

quchip.utils.resolve_label(obj)[source]

Return a label string from either a string or a labeled component.

Used wherever quchip’s public API accepts “component or its label” interchangeably.

Parameters:

obj (str | Any) – Either a label string, or any object exposing a non-None .label attribute (devices, drives, couplings all qualify).

Raises:

TypeError – If obj is neither a string nor an object with a usable .label.

Return type:

str

Modules

constants

Physical constants in the quchip GHz / ns / mK unit convention.

jax_utils

Tracer-detection and array-namespace dispatch helpers shared across quchip.

labeling

Shared auto-labeling and label resolution for quchip components.

registry

Shared subclass-registry mixin for serializable quchip components.

state_versioning

StateVersioned — shared mutation-tracking / cache-invalidation mixin.