ZhaoModel#

jeanspy.model.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.ZhaoModel(*args, **kwargs)#

Bases: jeanspy.model.DMModel

General Zhao profile.

\[\rho(r)=\rho_s (r/r_s)^{-\gamma} [1+(r/r_s)^\alpha]^{-(\beta-\gamma)/\alpha}.\]

Notes

Inputs and units. rs_pc (pc), rhos_Msunpc3 (Msun/pc^3), alpha/beta/gamma (dimensionless transition, outer and inner slopes), r_t_pc (pc). r_pc is scalar or an array in pc; n_steps controls numerical Zhao mass integration.

Returns and shape. mass_density_3d returns Msun/pc^3 with input shape; enclosed_mass returns Msun inside min(r_pc, r_t_pc). Density is zero outside r_t_pc.

Validity. Positive scales and cutoff; Zhao alpha>0 and gamma<3 for finite central mass; finite-radius mass does not require beta>3. Total untruncated mass can diverge. J-factor requires gamma<1.5.

Errors. Invalid Zhao density/mass domains raise ValueError. A valid central cusp can return infinite density. J-factor methods validate geometry and quadrature separately.

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

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

Examples. examples/docs_profiles.py; examples/docs_factors.py

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

Finite-radius Zhao mass for alpha > 0 and gamma < 3, including beta <= 3.

n_steps controls Gauss-Legendre nodes per regularized segment.

Notes

Inputs and units. r_pc in pc, scalar or NumPy array; the Zhao implementation accepts n_steps.

Returns and shape. Msun within min(r_pc,``r_t_pc``), with input shape.

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.

jfactor_cone(dist_pc, roi_deg=0.5)#

Calculate the full finite-ROI Ullio & Valli (2016) J-factor.

Unlike jfactor_spherical_aperture(), this includes the projected contribution from shells with R_max < r < r_t_pc when the ROI is smaller than the truncated halo, following Eqs. (B.8)–(B.9).

Notes

Inputs and units. dist_pc is observer distance in pc; roi_deg is cone half-angle in degrees. Distance, aperture and the stored r_t_pc must all be scalars; array geometry raises ValueError.

Returns and shape. A scalar J in GeV^2 cm^-5.

Validity. Full finite-distance cone; 0<roi_deg``<=90, ``dist_pc>``r_t_pc``. Require a positive finite halo cutoff and a convergent inner cusp. Small-angle variants enforce the configured small_angle_limit_deg bound.

jfactor_spherical_aperture(dist_pc, roi_deg=0.5)#

Calculate the small-angle spherical-aperture approximation.

Let R_max = dist_pc * sin(roi_deg). This method integrates the spherical luminosity only out to min(R_max, r_t_pc).

If R_max >= r_t_pc, the aperture contains the entire truncated halo and this reduces to Ullio & Valli (2016), Eq. (B.10), with the halo boundary mathcal R = r_t_pc. If R_max < r_t_pc, this is instead a spherical-aperture approximation: projected contributions from shells with R_max < r < r_t_pc are omitted. Use jfactor_cone() for the full finite-ROI geometry of Eqs. (B.8)–(B.9).

Notes

Inputs and units. dist_pc is observer distance in pc; roi_deg is cone half-angle in degrees. Distance, aperture and the stored r_t_pc must all be scalars; array geometry raises ValueError.

Returns and shape. A scalar J in GeV^2 cm^-5.

Validity. Small-aperture spherical approximation; outer shells projected into the cone are omitted. Require a positive finite halo cutoff and a convergent inner cusp. Small-angle variants enforce the configured small_angle_limit_deg bound.

mass_density_3d(r_pc)[source]#

Evaluate spherical halo density.

Notes

Inputs and units. r_pc in pc, scalar or NumPy array; reads the model’s stored physical parameters.

Returns and shape. Msun/pc^3 with input shape; zero for r > r_t_pc. The density includes the boundary r = r_t_pc; cusps can diverge at r=0. Invalid physical domains raise ValueError.

name = 'Zhao Model'#
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 = ['rs_pc', 'rhos_Msunpc3', 'alpha', 'beta', 'gamma', 'r_t_pc']#
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.

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.

validate_small_angle(roi_deg)#

Validate cone half-angles for the small-angle J-factor methods.

roi_deg is a scalar or broadcastable array in degrees. Returns None when all values are finite, positive and no larger than small_angle_limit_deg. Otherwise raises ValueError.