def _beam_map_single(self, bl_index, f_index): p_stokes = [ 0.5 * np.array([[1.0, 0.0], [0.0, 1.0]]), 0.5 * np.array([[1.0, 0.0], [0.0, -1.0]]), 0.5 * np.array([[0.0, 1.0], [1.0, 0.0]]), 0.5 * np.array([[0.0, -1.0J], [1.0J, 0.0]]) ] # Get beam maps for each feed. feedi, feedj = self.uniquepairs[bl_index] beami, beamj = self.beam(feedi, f_index), self.beam(feedj, f_index) # Get baseline separation and fringe map. uv = self.baselines[bl_index] / self.wavelengths[f_index] fringe = visibility.fringe(self._angpos, self.zenith, uv) pow_stokes = [ np.sum(beami * np.dot(beamj.conjugate(), polproj), axis=1) * self._horizon for polproj in p_stokes] # Calculate the solid angle of each beam pxarea = (4*np.pi / beami.shape[0]) om_i = np.sum(np.abs(beami)**2 * self._horizon[:, np.newaxis]) * pxarea om_j = np.sum(np.abs(beamj)**2 * self._horizon[:, np.newaxis]) * pxarea omega_A = (om_i * om_j)**0.5 # Calculate the complex visibility transfer function cv_stokes = [ p * (2 * fringe / omega_A) for p in pow_stokes ] return cv_stokes
def _beam_map_single(self, bl_index, f_index): p_stokes = [ 0.5 * np.array([[1.0, 0.0], [0.0, 1.0]]), 0.5 * np.array([[1.0, 0.0], [0.0, -1.0]]), 0.5 * np.array([[0.0, 1.0], [1.0, 0.0]]), 0.5 * np.array([[0.0, -1.0J], [1.0J, 0.0]]) ] # Get beam maps for each feed. feedi, feedj = self.uniquepairs[bl_index] beami, beamj = self.beam(feedi, f_index), self.beam(feedj, f_index) # Get baseline separation and fringe map. uv = self.baselines[bl_index] / self.wavelengths[f_index] fringe = visibility.fringe(self._angpos, self.zenith, uv) pow_stokes = [ np.sum(beami * np.dot(beamj.conjugate(), polproj), axis=1) * self._horizon for polproj in p_stokes ] # Calculate the solid angle of each beam pxarea = (4 * np.pi / beami.shape[0]) om_i = np.sum(np.abs(beami)**2 * self._horizon[:, np.newaxis]) * pxarea om_j = np.sum(np.abs(beamj)**2 * self._horizon[:, np.newaxis]) * pxarea omega_A = (om_i * om_j)**0.5 # Calculate the complex visibility transfer function cv_stokes = [p * (2 * fringe / omega_A) for p in pow_stokes] return cv_stokes
def _beam_map_single(self, bl_index, f_index): # Get beam maps for each feed. feedi, feedj = self.uniquepairs[bl_index] beami, beamj = self.beam(feedi, f_index), self.beam(feedj, f_index) # Get baseline separation and fringe map. uv = self.baselines[bl_index] / self.wavelengths[f_index] fringe = visibility.fringe(self._angpos, self.zenith, uv) # Beam solid angle (integrate over beam^2 - equal area pixels) omega_A = (np.abs(beami) * np.abs(beamj) * self._horizon).sum() * (4*np.pi / beami.size) # Calculate the complex visibility cvis = self._horizon * fringe * beami * beamj / omega_A return cvis
def _beam_map_single(self, bl_index, f_index): # Get beam maps for each feed. feedi, feedj = self.uniquepairs[bl_index] beami, beamj = self.beam(feedi, f_index), self.beam(feedj, f_index) # Get baseline separation and fringe map. uv = self.baselines[bl_index] / self.wavelengths[f_index] fringe = visibility.fringe(self._angpos, self.zenith, uv) pxarea = (4 * np.pi / beami.shape[0]) # Beam solid angle (integrate over beam^2 - equal area pixels) om_i = np.sum(np.abs(beami)**2 * self._horizon) * pxarea om_j = np.sum(np.abs(beamj)**2 * self._horizon) * pxarea omega_A = (om_i * om_j)**0.5 # Calculate the complex visibility transfer function cvis = self._horizon * fringe * beami * beamj.conjugate() / omega_A return cvis
nside = args.nside cyl._init_trans(nside) angpos = cyl._angpos horizon = cyl._horizon wavelength = cyl.wavelengths[1] # central wavelength, corresponding to args.freq Nbl = len(cyl.baselines) # number of baselines enu = 0.0 # for (n, bi) in zip(cyl.redundancy, range(Nbl)): for bi in mpiutil.mpirange(Nbl): n = cyl.redundancy[bi] if args.primary_beam: enu += n * np.array(cyl._beam_map_single(bi, (cyl.num_freq - 1)/2)) else: uv = cyl.baselines[bi] / wavelength fringe = visibility.fringe(angpos, cyl.zenith, uv) if args.mask_horizon: enu += n * fringe * horizon else: enu += n * fringe enus = np.zeros_like(enu) MPI.COMM_WORLD.Reduce(enu, enus, op=MPI.SUM, root=0) if args.outfile is not None: outenus = 'enus_' + args.outfile outpalms = 'palms_' + args.out_file else: if args.primary_beam: outenus = 'enus_%d_%.1f_%.1f_%.1f_%s_case%d_%s.hdf5' % (args.nside, args.freq, args.lat, args.lon, args.auto_corr, args.case, 'p') outpalms = 'palms_%d_%.1f_%.1f_%.1f_%s_case%d_%s.hdf5' % (args.nside, args.freq, args.lat, args.lon, args.auto_corr, args.case, 'p')