pyphi.conf.snapshot.ConfigSnapshot#
- class pyphi.conf.snapshot.ConfigSnapshot(formalism, infrastructure, numerics)[source]#
Bases:
objectImmutable 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:
formalism (FormalismConfig)
infrastructure (InfrastructureConfig)
numerics (NumericsConfig)
- diff(other)[source]#
Return
{dotted-path: (self_value, other_value)}for fields that differ.Walks one level deeper into
formalismso nested IIT and AC sub-namespace fields surface with their qualified paths (formalism.iit.mechanism_phi_measure, …).
- 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 — unlikeas_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.
- classmethod from_builtins(data)[source]#
Rehydrate a snapshot from its plain-builtins (dict) form.
Inverse of
msgspec.to_builtinson 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:
- Return type:
- 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 byFormalismConfig.as_kwargs()— flat overrides on those names are ambiguous andpyphi.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())leavesversionat 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, usepyphi.config.override(**snap.as_overrides()).