Example #1
0
    def compute_coupling_matrix(self,
                                fl1,
                                fl2,
                                bins,
                                ell_cut_x=[1., -1.],
                                ell_cut_y=[1., -1.],
                                is_teb=False):
        """
        Computes coupling matrix associated with the cross-power spectrum of \
        two NmtFieldFlats and an NmtBinFlat binning scheme.

        :param NmtFieldFlat fl1,fl2: fields to correlate
        :param NmtBinFlat bin: binning scheme
        :param float(2) ell_cut_x: remove all modes with ell_x in the \
            interval [ell_cut_x[0],ell_cut_x[1]] from the calculation.
        :param float(2) ell_cut_y: remove all modes with ell_y in the \
            interval [ell_cut_y[0],ell_cut_y[1]] from the calculation.
        :param boolean is_teb: if true, all mode-coupling matrices \
            (0-0,0-2,2-2) will be computed at the same time. In this \
            case, fl1 must be a spin-0 field and fl1 must be spin-2.
        """
        if self.wsp is not None:
            lib.workspace_flat_free(self.wsp)
            self.wsp = None

        self.wsp = lib.comp_coupling_matrix_flat(
            fl1.fl,
            fl2.fl,
            bins.bin,
            ell_cut_x[0],
            ell_cut_x[1],
            ell_cut_y[0],
            ell_cut_y[1],
            int(is_teb),
        )
Example #2
0
    def read_from(self, fname):
        """
        Reads the contents of an NmtWorkspaceFlat object from a FITS file.

        :param str fname: input file name
        """
        if self.wsp is not None:
            lib.workspace_flat_free(self.wsp)
            self.wsp = None
        self.wsp = lib.read_workspace_flat(fname)
Example #3
0
    def read_from(self, fname):
        """
        Reads the contents of an NmtWorkspaceFlat object from a file (encoded using an internal binary format).

        :param str fname: input file name
        """
        if self.wsp is not None:
            lib.workspace_flat_free(self.wsp)
            self.wsp = None
        self.wsp = lib.read_workspace_flat(fname)
Example #4
0
    def compute_coupling_matrix(self,
                                fl1,
                                fl2,
                                bins,
                                ell_cut_x=[1., -1.],
                                ell_cut_y=[1., -1.]):
        """
        Computes coupling matrix associated with the cross-power spectrum of two NmtFieldFlats and an NmtBinFlat binning scheme.

        :param NmtFieldFlat fl1,fl2: fields to correlate
        :param NmtBinFlat bin: binning scheme
        :param float(2) ell_cut_x: remove all modes with ell_x in the interval [ell_cut_x[0],ell_cut_x[1]] from the calculation.
        :param float(2) ell_cut_y: remove all modes with ell_y in the interval [ell_cut_y[0],ell_cut_y[1]] from the calculation.
        """
        if self.wsp is not None:
            lib.workspace_flat_free(self.wsp)
            self.wsp = None

        self.wsp = lib.comp_coupling_matrix_flat(fl1.fl, fl2.fl, bins.bin,
                                                 ell_cut_x[0], ell_cut_x[1],
                                                 ell_cut_y[0], ell_cut_y[1])
Example #5
0
 def __del__(self):
     if self.wsp is not None:
         lib.workspace_flat_free(self.wsp)
         self.wsp = None