tjpcov.covariance_cluster_counts
================================

.. py:module:: tjpcov.covariance_cluster_counts


Classes
-------

.. autoapisummary::

   tjpcov.covariance_cluster_counts.CovarianceClusterCounts


Module Contents
---------------

.. py:class:: CovarianceClusterCounts(config, min_halo_mass=10000000000000.0)

   Bases: :py:obj:`tjpcov.covariance_builder.CovarianceBuilder`


   Class to calculate covariance of cluster counts.

   Class to calculate covariance of cluster counts.

   :param config: If dict, it returns the configuration
                  dictionary directly. If string, it asumes a YAML file and
                  parses it.
   :type config: dict or str
   :param min_halo_mass: Minimum halo mass.
   :type min_halo_mass: float, optional


   .. py:attribute:: space_type
      :value: 'Fourier'



   .. py:attribute:: _tracer_types


   .. py:attribute:: hbias


   .. py:attribute:: h0


   .. py:attribute:: fft_helper


   .. py:attribute:: has_mproxy


   .. py:attribute:: covariance_block_data_type


   .. py:method:: load_from_cosmology(cosmo)

      Load parameters from a CCL cosmology object.

      Derived attributes from the cosmology are set here.

      :param cosmo: Input cosmology
      :type cosmo: :obj:`pyccl.Cosmology`



   .. py:method:: load_from_sacc(sacc_file, min_halo_mass)

      Set class attributes based on data from the SACC file.

      Cluster covariance has special parameters set in the SACC file. This
      informs the code that the data to calculate the cluster covariance is
      there.  We set extract those values from the sacc file here, and set
      the attributes here.

      :param sacc_file (: obj: `sacc.sacc.Sacc`): SACC file object, already
      :param loaded.:



   .. py:method:: _quad_integrate(argument, from_lim, to_lim)

      Numerically integrate argument between bounds using scipy quad.

      :param argument: Function to integrate between bounds
      :type argument: callable
      :param from_lim: lower limit
      :type from_lim: float
      :param to_lim: upper limit
      :type to_lim: float

      :returns: Value of the integral
      :rtype: float



   .. py:method:: _romb_integrate(kernel, spacing)

      Numerically integrate arguments between bounds using scipy romberg.

      :param kernel: Vector of equally spaced samples of a function
      :type kernel: array_like
      :param spacing: Sample spacing
      :type spacing: float

      :returns: Value of the integral
      :rtype: float



   .. py:method:: observed_photo_z(z_true, z_i, sigma_0=0.05)

      Implementation of the photometric redshift uncertainty distribution.

      We don't assume that redshift can be measured exactly, so we include
      a measurement of the uncertainty around photometric redshifts. Assume,
      given a true redshift z, the measured redshift will be gaussian. The
      uncertainty will increase with redshift bin.

      See section 2.3 of N. Ferreira

      :param z_true: True redshift
      :type z_true: float
      :param z_i: Photometric redshift bin index
      :type z_i: float
      :param sigma_0: Spread in the uncertainty of the photo-z
                      distribution, defaults to 0.05 (DES Y1)
      :type sigma_0: float

      :returns: Probability weighted photo-z
      :rtype: float



   .. py:method:: comoving_volume_element(z_true, z_i)

      Calculates the volume element for this bin.

      Given a true redshift, and a redshift bin, this will give the
      volume element for this bin including photo-z uncertainties.

      :param z_true: True redshift
      :type z_true: float
      :param z_i: Photometric redshift bin
      :type z_i: float

      :returns: Photo-z-weighted comoving volume element per steridian
                for redshift bin i in units of Mpc^3
      :rtype: float



   .. py:method:: mass_richness(ln_true_mass, richness_i)

      Log-normal mass-richness relation without observational scatter.

      The probability that we observe richness given the true mass M, is
      given by the convolution of a Poisson distribution (relating observed
      richness to true richness) with a Gaussian distribution (relating true
      richness to M). Such convolution can be translated into a parametrized
      log-normal mass-richness distribution, done so here.

      :param ln_true_mass: True mass
      :type ln_true_mass: float
      :param richness_bin: Richness bin i
      :type richness_bin: int

      :returns: The probability that the true mass ln(ln_true_mass)
                is observed within the richness bin i and richness bin i+1
      :rtype: float



   .. py:method:: mass_richness_integral(z, richness_i, remove_bias=False)

      Integrates the HMF weighted by mass-richness relation.

      The halo mass function weighted by the probability that we measure
      observed richness lambda given true mass M.

      :param z: Redshift
      :type z: float
      :param lbd_i: Richness bin
      :type lbd_i: int
      :param remove_bias: If TRUE, will remove halo_bias from
      :type remove_bias: bool, optional
      :param the mass integral. Used for calculating the shot noise.:

      :returns: The mass-richness weighed derivative of number density per
                fluctuation in background
      :rtype: float



   .. py:method:: partial_SSC(z, bin_z_j, bin_lbd_j, approx=True)

      Calculate the SSC contribution to the covariance integrand.

      Calculate part of the super sample covariance, or the non-diagonal
      correlation between two point functions whose observed modes are larger
      than the survey size.

      :param z: redshift
      :type z: float
      :param bin_z_j: redshift bin j
      :type bin_z_j: int
      :param bin_lbd_j: richness bin j
      :type bin_lbd_j: int
      :param approx: Will only calculate the mass richness
      :type approx: bool, optional
      :param integral once and multiply at end. Defaults to True.:

      :returns: SSC covariance contribution.
      :rtype: float



   .. py:method:: double_bessel_integral(z1, z2)

      Calculates the double bessel integral using 2-FAST algorithm.

      See section 7.1, 7.2 of N. Ferreira dissertation.

      :param z1: redshift lower bound
      :type z1: float
      :param z2: redshift upper bound
      :type z2: float

      :returns: Numerical approximation of integral.
      :rtype: float



