elif array_layout == 'HERA-91':
    ant_locs, ant_id = RI.hexagon_generator(14.6, n_total=91)
elif array_layout == 'HERA-127':
    ant_locs, ant_id = RI.hexagon_generator(14.6, n_total=127)
elif array_layout == 'HERA-169':
    ant_locs, ant_id = RI.hexagon_generator(14.6, n_total=169)
elif array_layout == 'HERA-217':
    ant_locs, ant_id = RI.hexagon_generator(14.6, n_total=217)
elif array_layout == 'HERA-271':
    ant_locs, ant_id = RI.hexagon_generator(14.6, n_total=271)
elif array_layout == 'HERA-331':
    ant_locs, ant_id = RI.hexagon_generator(14.6, n_total=331)
elif array_layout == 'CIRC':
    ant_locs, ant_id = RI.circular_antenna_array(element_size, minR, maxR=maxR)

bl, bl_id = RI.baseline_generator(ant_locs, ant_id=ant_id, auto=False, conjugate=False)
bl, select_bl_ind, bl_count = RI.uniq_baselines(bl)
bl_id = bl_id[select_bl_ind]
bl_length = NP.sqrt(NP.sum(bl**2, axis=1))
sortind = NP.argsort(bl_length, kind='mergesort')
bl = bl[sortind,:]
bl_id = bl_id[sortind]
bl_length = bl_length[sortind]
total_baselines = bl_length.size

n_bl_chunks = 64
baseline_chunk_size = 10

nside = 256
use_GSM = False
use_DSM = False
import healpy as HP
import geometry as GEOM
import interferometry as RI
import catalog as CTLG
import constants as CNST
import my_DSP_modules as DSP 
import my_operations as OPS
import primary_beams as PB
import baseline_delay_horizon as DLY

## Input/output parameters 

antenna_file = '/data3/t_nithyanandan/project_MWA/MWA_128T_antenna_locations_MNRAS_2012_Beardsley_et_al.txt'

ant_locs = NP.loadtxt(antenna_file, skiprows=6, comments='#', usecols=(1,2,3))
bl = RI.baseline_generator(ant_locs, auto=False, conjugate=False)
bl_length = NP.sqrt(NP.sum(bl**2, axis=1))
bl_orientation = NP.angle(bl[:,0] + 1j * bl[:,1], deg=True)
sortind = NP.argsort(bl_length, kind='mergesort')
bl = bl[sortind,:]
bl_length = bl_length[sortind]
bl_orientation = bl_orientation[sortind]
n_bins_baseline_orientation = 4
neg_bl_orientation_ind = NP.logical_or(bl_orientation < -0.5*180.0/n_bins_baseline_orientation, bl_orientation > 180.0 - 0.5*180.0/n_bins_baseline_orientation)
bl[neg_bl_orientation_ind,:] = -1.0 * bl[neg_bl_orientation_ind,:]
bl_orientation = NP.angle(bl[:,0] + 1j * bl[:,1], deg=True)
total_baselines = bl_length.size
# used_baselines = int(NP.sum(bl_length <= 50.0))
baseline_chunk_size = 100
baseline_bin_indices = range(0,total_baselines,baseline_chunk_size)
# if used_baselines > total_baselines:
Example #3
0
t_obs = args['t_obs']
pointing_init = NP.asarray(args['pointing_init'])
lst_init = args['lst_init']
n_channels = args['n_channels']
bpass_shape = args['bpass_shape']
oversampling_factor = 1.0 + args['f_pad']
n_pad = args['n_pad']
pfb_method = args['pfb_method']
bandpass_correct = args['bp_correct']
flag_chan = NP.asarray(args['flag_chan']).reshape(-1)
bp_flag_repeat = args['bp_flag_repeat']
coarse_channel_width = args['coarse_channel_width']
n_edge_flag = NP.asarray(args['n_edge_flag']).reshape(-1)
flag_repeat_edge_channels = args['flag_repeat_edge_channels']

bl = RI.baseline_generator(ant_locs, auto=False, conjugate=False)
bl_length = NP.sqrt(NP.sum(bl**2, axis=1))
bl_orientation = NP.angle(bl[:, 0] + 1j * bl[:, 1], deg=True)
sortind = NP.argsort(bl_length, kind='mergesort')
bl = bl[sortind, :]
bl_length = bl_length[sortind]
bl_orientation = bl_orientation[sortind]
neg_bl_orientation_ind = NP.logical_or(
    bl_orientation < -0.5 * 180.0 / n_bins_baseline_orientation,
    bl_orientation > 180.0 - 0.5 * 180.0 / n_bins_baseline_orientation)
bl[neg_bl_orientation_ind, :] = -1.0 * bl[neg_bl_orientation_ind, :]
bl_orientation = NP.angle(bl[:, 0] + 1j * bl[:, 1], deg=True)
total_baselines = bl_length.size
baseline_bin_indices = range(0, total_baselines, baseline_chunk_size)
labels = []
labels += [
import my_DSP_modules as DSP 
import my_operations as OPS
import primary_beams as PB
import baseline_delay_horizon as DLY
import lookup_operations as LKP
import ipdb as PDB

antenna_file = '/data3/t_nithyanandan/project_MWA/MWA_128T_antenna_locations_MNRAS_2012_Beardsley_et_al.txt'

telescope = 'mwa'
telescope_str = telescope + '_'
if telescope == 'mwa':
    telescope_str = ''

ant_locs = NP.loadtxt(antenna_file, skiprows=6, comments='#', usecols=(0,1,2,3))
ref_bl, ref_bl_id = RI.baseline_generator(ant_locs[:,1:], ant_id=ant_locs[:,0].astype(int).astype(str), auto=False, conjugate=False)
ref_bl_length = NP.sqrt(NP.sum(ref_bl**2, axis=1))
ref_bl_orientation = NP.angle(ref_bl[:,0] + 1j * ref_bl[:,1], deg=True) 
neg_bl_orientation_ind = ref_bl_orientation < 0.0
ref_bl[neg_bl_orientation_ind,:] = -1.0 * ref_bl[neg_bl_orientation_ind,:]
ref_bl_orientation = NP.angle(ref_bl[:,0] + 1j * ref_bl[:,1], deg=True)
sortind = NP.argsort(ref_bl_length, kind='mergesort')
ref_bl = ref_bl[sortind,:]
ref_bl_length = ref_bl_length[sortind]
ref_bl_orientation = ref_bl_orientation[sortind]
ref_bl_id = ref_bl_id[sortind]
n_bins_baseline_orientation = 4

latitude = -26.701

fhd_obsid = [1061309344, 1061316544]
    lst_wrapped = lst + 0.0
    lst_wrapped[lst_wrapped > 180.0] = lst_wrapped[lst_wrapped > 180.0] - 360.0
    if lst_wrapped.size > 1:
        lst_edges = NP.concatenate(
            (lst_wrapped,
             [lst_wrapped[-1] + lst_wrapped[-1] - lst_wrapped[-2]]))
    else:
        lst_edges = NP.concatenate(
            (lst_wrapped, lst_wrapped + t_snap / 3.6e3 * 15))

    duration_str = '_{0:0d}x{1:.1f}s'.format(n_snaps, t_snap[0])
    geor_duration_str = '_{0:0d}x{1:.1f}s'.format(1, t_snap[0])

bl, bl_id = RI.baseline_generator(ant_locs,
                                  ant_id=ant_id,
                                  auto=False,
                                  conjugate=False)
bl, select_bl_ind, bl_count = RI.uniq_baselines(bl)
bl_id = bl_id[select_bl_ind]
bl_length = NP.sqrt(NP.sum(bl**2, axis=1))
bl_orientation = NP.angle(bl[:, 0] + 1j * bl[:, 1], deg=True)
sortind = NP.argsort(bl_length, kind='mergesort')
bl = bl[sortind, :]
bl_id = bl_id[sortind]
bl_length = bl_length[sortind]
bl_orientation = bl_orientation[sortind]
bl_count = bl_count[sortind]
neg_bl_orientation_ind = (bl_orientation < -67.5) | (bl_orientation > 112.5)
# neg_bl_orientation_ind = NP.logical_or(bl_orientation < -0.5*180.0/n_bins_baseline_orientation, bl_orientation > 180.0 - 0.5*180.0/n_bins_baseline_orientation)
bl[neg_bl_orientation_ind, :] = -1.0 * bl[neg_bl_orientation_ind, :]
bl_orientation = NP.angle(bl[:, 0] + 1j * bl[:, 1], deg=True)
ground_plane = 0.3 # height of antenna element above ground plane
if ground_plane is None:
    ground_plane_str = 'no_ground_'
else:
    if ground_plane > 0.0:
        ground_plane_str = '{0:.1f}m_ground_'.format(ground_plane)
    else:
        raise ValueError('Height of antenna element above ground plane must be positive.')

latitude = -26.701 
antenna_file = '/data3/t_nithyanandan/project_MWA/MWA_128T_antenna_locations_MNRAS_2012_Beardsley_et_al.txt'

max_bl_length = None # Maximum baseline length (in m)
ant_locs = NP.loadtxt(antenna_file, skiprows=6, comments='#', usecols=(0,1,2,3))
ref_bl, ref_bl_id = RI.baseline_generator(ant_locs[:,1:], ant_id=ant_locs[:,0].astype(int).astype(str), auto=False, conjugate=False)
ref_bl_length = NP.sqrt(NP.sum(ref_bl**2, axis=1))
ref_bl_orientation = NP.angle(ref_bl[:,0] + 1j * ref_bl[:,1], deg=True) 
neg_ref_bl_orientation_ind = ref_bl_orientation < 0.0
ref_bl[neg_ref_bl_orientation_ind,:] = -1.0 * ref_bl[neg_ref_bl_orientation_ind,:]
ref_bl_orientation = NP.angle(ref_bl[:,0] + 1j * ref_bl[:,1], deg=True)
sortind = NP.argsort(ref_bl_length, kind='mergesort')
ref_bl = ref_bl[sortind,:]
ref_bl_length = ref_bl_length[sortind]
ref_bl_orientation = ref_bl_orientation[sortind]
ref_bl_id = ref_bl_id[sortind]
n_bins_baseline_orientation = 4
nmax_baselines = 2048
ref_bl = ref_bl[:nmax_baselines,:]
ref_bl_length = ref_bl_length[:nmax_baselines]
ref_bl_id = ref_bl_id[:nmax_baselines]
]:
    raise ValueError('Project does not exist')

project_dir = cfg['project']

if cfg['array']['layout'] != 'CIRC':
    raise ValueError('Antenna layout specified is not a circular ring')

if cfg['array']['minR'] is None:
    raise ValueError('Minimum radius of circular ring not specified')

minR = cfg['array']['minR']
maxR = cfg['array']['maxR']

if cfg['antenna']['size'] is None:
    raise ValueError('Antenna size not specified')

antsize = cfg['antenna']['size']

PDB.set_trace()
aalayout = RI.circular_antenna_array(antsize, minR, maxR=maxR)
bl, blid = RI.baseline_generator(aalayout, auto=False, conjugate=False)
ubl, ublind, ublcount = RI.uniq_baselines(bl)
bll = NP.sqrt(NP.sum(ubl**2, axis=1))
ubll, ubllind, ubllcount = RI.uniq_baselines(
    NP.hstack((bll.reshape(-1, 1), NP.zeros(
        (bll.size, 1)), NP.zeros((bll.size, 1)))))
ubll = bll[ubllind]

PDB.set_trace()
project_dir = cfg['project']

if cfg['array']['layout'] != 'CIRC':
    raise ValueError('Antenna layout specified is not a circular ring')

if cfg['array']['minR'] is None:
    raise ValueError('Minimum radius of circular ring not specified')

minR = cfg['array']['minR']
maxR = cfg['array']['maxR']

if cfg['antenna']['size'] is None:
    raise ValueError('Antenna size not specified')

antsize = cfg['antenna']['size']

PDB.set_trace()
aalayout = RI.circular_antenna_array(antsize, minR, maxR=maxR)
bl, blid = RI.baseline_generator(aalayout, auto=False, conjugate=False)
ubl, ublind, ublcount = RI.uniq_baselines(bl)
bll = NP.sqrt(NP.sum(ubl**2, axis=1))
ubll, ubllind, ubllcount = RI.uniq_baselines(NP.hstack((bll.reshape(-1,1),NP.zeros((bll.size,1)),NP.zeros((bll.size,1)))))
ubll = bll[ubllind]
    
PDB.set_trace()