def set_pointing(self): """Set the antenna beam to point at (az, alt). """ az, alt, twist = np.radians(self.pointing) lat = np.pi/2 - self.zenith[0] lon = self.zenith[1] saz, caz = np.sin(az), np.cos(az) salt, calt = np.sin(alt), np.cos(alt) slat, clat = np.sin(lat), np.cos(lat) slon, clon = np.sin(lon), np.cos(lon) # matrix to convert vector in topocentric coordinate to equatorial coordinate (x starts from the vernal equinox) top2eq_m = np.array([[-slon, -slat*clon, clat*clon], [ clon, -slat*slon, clat*slon], [ 0, clat, slat]]) p_top = np.array([saz*calt, caz*calt, salt]) # point_direction in topocentric coord p_eq = np.dot(top2eq_m, p_top) # point_direction in equatorial coord self._point_direction = coord.cart_to_sph(p_eq)[-2:]
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