DSphModel#
jeanspy.model_jax.DSphModel
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.DSphModel(submodels=None)[source]#
Bases:
jeanspy.model_jax.ModelSpherical JAX Jeans model for LOS variance on fixed quadrature grids.
Compose a tracer whose density_2d/density_3d accept
re_pc, a halo with enclosed_mass, and an anisotropy with consistent beta/f/kernel methods. Physical parameters are supplied explicitly on each call. NumPyro likelihoods and sampling are implemented separately in jeanspy.sampler_numpyro.Notes
Inputs and units. Compose StellarModel, DMModel and AnisotropyModel; params supplies all physical scalars.
R_pcis scalar or nonempty 1-D pc. solver is auto/kernel/abel; jit controls cached compilation.n_u/n_kernelset outer/kernel rules;n_rsets Abel grid;u_maxsets radial extent;dm_mass_n_stepssets mass integration independently.Returns and shape. Always a 1-D array of LOS variances in (km/s)^2, length one for scalar
R_pc.Validity. Finite R>0. Kernel auto selects constant/Osipkov-Merritt; general Baes uses Abel. The published preliminary accuracy envelope is not a universal error bound; refine each new domain.
Errors. Invalid shape/solver/options raise ValueError; invalid dynamic radii or physical values yield NaN.
Backend. JAX arrays on the configured CPU/GPU, with dtype set before import.
Differentiation. Physical parameters on the supported JAX mass/kernel paths; static quadrature and solver choices are not differentiated. Abel-grid boundaries and finite integration extent affect accuracy.
Examples.
examples/docs_jax_spherical.py- Parameters:
submodels (Dict[str, jeanspy.model_jax.Model])
- required_models: Mapping[str, type[jeanspy.model_jax.Model]] = {'AnisotropyModel': <class 'jeanspy.model_jax.AnisotropyModel'>, 'DMModel': <class 'jeanspy.model_jax.DMModel'>, 'StellarModel': <class 'jeanspy.model_jax.StellarModel'>}#
- sigmalos2_kernel(R_pc, *, params, n_u=None, u_max=None, n_kernel=None, kernel_backend='jax', u_min_eps=1e-06, kernel_outer_transform='sqrtlog', dm_mass_method='auto', dm_mass_n_steps=None)[source]#
Kernel-based sigma_los^2(R) implementation.
With u=r/R, this computes
- sigma_los^2(R) = 2 * int_1^infty du
[nu(uR)/Sigma(R)] [G M(uR)] K(u)/u.
kernel_outer_transform='sqrtlog'useslog(u)=x^2. SinceK(u) ~ sqrt(u-1)at the lower endpoint, the transformed integrand is smooth inx.'log'selects a uniform-log(u) grid.The default
sqrtloggrid is tuned to a maximum relative-error target of1e-3on the documented Plummer+NFW dSph stress benchmark. For more extended or otherwise tail-sensitive models, increaseu_maxbefore increasingn_u; then doublen_uto verify convergence.Notes
Inputs and units. Positive
R_pcin pc, scalar or nonempty 1-D array; params contains physical scalars.n_ucontrols the outer rule on 1 <= u <= u_max;n_kernelcontrols numerical inner kernels where applicable.kernel_backendselects jax/scipy for constant anisotropy.dm_mass_n_stepscontrols numerical halo mass integration.Returns and shape. Always a one-dimensional array of variances in (km/s)^2, length one for scalar input.
- sigmalos2_abel(R_pc, *, params, n_r=None, u_max=None, r_min_factor=0.5, dm_mass_method='auto', dm_mass_n_steps=None)[source]#
Compute sigma_los^2(R) via a 1D Jeans solve and two Abel transforms.
Notes
Inputs and units. Positive
R_pcin pc, scalar or nonempty 1-D array; params contains physical scalars.n_rcontrols the logarithmic radial grid;r_min_factorsets its inner radius relative to min(R).u_maxsets the outer radius relative to max(R), enlarged to cover the supplied halo/tracer/anisotropy scales.dm_mass_n_stepscontrols numerical halo mass integration. This route requires a finite grid extent; an explicit infiniter_t_pcproduces nonfinite results.Returns and shape. Always a one-dimensional array of variances in (km/s)^2, length one for scalar input.
- sigmalos2(R_pc, *, params, solver='auto', jit=None, n_u=None, n_r=None, n_kernel=None, u_max=None, kernel_backend='jax', u_min_eps=1e-06, kernel_outer_transform='sqrtlog', r_min_factor=0.5, dm_mass_method='auto', dm_mass_n_steps=None)[source]#
Compute sigma_los^2(R) via the requested solver.
solvermay be'abel','kernel', or'auto'. When set to'auto'the choice is made based on the anisotropy model: Baes –> Abel, constant/Osipkov-Merritt –> kernel (see benchmarks).jitcontrols whether a cachedjax.jitwrapper is used around the selected solver.Nonedefaults to the cached JIT path.R_pc must be a scalar or a nonempty 1-D array. Results are always 1-D (length one for a scalar). Only finite R_pc > 0 are supported; invalid elements return NaN in eager and JIT execution without contaminating other elements. R=0 needs a model-dependent central-limit solver.
dm_mass_methodcontrols the dark-matter enclosed-mass solver and must be one of"auto","analytic", or"numeric". The default"auto"follows the DM model’s autodiff-safe choice: analytic for NFW and numeric for Zhao.dm_mass_n_stepssets the numerical mass resolution independently of the outer Jeans grid. Analytic mass methods ignore this resolution.For the kernel solver, the documented
1e-3accuracy target applies to the sampled Plummer+NFW stress envelope described in the README. Outside that envelope, test convergence by increasingu_maxfirst and then doublingn_u. The Abel solver has a separate radial-grid convergence control,n_r.Notes
Inputs and units. Positive
R_pcin pc, scalar or nonempty 1-D array; params contains physical scalars. Use the signature’s static numerical/solver options;n_uandn_kernelapply to the kernel route,n_rto the Abel grid, anddm_mass_n_stepsto the mass integral.u_maxcontrols the outer radial extent for both solvers.Returns and shape. Always a one-dimensional array of variances in (km/s)^2, length one for scalar input.
- Parameters:
- Return type:
- sampling_identity()#
Model configuration without the derived compilation cache.
- submodels: Dict[str, jeanspy.model_jax.Model]#