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.DMModel

Functional JAX Zhao halo with transition, outer and inner slopes.

params requires rs_pc (pc), rhos_Msunpc3 (Msun/pc^3), alpha, beta, gamma and r_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_3d is zero for r > r_t_pc and includes the boundary. enclosed_mass returns 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/numeric use cusp-regularized quadrature with n_steps and support JAX gradients in shape parameters. The explicit analytic (or enclosed_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. See examples/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_pc is 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.

Parameters:
Return type:

jax.Array

enclosed_mass_numeric(r_pc, *, params, n_steps=128)[source]#

Cusp-regularized, differentiable quadrature without a central cutoff.

Notes

Inputs and units. r_pc is scalar/array in pc; params is the Zhao physical dictionary. n_steps is the Gauss-Legendre order per regularized radial segment, an integer >= 8. Orders below 8 raise ValueError. This method has no central cutoff or t_min argument.

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.

Parameters:
Return type:

jax.Array

enclosed_mass_analytic(r_pc, *, params)[source]#

Evaluate the Zhao incomplete-beta mass and its domain fallbacks.

Notes

Inputs and units. r_pc is scalar/array in pc; params is the Zhao physical dictionary. This method delegates to enclosed_mass_betainc and accepts no quadrature settings. Shape-parameter autodiff is not supported here; use enclosed_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.

Parameters:
Return type:

jax.Array

enclosed_mass(r_pc, method='auto', *, params, n_steps=None)#

Return enclosed mass with a selectable analytic/numeric method.

The default auto method uses each model’s autodiff-safe default: analytic for NFW and numeric for Zhao. Pass method="analytic" to request a closed form explicitly, or method="numeric" for the autodiff-friendly numerical integral.

n_steps sets numerical mass resolution (Zhao: Gauss nodes per segment). None uses the model default; analytic methods ignore it.

Notes

Inputs and units. r_pc is scalar/array in pc; params is the physical dictionary. enclosed_mass accepts method=auto/analytic/numeric; numerical methods accept n_steps.

Returns and shape. Mass in Msun within min(r_pc, r_t_pc), matching radius shape. Invalid dynamic proposals yield NaN.

Parameters:
Return type:

jax.Array

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.

Parameters:

params (Mapping[str, Any])

Return type:

Mapping[str, Any]

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]#