elif array_layout == 'HERA-61':
    ant_locs, ant_id = RI.hexagon_generator(14.6, n_total=61)
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
]:
    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()
        ant_locs, ant_id = RI.hexagon_generator(14.6, n_total=61)
    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)

telescope = {}
if telescope_id in ['mwa', 'vla', 'gmrt', 'hera', 'mwa_dipole', 'mwa_tools']:
    telescope['id'] = telescope_id
telescope['shape'] = element_shape
telescope['size'] = element_size
telescope['orientation'] = element_orientation
telescope['ocoords'] = element_ocoords
telescope['groundplane'] = ground_plane

if (telescope_id == 'mwa') or (telescope_id == 'mwa_dipole'):
    element_size = 0.74
    element_shape = 'dipole'
    if telescope_id == 'mwa': phased_array = True
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()