DMModel#
jeanspy.model.DMModel
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.DMModel(*args, **kwargs)#
Bases:
jeanspy.model.ModelBase class for NumPy/SciPy dark-matter density profiles.
Notes
Inputs and units. Subclasses supply
mass_density_3d; Jeans solvers also requireenclosed_mass. The base numerical J-factor methods require scalardist_pc,roi_deg(cone half-angle in degrees) andr_t_pc. NFW overrides the spherical-aperture approximation and also supplies an Evans formula; these analytic methods support broadcastable geometry.Returns and shape. Mass in Msun; density in Msun/pc^3; J factor in GeV^2 cm^-5.
Validity. J-factor geometry requires a finite positive
r_t_pcand an external observer for the full cone. The spherical-aperture method omits shells outside the spherical aperture; see the factors guide.Errors. Invalid scales/apertures, divergent cusps or failed adaptive quadrature raise ValueError.
Backend. NumPy/SciPy CPU; stateful components, with no JAX tracing.
Differentiation. No physical-parameter automatic differentiation on this API.
Examples.
examples/docs_factors.py- enclosed_mass(r_pc)[source]#
Return enclosed halo mass in Msun at radius r_pc in pc.
Concrete profiles specify truncation and numerical integration options. Output follows the input radius shape. This optional subclassing interface raises NotImplementedError when mass is unavailable; a density-only custom halo can still be used for J-factor calculations.
- 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)[source]#
Calculate the full finite-ROI Ullio & Valli (2016) J-factor.
Unlike
jfactor_spherical_aperture(), this includes the projected contribution from shells withR_max < r < r_t_pcwhen the ROI is smaller than the truncated halo, following Eqs. (B.8)–(B.9).Notes
Inputs and units.
dist_pcis observer distance in pc;roi_degis cone half-angle in degrees. Distance, aperture and the storedr_t_pcmust 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 configuredsmall_angle_limit_degbound.
- jfactor_spherical_aperture(dist_pc, roi_deg=0.5)[source]#
Calculate the small-angle spherical-aperture approximation.
Let
R_max = dist_pc * sin(roi_deg). This method integrates the spherical luminosity only out tomin(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 boundarymathcal R = r_t_pc. IfR_max < r_t_pc, this is instead a spherical-aperture approximation: projected contributions from shells withR_max < r < r_t_pcare omitted. Usejfactor_cone()for the full finite-ROI geometry of Eqs. (B.8)–(B.9).Notes
Inputs and units.
dist_pcis observer distance in pc;roi_degis cone half-angle in degrees. Distance, aperture and the storedr_t_pcmust 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_degbound.
- abstractmethod mass_density_3d(r_pc)[source]#
Evaluate spherical halo density in Msun/pc^3 at radius r_pc in pc.
This subclassing interface raises NotImplementedError. Concrete profiles specify array shapes, cutoff handling and behavior at a central cusp.
- name = 'DM 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_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.
- 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_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.