tjpcov.covariance_calculator
============================

.. py:module:: tjpcov.covariance_calculator


Classes
-------

.. autoapisummary::

   tjpcov.covariance_calculator.CovarianceCalculator


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

.. py:class:: CovarianceCalculator(config)

   Class for the end user that will compute all covariance terms.

   This will read the configuration file which will contain information of
   what covariances are requested (by giving the Class names) and add all
   their contributions.

   Initialize the class with a config file or dictionary.

   :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


   .. py:attribute:: io


   .. py:attribute:: config


   .. py:attribute:: cov_total
      :value: None



   .. py:attribute:: cov_terms
      :value: None



   .. py:attribute:: cov_classes
      :value: None



   .. py:method:: get_covariance_classes()

      Return a dictionary with the covariance classes initialized.

      :returns: Dictionary with keys the covariance types ('gauss', SSC', ..
                ) and values instances of the corresponding classes.
      :rtype: dict



   .. py:method:: get_covariance()

      Return the covariance with all the contributions added up.

      :returns: Final covariance with all the requested contributions added
                up.
      :rtype: array



   .. py:method:: get_covariance_terms()

      Return a dictionary with the covariance contributions.

      The dictionary has keys the covariace types and values their covariance
      contributions. We add all the contributions for different tracer types
      (e.g. ClxCl + ClxN + NxN). Since they are independent it is easy to
      recover each of them independently.

      :returns: dictionary with keys the covariace types and values their
                covariance contributions.
      :rtype: dict



   .. py:method:: create_sacc_cov(output='cls_cov.fits', save_terms=True)

      Write the sacc file with the total covariance.

      :param output: Filename. This will be joined to the outdir
                     path specified in the configuration file. Default
                     "cls_cov.fits"
      :type output: str, optional
      :param save_terms: If true, save individual files for
                         each of the requested contributions. The will have the
                         covariance term (e.g. gauss) appended to the filename (before
                         the extension, e.g. cls_cov_gauss.fits)
      :type save_terms: bool, optional

      :returns: The final sacc file with the covariance
                matrix included.
      :rtype: :obj:`sacc.sacc.Sacc`



