NFWModel#

jeanspy.model.NFWModel

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

Bases: jeanspy.model.DMModel

Spherical NFW halo with a hard density cutoff at r_t_pc.

Parameters are rs_pc and r_t_pc in pc, and rhos_Msunpc3 in Msun/pc^3. Inside the cutoff, rho = rhos / (x*(1+x)**2), x=r/rs. mass_density_3d returns zero for r > r_t_pc and includes the cutoff boundary. The central density diverges. enclosed_mass gives the analytic mass inside min(r, r_t_pc), in Msun. Scalar/array outputs follow the input radius shape.

Scales must be positive, rs and rhos finite; an infinite cutoff is allowed for density/mass at finite radii. Density validates this domain and raises ValueError on invalid values. The elementary mass formula does not uniformly validate inputs. A finite cutoff is required by J-factor methods. jfactor_cone integrates the truncated halo; jfactor_spherical_aperture is an analytic aperture approximation. jfactor_small_angle_infinite_los instead integrates the untruncated LOS profile with a capped projected aperture; it is not the J-factor of this hard-truncated density.

This is a stateful NumPy/SciPy model without JAX differentiation. See examples/docs_profiles.py and examples/docs_factors.py.

enclosed_mass(r_pc)[source]#

Evaluate analytic NFW mass inside a finite spherical radius.

Notes

Inputs and units. r_pc in pc, scalar or NumPy array. Reads the stored NFW scales and cutoff; no numerical-integration option is needed.

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_small_angle_infinite_los(dist_pc, roi_deg=0.5)[source]#

Evaluate the small-angle, infinite-LOS Evans et al. (2016) formula.

This historical approximation caps the projected aperture at r_t_pc; it does not truncate the density along the line of sight. For a halo truncated in three dimensions use jfactor_cone instead.

Notes

Inputs and units. dist_pc in pc and roi_deg in degrees, positive finite broadcastable values; stored NFW scales/cutoff.

Returns and shape. J in GeV^2 cm^-5, with the broadcast input shape; scalar for scalar inputs.

Validity. Small-angle formula: the projected aperture is capped at r_t_pc but the LOS density is untruncated. It is a different integral from the three-dimensionally truncated finite-cone factor.

jfactor_spherical_aperture(dist_pc, roi_deg=0.5)[source]#

Evaluate the NFW spherical-aperture approximation analytically.

The geometric interpretation is the same as DMModel.jfactor_spherical_aperture(): for R_max >= r_t_pc the aperture encloses the full truncated halo and corresponds to the Eq. (B.10) limit; for R_max < r_t_pc it omits projected outer-shell contributions. Use jfactor_cone() for the full finite-ROI geometry.

Notes

Inputs and units. dist_pc is observer distance in pc; roi_deg is cone half-angle in degrees. This NFW analytic override supports mutually broadcastable distances, apertures and model parameters. The inherited full-cone jfactor_cone method requires scalar geometry.

Returns and shape. J in GeV^2 cm^-5, with the broadcast input shape.

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 = 'NFW 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', '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.