pyphi.conf.snapshot.ConfigSnapshot#

class pyphi.conf.snapshot.ConfigSnapshot(formalism, infrastructure, numerics)[source]#

Bases: object

Immutable snapshot of the three config layers at construction time.

Result objects carry one of these so reproducibility is self-contained: rerunning a saved result is pyphi.config.override(**snap.as_overrides()), which restores every field — including the formalism version and other fields whose bare names collide between the IIT and actual-causation sub-namespaces.

Parameters:
diff(other)[source]#

Return {dotted-path: (self_value, other_value)} for fields that differ.

Walks one level deeper into formalism so nested IIT and AC sub-namespace fields surface with their qualified paths (formalism.iit.mechanism_phi_measure, …).

Parameters:

other (ConfigSnapshot)

Return type:

dict[str, tuple[Any, Any]]

as_overrides()[source]#

Return a full-fidelity override mapping for this snapshot.

Infrastructure and numerics fields appear under their flat names; every formalism field appears under its qualified dotted path (iit.version, actual_causation.mechanism_partition_scheme, …), so — unlike as_kwargs() — fields whose bare names collide between the two formalism sub-namespaces are included. pyphi.config.override(**snap.as_overrides()) reproduces the snapshotted configuration exactly.

Return type:

dict[str, Any]

classmethod from_builtins(data)[source]#

Rehydrate a snapshot from its plain-builtins (dict) form.

Inverse of msgspec.to_builtins on a snapshot, as used by the serialization layer. Unknown field names are ignored and missing fields take their defaults, so payloads written by other PyPhi versions still load.

Parameters:

data (Mapping[str, Any])

Return type:

ConfigSnapshot

as_kwargs()[source]#

Return the snapshot’s non-colliding fields as a flat kwargs dict.

Field names that collide between the formalism’s IIT and AC sub-namespaces (e.g. version, mechanism_partition_scheme) are excluded by FormalismConfig.as_kwargs() — flat overrides on those names are ambiguous and pyphi.conf._global._GlobalConfig.__setattr__ rejects them.

Because the colliding fields are excluded, the flat form does NOT reproduce a snapshot whose formalism differs from the ambient default: pyphi.config.override(**snap.as_kwargs()) leaves version at the ambient value, and config validation rejects the resulting mix (e.g. an IIT 3.0 snapshot’s measures under the default version). To reproduce a snapshot, use pyphi.config.override(**snap.as_overrides()).

Return type:

dict[str, Any]