示例#1
0
    def Omega(self):
        r"""Return the beam solid angle :math:`\int |A(\boldsymbol{n})|^2 \ d^2\boldsymbol{n}`."""
        nside = 256
        angpos = hputil.ang_positions(nside)
        lat = np.radians(44.15268333) # exact value not important
        lon = np.radians(91.80686667) # exact value not important
        zenith = np.array([0.5*np.pi - lat, lon])
        horizon = visibility.horizon(angpos, zenith)

        pxarea = (4 * np.pi / (12 * nside**2))
        om = np.zeros_like(self.freqs)
        for fi in xrange(len(self.freqs)):
            width = self.width / (const.c / (1.0e9 * self.freqs[fi]))
            beam = cylbeam.beam_amp(angpos, zenith, width, self.fwhm_h, self.fwhm_h)
            om[fi] = np.sum(np.abs(beam)**2 * horizon) * pxarea

        return om
示例#2
0
    def response(self, xyz):
        """Beam response across active band for specified topocentric coordinates.

        This uses the beam model implemented in driftscan package.

        Parameters
        ----------
        xyz : array like, of shape (3, ...)
            Unit direction vector in topocentric coordinates (x=E, y=N, z=UP).
            `xyz` may be arrays of multiple coordinates.


        Returns
        -------
        Returns 'x' linear polarization (rotate pi/2 for 'y') of shape (nfreq, ...).

        """

        xyz = np.array(xyz)

        lat = np.radians(44.15268333) # exact value not important
        lon = np.radians(91.80686667) # exact value not important
        zenith = np.array([0.5*np.pi - lat, lon])

        m = top2eq_m(lat, lon) # conversion matrix
        shp = xyz.shape
        p_eq = np.dot(m, xyz.reshape(3, -1)).reshape(shp) # point_direction in equatorial coord
        p_eq = coord.cart_to_sph(p_eq.T) # to theta, phi

        # cylinder width in wavelength
        width = self.width / (const.c / (1.0e9 * self.freqs))

        nfreq = len(self.freqs)
        resp = np.zeros((nfreq,)+xyz.shape[1:])
        for fi in xrange( nfreq):
            resp[fi] = cylbeam.beam_amp(p_eq, zenith, width[fi], self.fwhm_h, self.fwhm_h)
            # resp[fi] = cylbeam.beam_amp(p_eq, zenith, width[fi], self.fwhm_e, self.fwhm_h) # for X dipole
            # resp[fi] = cylbeam.beam_amp(p_eq, zenith, width[fi], self.fwhm_h, self.fwhm_e) # for Y dipole

        return resp