Beispiel #1
0
    def power(self, k, mu, flatten=False):
        """
        The redshift space power spectrum as a function of ``k`` and ``mu``

        This includes terms up to ``mu**self.max_mu``.

        Parameters
        ----------
        k : float or array_like
            The wavenumbers in `h/Mpc` to evaluate the model at
        mu : float, array_like
            The mu values to evaluate the power at.

        Returns
        -------
        pkmu : float, array_like
            The power model P(k, mu). If `mu` is a scalar, return dimensions
            are `(len(self.k), )`. If `mu` has dimensions (N, ), the return
            dimensions are `(len(k), N)`, i.e., each column corresponds is the
            model evaluated at different `mu` values. If `flatten = True`, then
            the returned array is raveled, with dimensions of `(N*len(self.k), )`
        """
        # the return array
        pkmu = self._power(k, mu)

        if flatten:
            pkmu = np.ravel(pkmu, order='F')

        return pkmu
Beispiel #2
0
    def power(self, k, mu, flatten=False):
        """
        Return the redshift space power spectrum at the specified value of mu,
        including terms up to ``mu**self.max_mu``.

        Parameters
        ----------
        k : float or array_like
            The wavenumbers in `h/Mpc` to evaluate the model at
        mu : float, array_like
            The mu values to evaluate the power at.

        Returns
        -------
        pkmu : float, array_like
            The power model P(k, mu). If `mu` is a scalar, return dimensions
            are `(len(self.k), )`. If `mu` has dimensions (N, ), the return
            dimensions are `(len(k), N)`, i.e., each column corresponds is the
            model evaluated at different `mu` values. If `flatten = True`, then
            the returned array is raveled, with dimensions of `(N*len(self.k), )`
        """
        # the linear kaiser P(k,mu)
        pkmu = super(QuasarSpectrum, self).power(k, mu)

        # add FOG damping
        G = self.FOG(k, mu, self.sigma_fog)
        pkmu *= G**2

        # add shot noise offset
        pkmu += self.N

        if flatten:
            pkmu = np.ravel(pkmu, order='F')
        return pkmu
Beispiel #3
0
    def power(self, k, mu, flatten=False):
        """
        The total redshift-space galaxy power spectrum at ``k`` and ``mu``

        Parameters
        ----------
        k : float, array_like
            The wavenumbers to evaluate the power spectrum at, in `h/Mpc`
        mu : float, array_like
            The cosine of the angle from the line of sight. If a float is provided,
            the value is used for all input `k` values. If array-like and `mu` has
            the same shape as `k`, the power at each (k,mu) pair is returned. If
            `mu` has a shape different than `k`, the returned power has shape
            ``(len(k), len(mu))``.
        flatten : bool, optional
            If `True`, flatten the return array, which will have a length of
            `len(k) * len(mu)`
        """
        toret = self._Pgal(k, mu)
        return toret if not flatten else np.ravel(toret, order='F')
Beispiel #4
0
 def Pgal_ss(self, k, mu, flatten=False):
     """
     The auto power spectrum of all satellites
     """
     toret = self._Pgal['Pss'](k, mu)
     return toret if not flatten else np.ravel(toret, order='F')
Beispiel #5
0
 def Pgal_sAsB(self, k, mu, flatten=False):
     """
     The cross power spectrum of type A and type B satellites
     """
     toret = self._Pgal['Pss']['PsAsB'](k, mu)
     return toret if not flatten else np.ravel(toret, order='F')
Beispiel #6
0
 def Pgal_cs(self, k, mu, flatten=False):
     """
     The cross power spectrum of centrals and satellites
     """
     toret = self._Pgal['Pcs'](k, mu)
     return toret if not flatten else np.ravel(toret, order='F')
Beispiel #7
0
 def Pgal_cBsB(self, k, mu, flatten=False):
     """
     The cross power spectrum of type B centrals and type B sats
     """
     toret = self._Pgal['Pcs']['PcBsB'](k, mu)
     return toret if not flatten else np.ravel(toret, order='F')
Beispiel #8
0
 def Pgal_cc(self, k, mu, flatten=False):
     """
     The auto power spectrum of all centrals
     """
     toret = self._Pgal['Pcc'](k, mu)
     return toret if not flatten else np.ravel(toret, order='F')