tjpcov.covariance_fourier_gaussian_nmt
======================================

.. py:module:: tjpcov.covariance_fourier_gaussian_nmt


Classes
-------

.. autoapisummary::

   tjpcov.covariance_fourier_gaussian_nmt.FourierGaussianNmt


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

.. py:class:: FourierGaussianNmt(config)

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


   Class to compute the Gaussian CellxCell covariance with NaMaster.

   This class uses the Narrow Kernel Approximation. It can also use the
   Toeplitz approximation.

   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:: cov_type
      :value: 'gauss'



   .. py:attribute:: mask_files


   .. py:attribute:: mask_names


   .. py:attribute:: binning_info


   .. py:attribute:: nside


   .. py:attribute:: nmt_conf


   .. py:attribute:: cache


   .. py:method:: _compute_all_blocks(**kwargs)

      Compute all the independent covariance blocks.

      :param \*\*kwargs: The arguments to pass to get_covariance_block. See its
                         documentation.

      :returns: List of all the independent covariance blocks.
      :rtype: list



   .. py:method:: get_cl_for_cov(clab, nlab, ma, mb, w, nl_is_cp)

      Computes the coupled Cell that goes into the covariance matrix.

      :param clab: Fiducial Cell for the tracers a and b, used in the
                   covariance estimation
      :type clab: array
      :param nlab: Coupled noise for the tracers a and b
      :type nlab: array
      :param ma: Mask of the field a
      :type ma: array
      :param mb: Mask of the field b
      :type mb: array
      :param w: NmtWorkspace of the
      :type w: :obj:`pymaster.workspaces.NmtWorkspace`
      :param fields a and b nl_is_cp: True if nlab is coupled. False
      :type fields a and b nl_is_cp: bool
      :param otherwise.:

      :returns: Coupled Cell with signal and noise
      :rtype: array



   .. py:method:: get_covariance_block(tracer_comb1, tracer_comb2, use_coupled_noise=True, coupled=False, cache=None, clobber=False)

      Compute a single covariance matrix for a given pair of C_ell.

      If outdir is set, it will save the covariance to a file called
      cov_tr1_tr2_tr3_tr4.npz. This file will be read and its output
      returned if found.

      :param tracer_comb1: List of the pair of tracer names of C_ell^1
      :type tracer_comb1: list
      :param tracer_comb2: List of the pair of tracer names of C_ell^2
      :type tracer_comb2: list
      :param use_coupled_noise: If True, use the coupled noise.
                                Note that if noise is provided via the cache arg, this will
                                be used and assumed to be coupled if this option is True.
                                Defaults to True.
      :type use_coupled_noise: bool, optional
      :param coupled: True to return the coupled Gaussian
                      covariance (default False)
      :type coupled: bool, optional
      :param cache: Dictionary with the corresponding noise, masks,
                    fields, workspaces and covariance workspaces. It accepts noise
                    (keys: 'SN13', 'SN23', 'SN14', 'SN24'), masks (keys: 'm1',
                    'm2', 'm3', 'm4'), fields (keys: 'f1', 'f2', 'f3', 'f4'),
                    workspaces (keys: 'w13', 'w23', 'w14', 'w24', 'w12', 'w34'),
                    the covariance workspace (key: 'cw') and a NmtBin (key:
                    'bins').
      :type cache: dict
      :param clobber: True to recalculate covariance and
                      overwrite cached covariance (default False).  Note this does
                      not erase the cache, or ignore the provided cache.
      :type clobber: bool, optional

      :returns: Gaussian covariance matrix for a pair of C_ell.
      :rtype: array



   .. py:method:: get_covariance_workspace(f1, f2, f3, f4, m1, m2, m3, m4, **kwargs)

      Return the covariance workspace of the fields f1, f2, f3, f4.

      :param f1: Field 1
      :type f1: :obj:`pymaster.field.NmtField`
      :param f2: Field 2
      :type f2: :obj:`pymaster.field.NmtField`
      :param f3: Field 3
      :type f3: :obj:`pymaster.field.NmtField`
      :param f4: Field 4
      :type f4: :obj:`pymaster.field.NmtField`
      :param m1: Mask name assotiated to the field 1
      :type m1: str
      :param m2: Mask name assotiated to the field 2
      :type m2: str
      :param m3: Mask name assotiated to the field 3
      :type m3: str
      :param m4: Mask name assotiated to the field 4
      :type m4: str
      :param \*\*kwargs: Extra arguments to pass to
                         pymaster.compute_coupling_coefficients. In addition, if
                         recompute=True is passed, the cw will be recomputed even if
                         found in the disk.

      :returns: Covariance
                Workspace of the fields f1, f2, f3, f4
      :rtype: :obj:`pymaster.covariance.NmtCovarianceWorkspace`



   .. py:method:: get_fields_dict(tracer_names, cache=None, masks=None, **kwargs)

      Return a dictionary with the fields assotiated to the given tracers.

      :param tracer_names: Dictionary of the tracer names of the same
                           form as mask_name. It has to be given as {1: name1, 2: name2,
                           3: name3, 4: name4}, where 12 and 34 are the pair of tracers
                           that go into the first and second Cell you are computing the
                           covariance for; i.e. <Cell^12 Cell^34>.
      :type tracer_names: dict
      :param cache: Dictionary with cached variables. It will use the
                    cached field if found. The keys must be 'f1', 'f2', 'f3' or
                    'f4' and the values the corresponding NmtFields.
      :type cache: dict
      :param masks: Dictionary of the masks of the fields correlated with
                    keys 1, 2, 3 or 4 and values the loaded masks.
      :type masks: dict
      :param \*\*kwargs: Arguments to pass to NaMaster when computing the
                         field. They will override the ones passed in the configuration
                         file through nmt_conf['f'].

      :returns: Dictionary with the masks assotiated to the fields to be
                correlated.
      :rtype: dict



   .. py:method:: get_list_of_tracers_for_wsp()

      Return the tracers needed to compute the independent workspaces.

      :returns: List of tracers needed to compute the independent
                workspaces.
      :rtype: list of str



   .. py:method:: get_list_of_tracers_for_cov_wsp(remove_trs_wsp=False)

      Return the tracers to compute the independent covariance workspaces.

      :param remove_trs_wsp: If True, remove the tracer
                             combinations from used to generate the workspaces independently
                             (i.e the output of get_list_of_tracers_for_wsp). Defaults to
                             False.
      :type remove_trs_wsp: bool, optional

      :returns: List of tracers needed to compute the independent
                covariance workspaces.
      :rtype: list of str



   .. py:method:: get_list_of_tracers_for_cov_without_trs_wsp_cwsp()

      Return the remaining covariance tracers combinations.

      It will remove the tracer combinations used to compute the workspaces
      and covariance workspaces.

      :returns: List of independent tracers combinations.
      :rtype: list of str



   .. py:method:: get_nell(bins=None, nside=None, cache=None)

      Return the number of ells for the fiducial Cells.

      If the sacc file stored bandpowers are wrong. You will need to pass one
      of the other arguments.

      :param bins: NmtBin instance with the desired
                   binning.
      :type bins: pymaster.NmtBin
      :param nside: Healpy map nside.
      :type nside: int
      :param cache: Dictionary with cached variables. It will use the
                    cached workspaces to read the bandpower windows.
      :type cache: dict

      :returns: Number of ells for the fidicual Cells points; i.e. lmax or
                3*nside
      :rtype: int



   .. py:method:: get_workspace(f1, f2, m1, m2, bins, **kwargs)

      Return the workspace of the fields f1, f2.

      :param f1: Field 1
      :type f1: :obj:`pymaster.field.NmtField`
      :param f2: Field 2
      :type f2: :obj:`pymaster.field.NmtField`
      :param m1: Mask name assotiated to the field 1
      :type m1: str
      :param m2: Mask name assotiated to the field 2
      :type m2: str
      :param bins: NmtBin instance
      :type bins: :obj:`pymaster.bins.NmtBin`
      :param mask_names: Dictionary with tracer names as key and maks
                         names as values.
      :type mask_names: dict
      :param \*\*kwargs: Extra arguments to pass to w.compute_coupling_matrix.
                         In addition, if recompute=True is passed, the cw will be
                         recomputed even if found in the disk.

      :returns: Covariance
                Workspace of the fields f1, f2, f3, f4
      :rtype: :obj:`pymaster.covariance.NmtCovarianceWorkspace`



   .. py:method:: get_workspaces_dict(tracer_names, bins, cache=None, fields=None, masks=None, **kwargs)

      Return a dictionary with the workspaces for the given tracers.

      :param tracer_names: Dictionary of the masks names assotiated to
                           the fields to be correlated. It has to be given as {1: name1,
                           2: name2, 3: name3, 4: name4}, where 12 and 34 are the pair of
                           tracers that go into the first and second Cell you are
                           computing the covariance for; i.e. <Cell^12 Cell^34>.
      :type tracer_names: dict
      :param bins: NmtBin instance with the
      :type bins: :obj:`pymaster.bins.NmtBin`
      :param desired binning.:
      :param cache: Dictionary with cached variables. It will use the
                    cached field if found. The keys must be 'w12', 'w34', 'w13',
                    'w23', 'w14' or 'w24' and the values the corresponding
                    NmtWorkspaces. Alternatively, you can pass a dictionary with
                    keys as (mask_name1, mask_name2).
      :type cache: dict
      :param field: Dictionary of the NmtFields of the fields correlated
                    with keys 1, 2, 3 or 4 and values the NmtFields.
                    masks (dict): Dictionary of the masks of the fields correlated
                    with keys 1, 2, 3 or 4 and values the loaded masks.
      :type field: dict
      :param \*\*kwargs: Arguments to pass to NaMaster when computing the
                         workspace. They will override the ones passed in the
                         configuration file through nmt_conf['w'].

      :returns: Dictionary with the workspaces assotiated to the different
                field combinations needed for the covariance. Its keys are 13, 23,
                14, 24, 12, 34; with values the corresponding
                :obj:`pymaster.workspaces.NmtWorkspaces`.
      :rtype: dict



