zoomy_core.model.reconstruction_inverse module

zoomy_core.model.reconstruction_inverse module#

Symbolic inverse of the reconstruction-variables map.

Given a forward map wb_k = f_k(state) (one entry per state slot, as ZArray), invert_reconstruction() returns the closed-form inverse state_k = g_k(WB), where WB is a vector of fresh WB_<state_name> symbols. The inverse is auto-derived via sympy.solve; topological ordering between slots (e.g. depth-first, then momentum) is left to sympy. Used by both zoomy_core.model.basemodel.Model.state_from_reconstruction() and the corresponding SystemModel-level derived field, so the same inverse logic is shared symbol-by-symbol whether invoked on the model’s primitive state or on the SystemModel’s post-CoV state.

zoomy_core.model.reconstruction_inverse.invert_reconstruction(forward, state_syms)#

Return the symbolic inverse of forward as a ZArray of length len(state_syms).

Parameters:
  • forward (ZArray | sequence) – Reconstruction-variables map — entry k is the symbolic expression for the WB primitive in slot k, in terms of state_syms.

  • state_syms (sequence of sympy.Symbol) – State symbols, in slot order.

Returns:

Inverse map — entry k is state_syms[k] expressed as a sympy expression in WB_<state_name> symbols. For slots where the forward is the identity (forward[k] == state[k]) the inverse is also the identity (WB_<state_name>), no solve call.

Return type:

ZArray

zoomy_core.model.reconstruction_inverse.reconstruction_symbols(state_syms)#

Return the fresh WB_<name> symbols paired with state_syms.

One WB_<state_name> Symbol per state slot, in slot order. The inverse is expressed in terms of these — at lambdification time the runtime feeds them with the limiter’s primitive face values.