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
use_CSM = False
]:
    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()
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 = 16
baseline_chunk_size = 128
baseline_bin_indices = range(0, total_baselines, baseline_chunk_size)

nside = 64
use_GSM = False
use_DSM = 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()