The ``Profile`` base class ========================== All profiles in ``profiley`` inherit from the ``Profile`` base class, which implements numerical calculations of all methods, starting from a ``profile`` method in which the three-dimensional profile is defined. The ``Profile`` base class allows for all profiles to have a common, simple API. See all implemented profiles `here <../index.html>`_. +-------------------------------------------------------------------------------------------------------------+ | Methods defined in this class | +=======================================+=====================================================================+ | ``profile(R)`` | three-dimensional profile | +---------------------------------------+---------------------------------------------------------------------+ | ``cumulative(R)`` | mean value within ``R`` | +---------------------------------------+---------------------------------------------------------------------+ | ``mass_cumulative(R)`` | spherical integral within ``R`` | +---------------------------------------+---------------------------------------------------------------------+ | ``projected(R)`` | Line-of-sight projected profile | +---------------------------------------+---------------------------------------------------------------------+ | ``projected_cumulative(R)`` | Line-of-sight projected cumulative profile | +---------------------------------------+---------------------------------------------------------------------+ | ``projected_excess(R)`` | difference between ``projected_cumulative(R)`` and ``projected(R)`` | +---------------------------------------+---------------------------------------------------------------------+ | ``potential(R)`` | gravitational potential | +---------------------------------------+---------------------------------------------------------------------+ | ``escape_velocity(R)`` | escape velocity | +---------------------------------------+---------------------------------------------------------------------+ | ``mdelta(overdensity, background)`` | mass within a specified overdensity | +---------------------------------------+---------------------------------------------------------------------+ | ``rdelta(overdensity, background)`` | radius enclosing a specified overdensity | +---------------------------------------+---------------------------------------------------------------------+ where ``R`` are the radii at which to return the profiles. Where available, these methods are implemented using the analytical expressions; otherwise they are calculated numerically. Additional arguments absorbed in ``kwargs`` relate to the precision (and speed) of numerical integration. See below. .. numerical: Numerical calculations ++++++++++++++++++++++ If any of the above methods are not defined analytically, they are calculated by numerical integration, using ``scipy.integrate.simps``. Cumulative profile ------------------ Mean value of the profile within the specified radius: .. math:: \bar\rho(R) = \frac{\int_{V(`_ will be as follows: +-----------------+----------------------+ | ``R.shape`` | profile shape | +=================+======================+ | ``(25,)`` | ``(25,12,7,5)`` | +-----------------+----------------------+ | ``(25,100)`` | ``(25,100,12,7,5)`` | +-----------------+----------------------+ | ``(25,12)`` | ``(25,12,7,5)`` | +-----------------+----------------------+ | ``(25,12,7)`` | ``(25,12,7,5)`` | +-----------------+----------------------+ | ``(25,12,7,5)`` | ``(25,12,7,5)`` | +-----------------+----------------------+ | ``(25,1,7)`` | ``(25,12,7,5)`` | +-----------------+----------------------+ | ``(25,12,5)`` | ``(25,12,5,12,7,5)`` | +-----------------+----------------------+ Etc. That is, if the last N dimensions of ``R`` match the first N dimensions of ``p`` (considering empty dimensions appropriately), they will be assumed to correspond to each set of profiles. Exceptional situations, e.g., when the number of radial elements (or the last dimension) is equal to the first element of ``p.shape`` but it is not meant to represent one radial vector per profile, will not behave as expected. Such fringe cases must be appropriately handled by the user, but should generally be avoided. .. inheritance: Inheritance +++++++++++ What follows are the descriptions of helper classes from which ``Profile`` inherits. These classes are not to be instantiated directly, but the description of attributes and methods defined within these classes is separated for clarity. .. cosmology: ``BaseCosmo``: Cosmology ------------------------ The cosmology in which a ``Profile`` object is embedded is specified through the ``cosmo`` optional argument, which must be any ``astropy.cosmology.FLRW`` object. This allows for the definition of the background density as well as calculations of distances detailed below. +------------------------------------------------------------------------------------------------------------------------+ | Optional arguments inherited from this class | +================+===============================+=======================================================================+ | ``background`` | ``{'c','m'}`` | Whether overdensities are defined w.r.t. the critical or mean density | +----------------+-------------------------------+-----------------------------------------------------------------------+ | ``cosmo`` | ``astropy.cosmology.FLRW`` | Cosmology (default: ``Planck15``) | +----------------+-------------------------------+-----------------------------------------------------------------------+ | ``frame`` | ``{'comoving','physical'}`` | Whether to work in comoving or physical coordinates | +----------------+-------------------------------+-----------------------------------------------------------------------+ +---------------------------------------------------------------------------------------------------------------------------------------------+ | Attributes inherited from this class | +======================+================+=====================================================================================================+ | ``critical_density`` | ``np.ndarray`` | critical density of the universe at all supplied redshifts | +----------------------+----------------+-----------------------------------------------------------------------------------------------------+ | ``mean_density`` | ``np.ndarray`` | mean density of the universe at all supplied redshifts | +----------------------+----------------+-----------------------------------------------------------------------------------------------------+ | ``rho_bg`` | ``np.ndarray`` | alias for either ``critical_density`` or ``mean_density`` depending on the ``background`` attribute | +----------------------+----------------+-----------------------------------------------------------------------------------------------------+ .. _lensing: ``Lens``: Gravitational lensing functionality --------------------------------------------- The ``Profile`` class inherits from the ``Lens`` helper class, which implements quantities relevant for gravitational lensing analysis. +--------------------------------------------------------------------------------------+ | Attributes inherited from this class | +=========+===========+================================================================+ | ``Dl`` | ``float`` | angular diameter distance from observer to lens object, in Mpc | +---------+-----------+----------------------------------------------------------------+ +-----------------------------------------------------------------------------------------------+ | Methods inherited from this class | +=======================================+=======================================================+ | ``Dls(z_s)`` | angular diameter distance from lens to source, in Mpc | +---------------------------------------+-------------------------------------------------------+ | ``Dls_over_Ds(z_s)`` | :math:`\max(0, D_\mathrm{ls}/D_\mathrm{s})` | +---------------------------------------+-------------------------------------------------------+ | ``convergence(R, z_s)`` | lensing convergence | +---------------------------------------+-------------------------------------------------------+ | ``offset_convergence(R, R_off, z_s)`` | offset lensing convergence | +---------------------------------------+-------------------------------------------------------+ | ``sigma_crit(z_s)`` | critical surface density | +---------------------------------------+-------------------------------------------------------+ In all these methods, ``z_s`` is the source redshift. .. include:: ../../github-links.rst