ZhaoModel#
jeanspy.model_jax.ZhaoModel
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_jax.ZhaoModel(submodels=None)[source]#
Bases:
jeanspy.model_jax.DMModelFunctional JAX Zhao halo with transition, outer and inner slopes.
paramsrequiresrs_pc(pc),rhos_Msunpc3(Msun/pc^3),alpha,beta,gammaandr_t_pc(pc). Inside the cutoff,\[\rho(r)=\rho_s x^{-\gamma}(1+x^\alpha)^{-(\beta-\gamma)/\alpha}, \quad x=r/r_s.\]mass_density_3dis zero for r > r_t_pc and includes the boundary.enclosed_massreturns Msun inside min(r_pc,r_t_pc); both preserve radius shape. Positive scales, alpha > 0 and gamma < 3 are required; finite-radius mass allows beta <= 3. Infinite r_t_pc is allowed at finite radii. Invalid dynamic domains yield NaN, except the valid central cusp can diverge in density. Unsupported method names raise ValueError.auto/numericuse cusp-regularized quadrature with n_steps and support JAX gradients in shape parameters. The explicitanalytic(orenclosed_mass_betainc) path does not support shape autodiff; it falls back to numerical mass outside the incomplete-beta domain. Hard-cutoff boundaries need separate treatment. Runtime JAX precision/platform configuration applies. Seeexamples/docs_jax_spherical.py.- Parameters:
submodels (Dict[str, jeanspy.model_jax.Model])
- required_param_names: tuple[str, ...] = ('rs_pc', 'rhos_Msunpc3', 'alpha', 'beta', 'gamma', 'r_t_pc')#
- analytic_enclosed_mass_autodiff_safe = False#
- mass_density_3d(r_pc, *, params)[source]#
Evaluate functional spherical halo density.
Notes
Inputs and units.
r_pcis scalar/array in pc; params is a physical scalar dictionary.Returns and shape. Density in Msun/pc^3 with radius shape; zero for r > r_t_pc, including the boundary r = r_t_pc in the halo. Invalid dynamic domains yield NaN; cusps can diverge at r=0.
- enclosed_mass_numeric(r_pc, *, params, n_steps=128)[source]#
Cusp-regularized, differentiable quadrature without a central cutoff.
Notes
Inputs and units.
r_pcis scalar/array in pc; params is the Zhao physical dictionary.n_stepsis the Gauss-Legendre order per regularized radial segment, an integer >= 8. Orders below 8 raise ValueError. This method has no central cutoff ort_minargument.Returns and shape. Mass in Msun within
min(r_pc, r_t_pc), matching radius shape. Invalid dynamic proposals yield NaN.
- enclosed_mass_betainc(r_pc, *, params)[source]#
Enclosed mass from the Zhao incomplete-beta closed form.
For beta <= 3 (outside the beta domain), or a saturated beta argument, use the regularized numerical integral. Shape autodiff is unsupported on this explicit analytic path; use auto/numeric for inference.
The NFW-limit branch
(alpha,beta,gamma)=(1,3,1)is handled analytically because the raw beta/betainc expression becomes indeterminate there even though the physical enclosed mass remains finite.
- enclosed_mass_analytic(r_pc, *, params)[source]#
Evaluate the Zhao incomplete-beta mass and its domain fallbacks.
Notes
Inputs and units.
r_pcis scalar/array in pc; params is the Zhao physical dictionary. This method delegates toenclosed_mass_betaincand accepts no quadrature settings. Shape-parameter autodiff is not supported here; useenclosed_mass(method="numeric", ...)for it.Returns and shape. Mass in Msun within
min(r_pc, r_t_pc), matching radius shape. Invalid dynamic proposals yield NaN.
- enclosed_mass(r_pc, method='auto', *, params, n_steps=None)#
Return enclosed mass with a selectable analytic/numeric method.
The default
automethod uses each model’s autodiff-safe default: analytic for NFW and numeric for Zhao. Passmethod="analytic"to request a closed form explicitly, ormethod="numeric"for the autodiff-friendly numerical integral.n_stepssets numerical mass resolution (Zhao: Gauss nodes per segment). None uses the model default; analytic methods ignore it.Notes
Inputs and units.
r_pcis scalar/array in pc; params is the physical dictionary.enclosed_massaccepts method=auto/analytic/numeric; numerical methods acceptn_steps.Returns and shape. Mass in Msun within
min(r_pc, r_t_pc), matching radius shape. Invalid dynamic proposals yield NaN.
- property has_analytic_enclosed_mass: bool#
Whether this halo exposes a callable analytic enclosed-mass implementation.
- required_models: Mapping[str, type[jeanspy.model_jax.Model]] = {}#
- resolve_params(params)#
Return the physical parameter mapping unchanged for the generic halo.
Subclasses may add reusable mass coefficients. This base hook performs no validation or copying.
- sampling_identity()#
Model configuration without the derived compilation cache.
- valid_mass_domain(r_pc, *, params)#
Dynamic validity mask; custom profiles may impose stricter domains.
- submodels: Dict[str, jeanspy.model_jax.Model]#