) + 'HI_monopole' + sky_sector_str + 'sprms_{0:.1f}_'.format(
    spindex_rms) + spindex_seed_str + 'nside_{0:0d}_'.format(
        nside) + delaygain_err_str + 'Tsys_{0:.1f}K_{1}_{2:.1f}_MHz_'.format(
            Tsys, bandpass_str, freq / 1e6) + 'no_pfb_' + bpass_shape + '.fits'

fg_clean_infile = rootdir + project_dir + telescope_str + 'multi_baseline_CLEAN_visibilities_' + ground_plane_str + snapshot_type_str + obs_mode + duration_str + '_baseline_range_{0:.1f}-{1:.1f}_'.format(
    bl_length[baseline_bin_indices[0]], bl_length[min(
        baseline_bin_indices[n_bl_chunks - 1] + baseline_chunk_size - 1,
        total_baselines - 1)]
) + fg_str + sky_sector_str + 'sprms_{0:.1f}_'.format(
    spindex_rms) + spindex_seed_str + 'nside_{0:0d}_'.format(
        nside) + delaygain_err_str + 'Tsys_{0:.1f}K_{1}_{2:.1f}_MHz_'.format(
            Tsys, bandpass_str, freq / 1e6) + 'no_pfb_' + bpass_shape + '.fits'

PDB.set_trace()
ia = RI.InterferometerArray(None, None, None, init_file=fg_infile)

hdulist = fits.open(geor_clean_infile)
clean_lags = hdulist['SPECTRAL INFO'].data['lag']
geor_cc_skyvis_lag = hdulist[
    'CLEAN NOISELESS DELAY SPECTRA REAL'].data + 1j * hdulist[
        'CLEAN NOISELESS DELAY SPECTRA IMAG'].data
geor_cc_skyvis_lag_res = hdulist[
    'CLEAN NOISELESS DELAY SPECTRA RESIDUALS REAL'].data + 1j * hdulist[
        'CLEAN NOISELESS DELAY SPECTRA RESIDUALS IMAG'].data
hdulist.close()

hdulist = fits.open(fg_clean_infile)
fg_cc_skyvis_lag = hdulist[
    'CLEAN NOISELESS DELAY SPECTRA REAL'].data + 1j * hdulist[
        'CLEAN NOISELESS DELAY SPECTRA IMAG'].data
Exemplo n.º 2
0
    spindex_rms = 0.0

if spindex_seed is not None:
    spindex_seed_str = '{0:0d}_'.format(spindex_seed)

for k in range(n_sky_sectors):
    if n_sky_sectors == 1:
        sky_sector_str = '_all_sky_'
    else:
        sky_sector_str = '_sky_sector_{0:0d}_'.format(k)
    
    infile = rootdir+project_dir+telescope_str+'multi_baseline_visibilities_'+ground_plane_str+snapshot_type_str+obs_mode+duration_str+'_baseline_range_{0:.1f}-{1:.1f}_'.format(bl_length[baseline_bin_indices[0]],bl_length[min(baseline_bin_indices[n_bl_chunks-1]+baseline_chunk_size-1,total_baselines-1)])+fg_str+sky_sector_str+'sprms_{0:.1f}_'.format(spindex_rms)+spindex_seed_str+'nside_{0:0d}_'.format(nside)+delaygain_err_str+'Tsys_{0:.1f}K_{1}_{2:.1f}_MHz_'.format(Tsys, bandpass_str, freq/1e6)+beam_usage_str+pfb_instr
    outfile = rootdir+project_dir+telescope_str+'multi_baseline_CLEAN_visibilities_'+ground_plane_str+snapshot_type_str+obs_mode+duration_str+'_baseline_range_{0:.1f}-{1:.1f}_'.format(bl_length[baseline_bin_indices[0]],bl_length[min(baseline_bin_indices[n_bl_chunks-1]+baseline_chunk_size-1,total_baselines-1)])+fg_str+sky_sector_str+'sprms_{0:.1f}_'.format(spindex_rms)+spindex_seed_str+'nside_{0:0d}_'.format(nside)+delaygain_err_str+'Tsys_{0:.1f}K_{1}_{2:.1f}_MHz_'.format(Tsys, bandpass_str, freq/1e6)+beam_usage_str+'_'+pfb_outstr+bpass_shape

    ia_outfile = infile
    iafg = RI.InterferometerArray(None, None, None, init_file=infile+'.fits')
    iafg.phase_centering(phase_center=pc, phase_center_coords=pc_coords,
                              do_delay_transform=False)   
    dsofg = DS.DelaySpectrum(interferometer_array=iafg)
    # dsofg.delayClean(pad=pad, freq_wts=window, clean_window_buffer=clean_window_buffer, gain=gain, maxiter=maxiter, threshold=threshold, threshold_type=threshold_type, parallel=parallel, nproc=nproc)
    dsofg_sbds = dsofg.subband_delay_transform(freq_window_bw, freq_center=freq_window_centers, shape={key: 'bhw' for key in ['cc', 'sim']}, pad=None, bpcorrect=False, action='return_oversampled')
    dpsofg = DS.DelayPowerSpectrum(dsofg)
    dpsofg.compute_power_spectrum()

    bli = 2
    lsti = 0
    sbi = 0

    fig = PLT.figure(figsize=(6,8))
    # gs1 = GS.GridSpec(1,1)
    gs2 = GS.GridSpec(2,1)
skymod = CTLG.SkyModel(ctlgobj)

## Animation parameters

backdrop_xsize = 100
bitrate = 128
fps = 1.0
interval = 100

## Start the observation

progress = PGB.ProgressBar(widgets=[PGB.Percentage(), PGB.Bar(), PGB.ETA()], maxval=40).start()
for i in range(0,min(40,len(baseline_bin_indices))):
    outfile = '/data3/t_nithyanandan/project_MWA/multi_baseline_visibilities_'+obs_mode+'_baseline_range_{0:.1f}-{1:.1f}_'.format(bl_length[baseline_bin_indices[i]],bl_length[min(baseline_bin_indices[i]+baseline_chunk_size-1,total_baselines-1)])+'FG_model_'+fg_str+'_'+bpass_shape+'{0:.1f}'.format(oversampling_factor)+'_part_{0:0d}'.format(i)
    ia = RI.InterferometerArray(labels[baseline_bin_indices[i]:min(baseline_bin_indices[i]+baseline_chunk_size,total_baselines)], bl[baseline_bin_indices[i]:min(baseline_bin_indices[i]+baseline_chunk_size,total_baselines),:], chans, telescope=telescope, latitude=latitude, A_eff=A_eff, freq_scale='GHz')    
    ts = time.time()
    ia.observing_run(pointing_init, skymod, t_snap, t_obs, chans, bpass, Tsys, lst_init, mode=obs_mode, freq_scale='GHz', brightness_units=flux_unit, memsave=True)
    print 'The last chunk of {0:0d} baselines required {1:.1f} minutes'.format(baseline_chunk_size, (time.time()-ts)/60.0)
    ia.delay_transform(oversampling_factor-1.0, freq_wts=window)
    ia.save(outfile, verbose=True, tabtype='BinTableHDU', overwrite=True)
    progress.update(i+1)
progress.finish()

# lags = None
# skyvis_lag = None
# vis_lag = None
# progress = PGB.ProgressBar(widgets=[PGB.Percentage(), PGB.Bar(), PGB.ETA()], maxval=40).start()
# for i in range(0, min(40,len(baseline_bin_indices))):
#     infile = '/data3/t_nithyanandan/project_MWA/multi_baseline_visibilities_'+obs_mode+'_baseline_range_{0:.1f}-{1:.1f}_'.format(bl_length[baseline_bin_indices[i]],bl_length[min(baseline_bin_indices[i]+baseline_chunk_size-1,total_baselines-1)])+'FG_model_'+fg_str+'_'+bpass_shape+'{0:.1f}'.format(oversampling_factor)+'_part_{0:0d}'.format(i)
#     hdulist = fits.open(infile+'.fits')
Exemplo n.º 4
0
        eor_infile = rootdir + project_dir + telescope_str + 'multi_baseline_visibilities_' + ground_plane_str + snapshot_type_str + obs_mode + duration_str + '_baseline_range_{0:.1f}-{1:.1f}_'.format(
            bl_length[baseline_bin_indices[0]], bl_length[min(
                baseline_bin_indices[n_bl_chunks - 1] + baseline_chunk_size -
                1, total_baselines - 1)]
        ) + eor_str + sky_sector_str + 'sprms_{0:.1f}_'.format(
            spindex_rms) + spindex_seed_str + 'nside_{0:0d}_'.format(
                eor_nside
            ) + delaygain_err_str + 'Tsys_{0:.1f}K_{1}_{2:.1f}_MHz_'.format(
                Tsys, eor_bandpass_str,
                eor_freq / 1e6) + beam_usage_str + pfb_instr

        if beam_iter == 0:

            achrmiafg = RI.InterferometerArray(None,
                                               None,
                                               None,
                                               init_file=infile + '.fits')
            achrmiafg.phase_centering(phase_center=pc,
                                      phase_center_coords=pc_coords,
                                      do_delay_transform=False)
            achrmdsofg = DS.DelaySpectrum(interferometer_array=achrmiafg)

            achrmiaeor = RI.InterferometerArray(None,
                                                None,
                                                None,
                                                init_file=eor_infile + '.fits')
            achrmiaeor.phase_centering(phase_center=pc,
                                       phase_center_coords=pc_coords,
                                       do_delay_transform=False)
            achrmdsoeor = DS.DelaySpectrum(interferometer_array=achrmiaeor)
            infile = rootdir + project_dir + telescope_str + 'multi_baseline_visibilities_' + ground_plane_str + snapshot_type_str + obs_mode + duration_str + '_baseline_range_{0:.1f}-{1:.1f}_'.format(
                bl_length[baseline_bin_indices[bl_chunk[i]]], bl_length[min(
                    baseline_bin_indices[bl_chunk[i]] + baseline_chunk_size -
                    1, total_baselines - 1)]
            ) + fg_str + sky_sector_str + 'sprms_{0:.1f}_'.format(
                spindex_rms
            ) + spindex_seed_str + 'nside_{0:0d}_'.format(
                nside
            ) + delaygain_err_str + 'Tsys_{0:.1f}K_{1}_{2:.1f}_MHz_'.format(
                Tsys, bandpass_str, freq / 1e6) + pfb_instr + '{0:.1f}'.format(
                    oversampling_factor) + '_part_{0:0d}'.format(i)

        # infile = '/data3/t_nithyanandan/project_MWA/multi_baseline_visibilities_'+avg_drifts_str+obs_mode+'_baseline_range_{0:.1f}-{1:.1f}_'.format(bl_length[baseline_bin_indices[i]],bl_length[min(baseline_bin_indices[i]+baseline_chunk_size-1,total_baselines-1)])+'gaussian_FG_model_'+fg_str+'_{0:0d}_'.format(nside)+'{0:.1f}_MHz_'.format(nchan*freq_resolution/1e6)+bpass_shape+'{0:.1f}'.format(oversampling_factor)+'_part_{0:0d}'.format(i)
        if i == 0:
            ia = RI.InterferometerArray(None,
                                        None,
                                        None,
                                        init_file=infile + '.fits')
        else:
            ia_next = RI.InterferometerArray(None,
                                             None,
                                             None,
                                             init_file=infile + '.fits')
            ia.concatenate(ia_next, axis=0)

        progress.update(i + 1)
    progress.finish()

    if filenaming_convention == 'old':
        outfile = rootdir + project_dir + telescope_str + 'multi_baseline_visibilities_' + ground_plane_str + snapshot_type_str + obs_mode + '_baseline_range_{0:.1f}-{1:.1f}_'.format(
            bl_length[baseline_bin_indices[0]], bl_length[min(
                baseline_bin_indices[n_bl_chunks - 1] + baseline_chunk_size -