SersicModel#
jeanspy.model.SersicModel
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.SersicModel(*args, deprojection_method='auto', **kwargs)#
Bases:
jeanspy.model.StellarModelProjected Sérsic stellar model with selectable 3-D deprojection.
The numerical Abel inversion is the reference implementation. Fast approximations remain explicitly selectable, while
"auto"uses the Vitral & Mamon (2021) hybrid where supported and falls back to the numerical reference outside the approximation domain.Notes
Inputs and units.
re_pcis projected half-light radius (pc); n is dimensionless Sersic index;deprojection_methodis auto/lgm/vm20/vm20bis/numerical. Other constructor arguments follow Model.Returns and shape.
density_2danddensity_3dreturn pc^-2 and pc^-3 with input shape.cdf_Rreturns the dimensionless projected radial CDF;half_light_radiusreturns pc.mean_density_2dis mean surface density within R.density_2d_normalized_reis the dimensionless ratio Sigma(R)/Sigma(re).Validity. Supply positive finite scales and real nonnegative radii. Use NumPy arrays for array inputs. A central cusp may diverge at zero. The older elementary density formulas do not uniformly validate domains. The bundled
b_ninterpolator covers n from about 0.02 to 15.17; numerical deprojection does not remove that table limit. VM20 and VM20bis have the stricter n/r domains specified by their methods.Errors. Unknown parameter names raise ValueError in Model.update. Invalid values in elementary profile formulas can produce NaN/inf; successful construction alone does not validate a physical profile.
Backend. NumPy/SciPy CPU; stateful components, with no JAX tracing.
Differentiation. No physical-parameter automatic differentiation on this API.
Examples.
examples/docs_profiles.py- Parameters:
deprojection_method (str)
- property b#
Return the dimensionless Sersic b_n from the bundled interpolation table.
The supported n domain is the table range stated in the class contract.
- property b_CB#
Ciotti & Bertin (1999) approximation to the Sérsic
b_n.
- property b_linear#
Return the linear approximation b_n = 2*n - 0.324.
This helper does not impose a validity interval and is not the tabulated b_n used by the normalized surface-density formula.
- cdf_R(R_pc)[source]#
Return \(\int_0^R 2\pi R'\Sigma(R')\,dR'\).
Notes
Inputs and units.
R_pcis a scalar or NumPy array of projected radii in pc.Returns and shape. Dimensionless cumulative probability with input radius shape.
- density(distance_from_center, dimension)#
Dispatch to the projected or intrinsic normalized tracer density.
distance_from_centeris a radius in pc.dimensionmust be ‘2d’ or ‘3d’, returning pc^-2 or pc^-3 respectively with the concrete profile’s input shape. An unsupported dimension raises ValueError.
- density_2d(R_pc)[source]#
Evaluate normalized projected tracer density.
Notes
Inputs and units.
R_pcis a scalar or NumPy array of projected radii in pc.Returns and shape. pc^-2 with input radius shape.
- density_2d_normalized_re(R_pc)[source]#
Return the dimensionless projected density ratio Sigma(R)/Sigma(re).
R_pc is a scalar or NumPy array in pc; output follows its shape. The stored re_pc and n must lie in the supported positive domain.
- density_2d_truncated(R_pc, R_trunc_pc)#
Return the normalized 2-D density truncated at
R_trunc_pc.The normalization satisfies
\[\int_0^{R_\mathrm{trunc}} 2\pi R\,\Sigma_\mathrm{trunc}(R)\,dR = 1.\]Notes
Inputs and units.
R_pcis a nonnegative finite scalar/array in pc;R_trunc_pcis a positive finite scalar cutoff in pc.Returns and shape. Normalized surface density in pc^-2 with radius shape, zero for R>``R_trunc_pc``.
Validity. Requires a concrete
density_2dandcdf_Rwith positive CDF at the cutoff.
- density_3d(r_pc, method=None)[source]#
Return the 3-D density using the requested deprojection method.
Notes
Inputs and units.
r_pcis a scalar or NumPy array of intrinsic radii in pc. method is auto/lgm/vm20/vm20bis/numerical; None uses the constructor selection.lgmis the Lima Neto–Gerbal–Márquez approximation (0.5 <= n <= 10), with normalizationlgm_norm_3d.Returns and shape. pc^-3 with input radius shape.
- Parameters:
method (str | None)
- density_3d_LGM(r_pc)[source]#
Lima Neto–Gerbal–Márquez Sérsic deprojection.
Notes
Inputs and units.
r_pcis scalar or an array in pc; n andre_pccome from stored parameters.Returns and shape. Unit-integral tracer density in pc^-3 with input shape.
Validity. Requires 0.5 <= n <= 10 (otherwise ValueError). This approximate deprojection is not a general central-limit formula.
- density_3d_VM20(r_pc)[source]#
Vitral & Mamon (2020) 3-D Sérsic density approximation.
Notes
Inputs and units.
r_pcis scalar or an array in pc; n andre_pccome from stored parameters.Returns and shape. Unit-integral tracer density in pc^-3 with input shape.
Validity. 0.5<=n<=10; 1e-3<=r/re<=1e3; positive finite r.
- density_3d_VM20bis(r_pc)[source]#
Official Vitral & Mamon (2021) VM20bis density approximation.
Notes
Inputs and units.
r_pcis scalar or an array in pc; n andre_pccome from stored parameters.Returns and shape. Unit-integral tracer density in pc^-3 with input shape.
Validity. 0.5<=n<=3.4; 1e-4<=r/re<=1e3; positive finite r.
- density_3d_auto(r_pc)[source]#
Safely choose a fast literature approximation or numerical Abel.
Notes
Inputs and units.
r_pcis scalar or an array in pc; n andre_pccome from stored parameters.Returns and shape. Unit-integral tracer density in pc^-3 with input shape.
Validity. Uses VM20bis, SP04 or numerical Abel inversion according to the documented n/r domain.
- density_3d_numerical(r_pc, *, epsrel=1e-06, epsabs=0.0, limit=200)[source]#
Deproject the Sérsic surface density by numerical Abel inversion.
Notes
Inputs and units. Nonnegative
r_pcin pc; epsrel/epsabs are adaptive-integral tolerances; limit is the subdivision limit.Returns and shape. pc^-3 with radius shape; infinity at r=0 for n>=1, a finite analytic center for n<1, zero at +infinity.
Validity. Positive finite
re_pcand supported interpolation-table n. At r>0 integrate over theta in [0,pi/2].Errors. Negative/NaN radii raise ValueError; SciPy convergence warnings can propagate. The returned value is not accompanied by a certified deprojection error.
- half_light_radius()[source]#
Return the projected half-light radius.
Notes
Inputs and units. No arguments; reads the stored tracer scales.
Returns and shape. Scalar radius in pc, equal to the stored
re_pc.
- 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.
- property lgm_norm_3d#
Return the LGM approximate deprojection normalization in pc^3.
Uses the stored n, re_pc, b_CB and p_LGM. This is the LGM approximation normalization, not the numerical Abel-deprojection normalization.
- mean_density_2d(R_pc)[source]#
Average surface density inside a circular aperture.
Notes
Inputs and units. Positive projected radius
R_pcin pc, scalar or NumPy array.Returns and shape.
cdf_R(R)/(pi*R**2), in pc^-2 with radius shape.Validity. Use R>0; the elementary ratio is not a numerically regularized central limit.
- name = 'SersicModel'#
- property norm#
Return the projected Sersic normalization in pc^2 for stored n and re_pc.
- property p_LGM#
Return the dimensionless LGM approximate deprojection exponent for stored n.
- 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.
- required_models = {}#
- required_param_names = ['re_pc', 'n']#
- 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.