DSphModel#
jeanspy.model.DSphModel
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.DSphModel(show_init=False, submodels=None, **params)#
Bases:
jeanspy.model.ModelComposite spherical Jeans model for dwarf spheroidal systems.
Notes
Inputs and units. submodels must contain StellarModel, DMModel and AnisotropyModel;
vmem_kmssets mean velocity.sigmalos2andsigmalosusemethod="dequad"by default, with n outer andn_kernelinner nodes.R_pcis scalar or nonempty 1-D projected radius;r_pcis intrinsic radius (pc).Returns and shape. sigmar2 and sigmat2 return intrinsic radial and one-component tangential variances in (km/s)^2.
sigmalos2returns LOS variance arrays with input shape, or a scalar for scalar input.sigmalosreturns the corresponding dispersion in km/s.integrand_sigmalos2(u, R_pc)has shape(N_R, N_u).Validity. Finite positive projected radii; no central-limit LOS solver. Tracer has vanishing outer pressure. Numerical orders and adaptive tolerances are part of the analysis configuration.
Errors. Malformed/invalid projected radii or nonphysical mass, density and integrand values raise ValueError. Adaptive reference integration may issue SciPy integration warnings.
Backend. NumPy/SciPy CPU; stateful components, with no JAX tracing.
Differentiation. No physical-parameter automatic differentiation on this API.
Examples.
examples/docs_spherical.py- integrand_sigmalos2(u, R_pc, n_kernel=128)[source]#
Return the LOS-dispersion integrand.
The integration variable is \(u=r/R\), with domain \(1 < u < \infty\).
- 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.
- name = 'DSphModel'#
- ncpu = 4#
- 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_nameto retain role-qualified names.
- property params_all_with_model_name#
Return a new Parameters mapping with submodel-role prefixes.
Nested names use
role:parameternotation. Values retain their physical units; this operation copies the mapping, not nested mutable values.
- required_models = {'AnisotropyModel': <class 'jeanspy.model.AnisotropyModel'>, 'DMModel': <class 'jeanspy.model.DMModel'>, 'StellarModel': <class 'jeanspy.model.StellarModel'>}#
- required_param_names = ['vmem_kms']#
- 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=())#
Configuration and fixed parameters, excluding changing MCMC coordinates.
- sigmalos(R_pc, n=1024, n_kernel=128, ignore_RuntimeWarning=True, *, method='dequad')[source]#
Return the LOS velocity dispersion in km/s.
Accepts the same radii, integration method and numerical controls as
sigmalos2()and returns its square root. The result is scalar for scalar input, otherwise shape (N,).method="dequad"is the default and currently the only supported choice. The same validity checks and errors apply. This is a NumPy/SciPy calculation without JAX tracing.
- sigmalos2(R_pc, n=1024, n_kernel=128, ignore_RuntimeWarning=True, *, method='dequad')[source]#
Return the LOS velocity variance using the selected integration method.
- Parameters:
R_pc (float or array_like) – Positive finite projected radius in pc; scalar or nonempty 1-D array. The model-dependent central limit at R=0 is not supported.
n (int, optional) – Outer quadrature order, default 1024.
n_kernel (int, optional) – Anisotropy-kernel quadrature order, default 128.
ignore_RuntimeWarning (bool, optional) – Suppress NumPy runtime warnings during integration, default true. Invalid integrands and nonfinite or negative variances still raise.
method ({"dequad"}, keyword-only, optional) – Integration method. The fixed double-exponential rule is currently the only supported choice and remains the default.
- Returns:
scalar or ndarray – LOS velocity variance in (km/s)^2; scalar for scalar input, otherwise shape (N,).
- Raises:
ValueError – Unsupported method, invalid projected radii, or nonphysical density, mass, integrand or variance.
Notes
This NumPy/SciPy calculation reads the stored model parameters. Refine
nandn_kernelto check numerical convergence. The NumPy/SciPy inference model uses this entry point with its defaults; no extra callable or closure is needed when passing it to emcee.
- sigmar2(r_pc)[source]#
Return the radial velocity dispersion squared at
r_pc.Notes
Inputs and units.
r_pcis a scalar or NumPy array of positive intrinsic radii in pc.Returns and shape. Variance in (km/s)^2, following input shape; scalar input is a zero-dimensional NumPy array.
Validity. Uses adaptive integration to infinite radius with vanishing outer pressure. The intrinsic helpers do not apply all LOS input validation checks.
- sigmat2(r_pc)[source]#
Return the tangential velocity dispersion squared at
r_pc.Notes
Inputs and units.
r_pcis a scalar or NumPy array of positive intrinsic radii in pc.Returns and shape. Variance in (km/s)^2, following input shape; scalar input is a zero-dimensional NumPy array.
Validity. Uses adaptive integration to infinite radius with vanishing outer pressure. The intrinsic helpers do not apply all LOS input validation checks.
- update(new_params=None, **kwargs)#
Replace named parameters in the owning components.
Notes
Inputs and units.
new_paramsis 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_allreturns the resulting flattened copy.