JeansLikelihoodModel#

jeanspy.sampler_numpyro.JeansLikelihoodModel

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.sampler_numpyro.JeansLikelihoodModel(dsph_model, parameter_specs, *, sigmalos2_kwargs=None, sigma2_bounds=(1e-12, 1000000000000.0), velocity_mean='vmem_kms', observation_distribution=<class 'numpyro.distributions.continuous.Normal'>, observed_name='vlos', parameter_postprocess=None)[source]#

Bases: object

Callable spherical NumPyro model for line-of-sight velocity inference.

Parameters:
  • dsph_model (jeanspy.model_jax.DSphModel) – Functional JAX forward model. Its LOS variance is in (km/s)**2.

  • parameter_specs (sequence of ParameterSpec) – Ordered sample sites, priors and transformations to physical parameters. Priors are densities in the named sampling coordinates.

  • sigmalos2_kwargs (mapping or None, optional) – Static integration settings passed to the forward sigmalos2 method.

  • sigma2_bounds (pair of float, optional) – Positive ordered variance bounds in (km/s)**2. The spherical adapter rejects negative or nonfinite model variances, then clips nonnegative finite values to this interval. The axisymmetric subclass instead rejects variances outside the interval with log probability minus infinity.

  • velocity_mean (str or callable, optional) – Physical parameter name (default vmem_kms) or a function of the parameter mapping returning the velocity mean in km/s.

  • observation_distribution (callable, optional) – Distribution factory accepting a mean and standard deviation in km/s; defaults to numpyro.distributions.Normal.

  • observed_name (str, optional) – NumPyro observation-site name, default vlos.

  • parameter_postprocess (callable or None, optional) – Optional mapping-to-mapping physical-parameter transformation. A traced likelihood requires a JAX-compatible callable.

Notes

Calling the instance takes matching 1-D arrays R_pc, vlos_kms and e_vlos_kms (pc, km/s, km/s), and adds observation and validity sites to the active NumPyro trace. Radii must be finite and positive; errors finite and nonnegative. The standard likelihood conditions on the observed radii. Physical-parameter gradients use the JAX forward path and differentiable transforms in the admissible interior. This class does not calculate J/D factors or establish a positive phase-space distribution function.

Inputs and units. dsph_model is a spherical JAX forward model; parameter_specs is a sequence of ParameterSpec. Use parameter_postprocess to assemble additional fixed physical parameters. Calling this model takes matching finite nonempty 1-D arrays R_pc (pc), vlos_kms and e_vlos_kms (km/s). Velocity mean and static sigmalos2 options are explicit.

Returns and shape. __call__ returns None while registering NumPyro sample, deterministic and likelihood sites; sample_parameters returns the transformed parameter mapping. Variance includes measurement error squared.

Validity. Positions in pc and velocities/errors in km/s, errors>=0. Gaussian LOS closure at fixed positions. The standard class does not add membership mixtures, velocity-cut normalization or binaries.

Errors. Bad site schemas or observation shapes raise; inadmissible forward variances are rejected with minus-infinite density.

Backend. NumPyro with JAX forward model.

Differentiation. Supported continuous physical parameters are traceable. J/D factors are not likelihood sites. Verify derivatives for custom prior transforms.

Examples. examples/docs_numpyro_inference.py

Raises:

ValueError – Sample, deterministic or observation sites collide; physical parameter names repeat; or the variance rejection limits are invalid.

Special-members:

__call__

Parameters:
  • dsph_model (DSphModel)

  • parameter_specs (Sequence[ParameterSpec])

  • sigmalos2_kwargs (Mapping[str, Any] | None)

  • sigma2_bounds (tuple[float, float])

  • velocity_mean (str | Callable[[Mapping[str, Any]], Any])

  • observation_distribution (Callable[[Any, Any], Any])

  • observed_name (str)

  • parameter_postprocess (Callable[[dict[str, Any]], Mapping[str, Any]] | None)

sample_parameters()[source]#

Draw ParameterSpec values inside a NumPyro model execution.

Returns the physical-parameter mapping after parameter_postprocess, if supplied. Execute under NumPyro inference or a seeded handler. Parameter units and shapes follow the individual specifications.

Return type:

dict[str, Any]