Beispiel #1
0
def test_gaussbeam_values():
    """
        Make the long-line point sources up to 10 degrees from zenith.
        Obtain visibilities
        Confirm that the values match the expected beam values at those zenith angles.
    """
    sigma = 0.05
    hera_uv = UVData()
    hera_uv.read_uvfits(EW_uvfits_file)

    array_location = EarthLocation.from_geocentric(
        hera_uv.telescope_location[0],
        hera_uv.telescope_location[1],
        hera_uv.telescope_location[2],
        unit='m')
    freq = hera_uv.freq_array[0, 0] * units.Hz

    time = Time(hera_uv.time_array[0], scale='utc', format='jd')

    catalog, mock_keywords = pyuvsim.create_mock_catalog(
        time=time,
        arrangement='long-line',
        Nsrcs=41,
        max_za=10.,
        array_location=array_location)

    beam = pyuvsim.AnalyticBeam('gaussian', sigma=sigma)
    array = pyuvsim.Telescope('telescope_name', array_location, [beam])

    # Need a dummy baseline for this test.
    antenna1 = pyuvsim.Antenna('ant1', 1, np.array([0, 0, 0]), 0)
    antenna2 = pyuvsim.Antenna('ant2', 2, np.array([107, 0, 0]), 0)

    baseline = pyuvsim.Baseline(antenna1, antenna2)
    coherencies = []
    zenith_angles = []
    for src in catalog:
        task = pyuvsim.UVTask(src, time, freq, baseline, array)
        engine = pyuvsim.UVEngine(task)
        engine.apply_beam()
        #        task.source.az_za_calc(time, array_location)
        zenith_angles.append(task.source.az_za[1])  # In radians.
        coherencies.append(
            np.real(engine.apparent_coherency[0, 0]).astype(
                float))  # All four components should be identical

    coherencies = np.array(coherencies)
    zenith_angles = np.array(zenith_angles)

    # Confirm the coherency values (ie., brightnesses) match the beam values.

    beam_values = np.exp(-(zenith_angles)**2 / (2 * beam.sigma**2))
    nt.assert_true(np.all(beam_values**2 == coherencies))
Beispiel #2
0
def test_gaussbeam_values():
    """
    Make the long-line point sources up to 10 degrees from zenith.
    Confirm that the coherencies match the expected beam values at those zenith angles.
    """
    sigma = 0.05
    hera_uv = UVData()
    hera_uv.read_uvfits(EW_uvfits_file)

    array_location = EarthLocation.from_geocentric(*hera_uv.telescope_location,
                                                   unit='m')
    freq = hera_uv.freq_array[0, 0] * units.Hz

    time = Time(hera_uv.time_array[0], scale='utc', format='jd')

    catalog, mock_keywords = pyuvsim.create_mock_catalog(
        time=time,
        arrangement='long-line',
        Nsrcs=41,
        min_alt=80.,
        array_location=array_location)

    catalog.update_positions(time, array_location)
    beam = pyuvsim.AnalyticBeam('gaussian', sigma=sigma)
    array = pyuvsim.Telescope('telescope_name', array_location, [beam])

    # Need a dummy baseline for this test.
    antenna1 = pyuvsim.Antenna('ant1', 1, np.array([0, 0, 0]), 0)
    antenna2 = pyuvsim.Antenna('ant2', 2, np.array([107, 0, 0]), 0)

    baseline = pyuvsim.Baseline(antenna1, antenna2)

    task = pyuvsim.UVTask(catalog, time, freq, baseline, array)

    engine = pyuvsim.UVEngine(task)
    engine.apply_beam()
    altitudes = task.sources.alt_az[0]  # In radians.
    # All four components should be identical
    if isinstance(engine.apparent_coherency, units.Quantity):
        coherency_use = engine.apparent_coherency.to_value("Jy")
    else:
        coherency_use = engine.apparent_coherency

    coherencies = np.real(coherency_use[0, 0] +
                          coherency_use[1, 1]).astype(float)

    zenith_angles, _ = simutils.altaz_to_zenithangle_azimuth(
        altitudes, np.zeros_like(np.array(altitudes)))

    # Confirm the coherency values (ie., brightnesses) match the beam values.
    beam_values = np.exp(-(zenith_angles)**2 / (2 * beam.sigma**2))
    assert np.all(beam_values**2 == coherencies)
Beispiel #3
0
def test_single_zenith_source_uvdata():
    """Test single zenith source using test uvdata file."""
    hera_uv = UVData()
    hera_uv.read_uvfits(EW_uvfits_file)

    time = Time(hera_uv.time_array[0], scale='utc', format='jd')
    array_location = EarthLocation.from_geocentric(
        hera_uv.telescope_location[0],
        hera_uv.telescope_location[1],
        hera_uv.telescope_location[2],
        unit='m')
    freq = hera_uv.freq_array[0, 0] * units.Hz

    # get antennas positions into ENU
    antpos = hera_uv.antenna_positions[0:2, :] + hera_uv.telescope_location
    antpos = uvutils.ENU_from_ECEF(antpos.T,
                                   *hera_uv.telescope_location_lat_lon_alt).T

    antenna1 = pyuvsim.Antenna('ant1', 1, np.array(antpos[0, :]), 0)
    antenna2 = pyuvsim.Antenna('ant2', 2, np.array(antpos[1, :]), 0)

    # setup the things that don't come from pyuvdata:
    # make a source at zenith
    time.location = array_location
    source = create_zenith_source(time, 'zensrc')

    beam = UVBeam()
    beam.read_cst_beam(beam_files,
                       beam_type='efield',
                       frequency=[100e6, 123e6],
                       telescope_name='HERA',
                       feed_name='PAPER',
                       feed_version='0.1',
                       feed_pol=['x'],
                       model_name='E-field pattern - Rigging height 4.9m',
                       model_version='1.0')

    beam_list = [beam]

    baseline = pyuvsim.Baseline(antenna1, antenna2)
    array = pyuvsim.Telescope('telescope_name', array_location, beam_list)
    task = pyuvsim.UVTask(source, time, freq, baseline, array)
    engine = pyuvsim.UVEngine(task)

    visibility = engine.make_visibility()

    nt.assert_true(np.allclose(visibility, np.array([.5, .5, 0, 0]),
                               atol=5e-3))
Beispiel #4
0
def test_jones_set_interp(cst_beam, hera_loc):
    # check setting the interpolation method

    array_location = hera_loc

    beam = cst_beam.copy()
    beam.freq_interp_kind = None
    beam.interpolation_function = 'az_za_simple'
    beam_list = pyuvsim.BeamList([beam])
    antenna1 = pyuvsim.Antenna('ant1', 1, np.array([0, 10, 0]), 0)
    array = pyuvsim.Telescope('telescope_name', array_location, beam_list)
    source_altaz = np.array([[0.0], [np.pi / 4.]])
    freq = 123e6 * units.Hz

    with pytest.raises(ValueError, match='freq_interp_kind must be set'):
        antenna1.get_beam_jones(array, source_altaz, freq)

    jones = antenna1.get_beam_jones(array,
                                    source_altaz,
                                    freq,
                                    freq_interp_kind='cubic')
    assert beam.freq_interp_kind == 'cubic'
    jones0 = antenna1.get_beam_jones(array, source_altaz, freq)
    jones1 = antenna1.get_beam_jones(array,
                                     source_altaz,
                                     freq,
                                     freq_interp_kind='linear')
    assert beam.freq_interp_kind == 'linear'
    jones2 = antenna1.get_beam_jones(array, source_altaz, freq)

    assert (np.all(jones2 == jones0) and np.all(jones1 == jones)
            and np.all(jones1 == jones0))
Beispiel #5
0
def test_jones_set_spline(cst_beam, hera_loc):
    # Run get_beam_jones with spline options.
    array_location = hera_loc
    beam0 = cst_beam.copy()
    beam0.freq_interp_kind = 'cubic'
    telescope_config_name = os.path.join(SIM_DATA_PATH, 'mwa128_config.yaml')
    with open(telescope_config_name, 'r') as yf:
        telconfig = yaml.safe_load(yf)
    telconfig['spline_interp_opts'] = {'kx': 1, 'ky': 1}

    beam_list = pyuvsim.simsetup._construct_beam_list(np.arange(1), telconfig)
    beam_list.set_obj_mode()
    beam_list.append(beam0)

    assert beam0 is beam_list[-1]

    # Make antenna that uses beam #1
    antenna = pyuvsim.Antenna('ant1', 1, np.array([0, 10, 0]), 1)
    array = pyuvsim.Telescope('telescope_name', array_location, beam_list)

    altaz = [[0.0134], [1.0]]

    alts = np.linspace(0, np.pi / 4, 50)
    azs = np.linspace(0, 2 * np.pi, 50)

    alts, azs = np.meshgrid(alts, azs)

    altaz = np.zeros((50**2, 3))
    altaz[:, 0] = alts.flatten()
    altaz[:, 1] = azs.flatten()

    array.beam_list.spline_interp_opts = None
    antenna.get_beam_jones(array, altaz, 150e6)
Beispiel #6
0
def test_single_zenith_source():
    """Test single zenith source."""
    time = Time('2018-03-01 00:00:00', scale='utc')

    array_location = EarthLocation(lat='-30d43m17.5s',
                                   lon='21d25m41.9s',
                                   height=1073.)
    time.location = array_location

    freq = (150e6 * units.Hz)
    source = create_zenith_source(time, 'zensrc')

    antenna1 = pyuvsim.Antenna('ant1', 1, np.array([0, 0, 0]), 0)
    antenna2 = pyuvsim.Antenna('ant2', 2, np.array([107, 0, 0]), 0)

    baseline = pyuvsim.Baseline(antenna1, antenna2)

    beam = UVBeam()
    beam.read_cst_beam(beam_files,
                       beam_type='efield',
                       frequency=[150e6, 123e6],
                       telescope_name='HERA',
                       feed_name='PAPER',
                       feed_version='0.1',
                       feed_pol=['x'],
                       model_name='E-field pattern - Rigging height 4.9m',
                       model_version='1.0')

    beam_list = [beam]
    array = pyuvsim.Telescope('telescope_name', array_location, beam_list)

    task = pyuvsim.UVTask(source, time, freq, baseline, array)

    engine = pyuvsim.UVEngine(task)

    visibility = engine.make_visibility()

    nt.assert_true(np.allclose(visibility, np.array([.5, .5, 0, 0]),
                               atol=5e-3))
Beispiel #7
0
def test_file_to_tasks():

    hera_uv = UVData()
    hera_uv.read_uvfits(EW_uvfits_file)

    time = Time(hera_uv.time_array[0], scale='utc', format='jd')
    sources = np.array([create_zenith_source(time, 'zensrc')])

    beam = UVBeam()
    beam.read_cst_beam(beam_files,
                       beam_type='efield',
                       frequency=[150e6, 123e6],
                       telescope_name='HERA',
                       feed_name='PAPER',
                       feed_version='0.1',
                       feed_pol=['x'],
                       model_name='E-field pattern - Rigging height 4.9m',
                       model_version='1.0')

    beam_list = [beam]

    uvtask_list = pyuvsim.uvdata_to_task_list(hera_uv, sources, beam_list)

    tel_loc = EarthLocation.from_geocentric(*hera_uv.telescope_location,
                                            unit='m')
    beam = UVBeam()
    beam.read_cst_beam(beam_files,
                       beam_type='efield',
                       frequency=[150e6, 123e6],
                       telescope_name='HERA',
                       feed_name='PAPER',
                       feed_version='0.1',
                       feed_pol=['x'],
                       model_name='E-field pattern - Rigging height 4.9m',
                       model_version='1.0')

    beam_list = [beam]
    telescope = pyuvsim.Telescope(hera_uv.telescope_name, tel_loc, beam_list)

    ant_pos = hera_uv.antenna_positions + hera_uv.telescope_location
    ant_pos_enu = uvutils.ENU_from_ECEF(
        ant_pos.T, *hera_uv.telescope_location_lat_lon_alt).T

    expected_task_list = []
    antenna_names = hera_uv.antenna_names
    antennas = []
    for num, antname in enumerate(antenna_names):
        beam_id = 0
        antennas.append(
            pyuvsim.Antenna(antname, num, ant_pos_enu[num], beam_id))

    antennas1 = []
    for antnum in hera_uv.ant_1_array:
        index = np.where(hera_uv.antenna_numbers == antnum)[0][0]
        antennas1.append(antennas[index])

    antennas2 = []
    for antnum in hera_uv.ant_2_array:
        index = np.where(hera_uv.antenna_numbers == antnum)[0][0]
        antennas2.append(antennas[index])

    for idx, antenna1 in enumerate(antennas1):
        antenna2 = antennas2[idx]
        baseline = pyuvsim.Baseline(antenna1, antenna2)
        task = pyuvsim.UVTask(sources[0], time.jd, hera_uv.freq_array[0, 0],
                              baseline, telescope)
        task.uvdata_index = (idx, 0, 0)
        expected_task_list.append(task)

    for idx, task in enumerate(uvtask_list):
        exp_task = expected_task_list[idx]
        nt.assert_equal(task, exp_task)
Beispiel #8
0
def test_single_offzenith_source_miriad():
    """Test single off-zenith source using test uvdata file."""
    miriad_uv = UVData()
    miriad_uv.read_miriad(os.path.join(DATA_PATH, 'hera_testfile'),
                          ant_str='9_10')
    miriad_uv.select(times=miriad_uv.time_array[0])

    src_az = Angle('90.0d')
    src_alt = Angle('85.0d')
    src_za = Angle('90.0d') - src_alt

    src_l = np.sin(src_az.rad) * np.sin(src_za.rad)
    src_m = np.cos(src_az.rad) * np.sin(src_za.rad)
    src_n = np.cos(src_za.rad)

    time = Time(miriad_uv.time_array[0], scale='utc', format='jd')
    array_location = EarthLocation.from_geocentric(
        miriad_uv.telescope_location[0],
        miriad_uv.telescope_location[1],
        miriad_uv.telescope_location[2],
        unit='m')
    freq = miriad_uv.freq_array[0, 0] * units.Hz

    # get antennas positions into ENU
    antpos = miriad_uv.antenna_positions[0:2, :] + miriad_uv.telescope_location
    antpos = uvutils.ENU_from_ECEF(antpos.T,
                                   *miriad_uv.telescope_location_lat_lon_alt).T

    antenna1 = pyuvsim.Antenna('ant1', 1, np.array(antpos[0, :]), 0)
    antenna2 = pyuvsim.Antenna('ant2', 2, np.array(antpos[1, :]), 0)

    # setup the things that don't come from pyuvdata:
    # make a source off zenith
    time.location = array_location
    source = create_offzenith_source(time, 'offzensrc', az=src_az, alt=src_alt)

    beam = UVBeam()
    beam.read_cst_beam(beam_files,
                       beam_type='efield',
                       frequency=[100e6, 123e6],
                       telescope_name='HERA',
                       feed_name='PAPER',
                       feed_version='0.1',
                       feed_pol=['x'],
                       model_name='E-field pattern - Rigging height 4.9m',
                       model_version='1.0')

    beam_list = [beam]

    baseline = pyuvsim.Baseline(antenna1, antenna2)
    array = pyuvsim.Telescope('telescope_name', array_location, beam_list)
    task = pyuvsim.UVTask(source, time, freq, baseline, array)
    engine = pyuvsim.UVEngine(task)

    visibility = engine.make_visibility()

    # analytically calculate visibility

    beam.peak_normalize()
    beam.interpolation_function = 'az_za_simple'
    interpolated_beam, interp_basis_vector = beam.interp(
        az_array=np.array([src_az.rad]),
        za_array=np.array([src_za.rad]),
        freq_array=np.array([freq.to('Hz').value]))
    jones = np.zeros((2, 2), dtype=np.complex64)
    jones[0, 0] = interpolated_beam[1, 0, 0, 0, 0]
    jones[1, 1] = interpolated_beam[0, 0, 1, 0, 0]
    jones[1, 0] = interpolated_beam[1, 0, 1, 0, 0]
    jones[0, 1] = interpolated_beam[0, 0, 0, 0, 0]

    uvw_wavelength_array = hera_uv.uvw_array * units.m / const.c * freq.to(
        '1/s')

    vis_analytic = 0.5 * np.dot(
        jones,
        np.conj(jones).T) * np.exp(
            -2j * np.pi *
            (uvw_wavelength_array[0, 0] * src_l + uvw_wavelength_array[0, 1] *
             src_m + uvw_wavelength_array[0, 2] * src_n))
    vis_analytic = np.array([
        vis_analytic[0, 0], vis_analytic[1, 1], vis_analytic[1, 0],
        vis_analytic[0, 1]
    ])

    print('Analytic visibility', vis_analytic)
    print('Calculated visibility', visibility)

    nt.assert_true(np.allclose(visibility, vis_analytic, atol=5e-3))
Beispiel #9
0
def test_offzenith_source_multibl_uvfits():
    """Test single off-zenith source using test uvdata file.
        Calculate visibilities for a baseline triangle.
    """
    hera_uv = UVData()
    hera_uv.read_uvfits(
        longbl_uvfits_file, ant_str='cross'
    )  # consists of a right triangle of baselines with w term
    hera_uv.unphase_to_drift()

    src_az = Angle('90.0d')
    src_alt = Angle('85.0d')
    src_za = Angle('90.0d') - src_alt

    src_l = np.sin(src_az.rad) * np.sin(src_za.rad)
    src_m = np.cos(src_az.rad) * np.sin(src_za.rad)
    src_n = np.cos(src_za.rad)

    time = Time(hera_uv.time_array[0], scale='utc', format='jd')
    array_location = EarthLocation.from_geocentric(
        hera_uv.telescope_location[0],
        hera_uv.telescope_location[1],
        hera_uv.telescope_location[2],
        unit='m')
    freq = hera_uv.freq_array[0, 0] * units.Hz

    # get antennas positions into ENU
    antpos, ants = hera_uv.get_ENU_antpos()
    antenna1 = pyuvsim.Antenna('ant1', ants[0], np.array(antpos[0, :]), 0)
    antenna2 = pyuvsim.Antenna('ant2', ants[1], np.array(antpos[1, :]), 0)
    antenna3 = pyuvsim.Antenna('ant3', ants[2], np.array(antpos[2, :]), 0)

    # setup the things that don't come from pyuvdata:
    # make a source off zenith
    time.location = array_location
    source = create_offzenith_source(time, 'offzensrc', az=src_az, alt=src_alt)

    # beam = UVBeam()
    # beam.read_cst_beam(beam_files, beam_type='efield', frequency=[100e6, 123e6],
    #                    telescope_name='HERA',
    #                    feed_name='PAPER', feed_version='0.1', feed_pol=['x'],
    #                    model_name='E-field pattern - Rigging height 4.9m',
    #                    model_version='1.0')

    beam = pyuvsim.AnalyticBeam('tophat')

    beam_list = [beam]

    baselines = [
        pyuvsim.Baseline(antenna2, antenna1),
        pyuvsim.Baseline(antenna3, antenna1),
        pyuvsim.Baseline(antenna3, antenna2)
    ]
    array = pyuvsim.Telescope('telescope_name', array_location, beam_list)
    tasks = [pyuvsim.UVTask(source, time, freq, bl, array) for bl in baselines]
    visibilities = []
    uvws = []
    for t in tasks:
        engine = pyuvsim.UVEngine(t)
        visibilities.append(engine.make_visibility())
        uvws.append(t.baseline.uvw)

    uvws = np.array(uvws)
    # analytically calculate visibilities

    beam.peak_normalize()
    beam.interpolation_function = 'az_za_simple'
    interpolated_beam, interp_basis_vector = beam.interp(
        az_array=np.array([src_az.rad]),
        za_array=np.array([src_za.rad]),
        freq_array=np.array([freq.to('Hz').value]))
    jones = np.zeros((2, 2), dtype=np.complex64)
    jones[0, 0] = interpolated_beam[1, 0, 0, 0, 0]
    jones[1, 1] = interpolated_beam[0, 0, 1, 0, 0]
    jones[1, 0] = interpolated_beam[1, 0, 1, 0, 0]
    jones[0, 1] = interpolated_beam[0, 0, 0, 0, 0]

    uvw_wavelength_array = hera_uv.uvw_array[
        0:hera_uv.Nbls] * units.m / const.c * freq.to('1/s')

    visibilities_analytic = []
    for u, v, w in uvw_wavelength_array:
        vis = 0.5 * np.dot(
            jones,
            np.conj(jones).T) * np.exp(2j * np.pi *
                                       (u * src_l + v * src_m + w * src_n))
        visibilities_analytic.append(
            np.array([vis[0, 0], vis[1, 1], vis[1, 0], vis[0, 1]]))

    print('pyuvsim uvws: ', np.around(uvws))
    print('file uvws: ', np.around(hera_uv.uvw_array[0:hera_uv.Nbls]))
    print('Difference: ', uvws - hera_uv.uvw_array[0:hera_uv.Nbls])

    # the file used different phasing code than the test uses -- increase the tolerance
    nt.assert_true(
        np.allclose(uvws, hera_uv.uvw_array[0:hera_uv.Nbls], atol=1e-4))

    print('Analytic visibility', visibilities_analytic)
    print('Calculated visibility', visibilities)
    print(np.array(visibilities) - np.array(visibilities_analytic))

    # the file used different phasing code than the test uses -- increase the tolerance
    nt.assert_true(np.allclose(visibilities, visibilities_analytic, atol=1e-4))
Beispiel #10
0
def test_redundant_baselines():
    """Check that two perfectly redundant baselines are truly redundant. """

    hera_uv = UVData()
    hera_uv.read_uvfits(EW_uvfits_file, ant_str='cross')
    hera_uv.unphase_to_drift()

    src_az = Angle('90.0d')
    src_alt = Angle('85.0d')
    src_za = Angle('90.0d') - src_alt

    src_l = np.sin(src_az.rad) * np.sin(src_za.rad)
    src_m = np.cos(src_az.rad) * np.sin(src_za.rad)
    src_n = np.cos(src_za.rad)

    time = Time(hera_uv.time_array[0], scale='utc', format='jd')
    array_location = EarthLocation.from_geocentric(
        hera_uv.telescope_location[0],
        hera_uv.telescope_location[1],
        hera_uv.telescope_location[2],
        unit='m')
    freq = hera_uv.freq_array[0, 0] * units.Hz

    # get antennas positions into ENU
    antpos, _ = hera_uv.get_ENU_antpos()

    en_shift = [5., 5., 0]
    antenna1 = pyuvsim.Antenna('ant1', 1, np.array(antpos[0, :]), 0)
    antenna2 = pyuvsim.Antenna('ant2', 2, np.array(antpos[1, :]), 0)
    antenna3 = pyuvsim.Antenna('ant3', 3, np.array(antpos[0, :]) + en_shift, 0)
    antenna4 = pyuvsim.Antenna('ant4', 4, np.array(antpos[1, :]) + en_shift, 0)

    # setup the things that don't come from pyuvdata:
    # make a source off zenith
    time.location = array_location
    source = create_offzenith_source(time, 'offzensrc', az=src_az, alt=src_alt)

    beam = UVBeam()
    beam.read_cst_beam(beam_files,
                       beam_type='efield',
                       frequency=[100e6, 123e6],
                       telescope_name='HERA',
                       feed_name='PAPER',
                       feed_version='0.1',
                       feed_pol=['x'],
                       model_name='E-field pattern - Rigging height 4.9m',
                       model_version='1.0')

    beam_list = [beam]

    baseline1 = pyuvsim.Baseline(antenna1, antenna2)
    baseline2 = pyuvsim.Baseline(antenna3, antenna4)

    print('Baseline1 uvw: ', baseline1.uvw)
    print('Baseline2 uvw: ', baseline2.uvw)
    print('Baseline1 enus: ', baseline1.antenna1.pos_enu,
          baseline1.antenna2.pos_enu)
    print('Baseline2 enus: ', baseline2.antenna1.pos_enu,
          baseline2.antenna2.pos_enu)

    array = pyuvsim.Telescope('telescope_name', array_location, beam_list)

    task1 = pyuvsim.UVTask(source, time, freq, baseline1, array)
    engine = pyuvsim.UVEngine(task1)

    visibility1 = engine.make_visibility()

    task2 = pyuvsim.UVTask(source, time, freq, baseline2, array)
    engine = pyuvsim.UVEngine(task2)

    visibility2 = engine.make_visibility()

    nt.assert_true(np.allclose(visibility1, visibility2))
Beispiel #11
0
def test_source_below_horizon():
    time = Time('2018-03-01 00:00:00', scale='utc')

    array_location = EarthLocation(lat='-30d43m17.5s',
                                   lon='21d25m41.9s',
                                   height=1073.)
    time.location = array_location

    freq = (150e6 * units.Hz)

    source = create_offzenith_source(time,
                                     'src_down',
                                     az=Angle('0d'),
                                     alt=Angle('-40d'))

    antenna1 = pyuvsim.Antenna('ant1', 1, np.array([0, 0, 0]), 0)
    antenna2 = pyuvsim.Antenna('ant2', 2, np.array([107, 0, 0]), 0)

    baseline = pyuvsim.Baseline(antenna1, antenna2)

    beam = UVBeam()
    beam.read_cst_beam(beam_files,
                       beam_type='efield',
                       frequency=[150e6, 123e6],
                       telescope_name='HERA',
                       feed_name='PAPER',
                       feed_version='0.1',
                       feed_pol=['x'],
                       model_name='E-field pattern - Rigging height 4.9m',
                       model_version='1.0')

    beam_list = [beam]
    array = pyuvsim.Telescope('telescope_name', array_location, beam_list)

    task = pyuvsim.UVTask(source, time, freq, baseline, array)

    engine = pyuvsim.UVEngine(task)

    visibility = engine.make_visibility()

    nt.assert_true(np.allclose(visibility, np.array([0, 0, 0, 0])))

    # redo with RA/Dec defined source
    time = Time(2458098.27471265, format='jd')
    time.location = array_location

    source_coord = SkyCoord(ra=Angle('13h20m'),
                            dec=Angle('-30d43m17.5s'),
                            obstime=time,
                            frame='icrs',
                            location=array_location)

    source = pyuvsim.Source('src_down', source_coord.ra, source_coord.dec,
                            freq, [1.0, 0, 0, 0])

    task = pyuvsim.UVTask(source, time, freq, baseline, array)

    engine = pyuvsim.UVEngine(task)

    visibility = engine.make_visibility()

    nt.assert_true(np.allclose(visibility, np.array([0, 0, 0, 0])))