FlatPriorModel#

jeanspy.model.FlatPriorModel

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.FlatPriorModel(config, show_init=False, submodels=None, **params)#

Bases: jeanspy.model.Model

Finite uniform bounds in explicitly named sampling coordinates.

The DataFrame is the single source of truth for evaluation and sampling. A generated template must be filled in before constructing this model.

Notes

Inputs and units. config is a pandas DataFrame indexed by ordered parameter names, with finite lower/upper columns, or a CSV path. sample(size) uses NumPy’s random state. write_config_template writes a CSV template.

Returns and shape. A validated prior object; sample returns coordinates with trailing parameter axis. lower/upper are array copies. extract_value_by_name expects exactly one parameter vector.

Validity. Unique nonempty names and lower<upper. Bounds apply before log/power transforms. Unfilled default NaN bounds are intentionally unusable for inference.

Errors. Invalid schema/bounds/vector shape raise ValueError or TypeError; missing CSV raises FileNotFoundError.

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

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

Examples. examples/docs_inference.py

extract_value_by_name(params, name)[source]#

Extract one named sampling coordinate from a vector of shape (ndim,).

Values retain the prior-coordinate units, including logarithmic units. A wrong shape raises ValueError; an unknown name raises KeyError.

get_index(param_name)[source]#

Return the index of the named parameter in the validated prior table.

An unknown param_name raises KeyError.

is_required_param_names(param_names_candidates)#

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.

load_config(config)[source]#

Load and copy uniform-prior bounds from a DataFrame or CSV path.

CSV input uses its first column as the parameter-name index. The bounds are checked by validate_config before replacing stored data. Returns None; file, parse and validation errors propagate.

property lower#

Return a float array copy of lower bounds, shape (ndim,), in prior order.

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.

required_models = {}#
required_param_names = []#
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.

sample(size=None)[source]#

Draw from the finite sampling-coordinate bounds.

Notes

Inputs and units. size is a sample count, tuple of sample axes or None; uses NumPy’s global random state.

Returns and shape. Uniform coordinates with trailing parameter axis; size=None returns one vector.

sampling_identity(sampled_names=())#

Configuration and fixed parameters, excluding changing MCMC coordinates.

update(new_params=None, **kwargs)#

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.

property upper#

Return a float array copy of upper bounds, shape (ndim,), in prior order.

static validate_config(data)[source]#

Validate a DataFrame of explicit finite uniform-prior bounds.

The nonempty index contains unique parameter names; columns must include unique lower and upper bounds with lower < upper in each row. Returns None. A non-DataFrame raises TypeError; invalid schema or bounds raise ValueError. Use load_config to read a CSV path first.

static write_config_template(fname, param_names, lower=nan, upper=nan)[source]#

Write a template; unspecified bounds deliberately cannot be sampled.