From 6c4b5bf9efe03e85e102d9fb4aa1c4c30288fd2b Mon Sep 17 00:00:00 2001 From: Zhilei Xu Date: Wed, 23 Nov 2022 16:20:40 -0500 Subject: [PATCH] Cleanup. --- src/direct_optimal_mapping/dom_pspec.py | 4 +--- src/direct_optimal_mapping/image_cube_compilation.py | 6 ------ .../optimal_mapping_radec_grid.py | 10 +--------- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/direct_optimal_mapping/dom_pspec.py b/src/direct_optimal_mapping/dom_pspec.py index 9510f64..5ce0a10 100644 --- a/src/direct_optimal_mapping/dom_pspec.py +++ b/src/direct_optimal_mapping/dom_pspec.py @@ -111,8 +111,6 @@ def set_k_space(self, binning='lin', n_perp=None): self.ky = np.fft.fftfreq(self.ny, d=self.res_y_mpch)*2*np.pi self.kz = np.fft.fftfreq(self.nz, d=self.res_z_mpch)*2*np.pi -# self.k_xx, self.k_yy, self.k_zz = np.meshgrid(self.kx, self.ky, self.kz, indexing='ij') - self.k_zz, self.k_xx, self.k_yy = np.meshgrid(self.kz, self.kx, self.ky, indexing='ij') self.k_perp = np.sqrt(np.average(self.k_xx, axis=0)**2 + @@ -174,4 +172,4 @@ def calc_ps1d(self, nbin=None, avoid_fg=True): self.ps1d_nsample = np.array(n_sample) return - \ No newline at end of file + diff --git a/src/direct_optimal_mapping/image_cube_compilation.py b/src/direct_optimal_mapping/image_cube_compilation.py index 4bb85b0..a62b683 100644 --- a/src/direct_optimal_mapping/image_cube_compilation.py +++ b/src/direct_optimal_mapping/image_cube_compilation.py @@ -33,16 +33,12 @@ def image_cube_calc(self): map_dic_n6 = pickle.load(f_t) freq_mhz = float(re.search('_(......)MHz', file_n5_t).group(1)) -# idx_t = np.where(freq_mhz == self.syn_sa_dic['freq_mhz'])[0] -# syn_sa = self.syn_sa_dic['sa'][idx_t] syn_sa = self.sa_interp(freq_mhz) print(i, freq_mhz, 'MHz', end=',') # normalization d calculation d_diag = 1/(map_dic_n5['beam_weight_sum'] * map_dic_n5['px_dic']['sa_sr'].flatten()) # vis -> Jy/beam d_diag = d_diag/syn_sa # Jy/beam -> Jy/sr -# d_diag = d_diag/map_dic_n5['px_dic']['sa_sr'].flatten() # Jy/beam -> Jy/sr -# print(self.syn_sa_dic['sa'][i], map_dic_n5['px_dic']['sa_sr']) jysr2mk = 1e-26*const.c**2/2/(1e6*freq_mhz)**2/const.k_B*1e3 d_diag = d_diag * jysr2mk # Jy/sr -> mK @@ -62,8 +58,6 @@ def image_cube_calc(self): self.d_diag = np.vstack((self.d_diag, d_diag)) img_cube_n5 = img_cube_n5.squeeze().reshape(((-1, *map_dic_n5['px_dic']['ra_deg'].shape))) img_cube_n6 = img_cube_n6.squeeze().reshape(((-1, *map_dic_n6['px_dic']['ra_deg'].shape))) -# img_cube_n5 = np.moveaxis(img_cube_n5, 0, -1) -# img_cube_n6 = np.moveaxis(img_cube_n6, 0, -1) data_dic['data_cube_pol-5'] = img_cube_n5 data_dic['data_cube_pol-6'] = img_cube_n6 diff --git a/src/direct_optimal_mapping/optimal_mapping_radec_grid.py b/src/direct_optimal_mapping/optimal_mapping_radec_grid.py index ab70451..c36c108 100644 --- a/src/direct_optimal_mapping/optimal_mapping_radec_grid.py +++ b/src/direct_optimal_mapping/optimal_mapping_radec_grid.py @@ -114,8 +114,6 @@ def __init__(self, uv, px_dic, epoch='J2000', feed=None, height=uv.telescope_location_lat_lon_alt_degrees[2]*u.m) self.uv = uv -# self.nside = nside -# self.npix = hp.nside2npix(nside) self.hera_dec = self.uv.telescope_location_lat_lon_alt[0] self.lsts = np.unique(self.uv.lst_array) self.times = np.unique(uv.time_array) @@ -128,9 +126,7 @@ def __init__(self, uv, px_dic, epoch='J2000', feed=None, self.feed_type = 'vivaldi' else: self.feed_type = feed - #print('RA/DEC in the epoch of %s, with %s beam used.'%(self.equinox, self.feed_type)) -# theta, phi = hp.pix2ang(nside, range(self.npix)) self.ra = np.radians(px_dic['ra_deg']).flatten() self.dec = np.radians(px_dic['dec_deg']).flatten() self.px_sa = px_dic['sa_sr'].flatten() @@ -174,8 +170,6 @@ def _radec2azalt(self, ra, dec, time): aa = AltAz(location=self.hera_site, obstime=obs_time) if self.equinox == 'J2000': c = SkyCoord(ra=ra, dec=dec, unit='radian', frame=TETE(obstime=self.equinox)) - #c = SkyCoord(ra=ra, dec=dec, unit='radian', frame='icrs') - #print('ICRS') elif self.equinox == 'Current': c = SkyCoord(ra=ra, dec=dec, unit='radian', frame=TETE(obstime=obs_time)) else: @@ -215,7 +209,6 @@ def set_pyuvbeam(self, beam_model): pyuvbeam.read_beamfits(beamfits_file) pyuvbeam.efield_to_power() pyuvbeam.select(polarizations=self.uv.polarization_array) - #print(pyuvbeam.polarization_array) pyuvbeam.peak_normalize() pyuvbeam.interpolation_function = 'az_za_simple' pyuvbeam.freq_interp_kind = 'cubic' @@ -245,8 +238,7 @@ def set_a_mat(self, uvw_sign=1, apply_beam=True): self.beam_mat = np.zeros(self.phase_mat.shape, dtype='float64') self.sa_mat = np.zeros(self.phase_mat.shape, dtype='float64') self.set_pyuvbeam(beam_model=self.feed_type) -# freq_array = np.array([self.frequency,]) - freq_array = np.array([169e6,]) + freq_array = np.array([self.frequency,]) for time_t in np.unique(self.uv.time_array): az_t, alt_t = self._radec2azalt(self.ra, self.dec, time_t) lmn_t = np.array([np.cos(alt_t)*np.sin(az_t),