GUIBRUSHR.core.types.param_registry module

Name-keyed wrapper for the canonical parameter array.

ParamRegistry is a thin container that exposes the same ordered sequence as the legacy initial_param_array list, but indexed primarily by parameter name. It also provides named-anchor slice helpers so that callers like LikelihoodHR and SpeciesMolec can request “all molecule slots” or “all condensed-species slots” without carrying integer section starts.

Backed internally by an ordered dict so that ordering matches ConstantVariables.params_list exactly.

class GUIBRUSHR.core.types.param_registry.ParamRegistry(params_list: Sequence[str])[source]

Bases: object

Ordered, name-keyed registry of parameter slots.

The registry has one slot per name in params_list; each slot may hold a ParamForModel instance or remain None for parameters that are not active in the current retrieval.

__init__(params_list: Sequence[str])[source]
property names: tuple[str, ...]
get_index(name: str) int[source]

Return the canonical position of name in params_list.

items() Iterator[tuple[str, object]][source]

Iterate (name, slot) pairs in canonical order.

as_list() List[object][source]

Return slot values as a plain list in canonical order.

Bridge for consumers that still expect initial_param_array to behave like a list (Phase 1/2 compatibility).

slice_by_name(start: str, end: str | None = None) List[object][source]

Return slot values from start (inclusive) to end (exclusive).

end may be None to slice to the end of the registry.

populate_from_list(source: Iterable) None[source]

Replace slot values in canonical order from an iterable.

Accepts an iterable of length equal to len(self); each value is assigned to the slot at the corresponding position. This is used by Phase-1 wiring to derive a registry from the legacy initial_param_array list without touching the build logic.

GUIBRUSHR.core.types.param_registry.slice_section(container, params_list: Sequence[str], start_name: str, end_name: str | None = None) List[object][source]

Return slot values from start_name (incl) to end_name (excl).

Works on both a legacy list (positional, indexed by params_list) and a ParamRegistry. When end_name is None the slice runs to the end of the container.

For list inputs, the container length must equal len(params_list); a mismatch would silently truncate or over-read the slice with no user-visible error. The assertion makes the contract loud.