Model#

jeanspy.model.Model

See methods and properties for individual lookup pages, or the alphabetical API dictionary to search all classes. The full class contract and existing member anchors are retained below.

class jeanspy.model.Model(show_init=False, submodels=None, **params)#

Bases: object

Base class for stateful NumPy/SciPy model components.

Notes

Inputs and units. show_init is a logging flag; submodels maps required role names to component instances; **params sets scalar physical parameters. Subclasses declare required names and roles.

Returns and shape. A mutable model; model[role] returns its submodel. update(new_params, **kwargs) mutates the owning components and returns None. params_all is a flattened Parameters copy; params_all_with_model_name retains role-qualified names.

Validity. This is a subclassing interface. Unspecified parameters are initialized to NaN; supply all physical values before numerical evaluation. target is retained but ignored by update.

Errors. Missing subclass declarations raise AttributeError; mismatched roles or unknown parameters raise ValueError.

Backend. NumPy/SciPy CPU; stateful components, with no JAX tracing.

Differentiation. No physical-parameter automatic differentiation on this API.

Examples. See the spherical quickstart and composition guide.

is_required_param_names(param_names_candidates)[source]#

Test a sequence of names against this component’s required parameters.

Returns a list of bool with the same length and order as param_names_candidates. Submodel requirements are not included.

property params_all#

Return a flattened Parameters copy of this model and its submodels.

Values retain their physical units. Later submodels overwrite duplicate names; use params_all_with_model_name to retain role-qualified names.

property params_all_with_model_name#

Return a new Parameters mapping with submodel-role prefixes.

Nested names use role:parameter notation. Values retain their physical units; this operation copies the mapping, not nested mutable values.

property required_param_names_combined#

Return this model’s and all nested submodels’ required parameter names.

The result is a list in traversal order; duplicate names are retained.

sampling_identity(sampled_names=())[source]#

Configuration and fixed parameters, excluding changing MCMC coordinates.

update(new_params=None, **kwargs)[source]#

Replace named parameters in the owning components.

Notes

Inputs and units. new_params is an optional mapping/Parameters/Series; keyword values are additional replacements. Names are physical names declared by this model and its components. Unknown names raise ValueError before any parameters are changed.

Returns and shape. None; mutates component parameters. params_all returns the resulting flattened copy.