Beispiel #1
0
    def test_empty_uvdata(self):
        # Make sure that empty_uvdata() can produce a UVData object
        nfreqs = 150
        ntimes = 20
        ants = {0: (1.0, 2.0, 3.0), 1: (3.0, 4.0, 5.0)}
        antpairs1 = [(0, 1), (1, 0), (1, 1)]
        antpairs2 = [(0, 1), (1, 0), (1, 1), (0, 1)]  # duplicate baseline

        # Build object and check that data_array has correct dimensions
        uvd = io.empty_uvdata(nfreqs, ntimes, ants=ants, antpairs=antpairs1)
        self.assertEqual(uvd.data_array.shape, (len(antpairs1) * ntimes, 1, nfreqs, 1))

        # Check that duplicate baselines get filtered out
        uvd = io.empty_uvdata(nfreqs, ntimes, ants=ants, antpairs=antpairs2)
        self.assertEqual(uvd.data_array.shape,
                         (len(antpairs1) * ntimes, 1, nfreqs, 1))
Beispiel #2
0
 def test_antpair_order(self):
     nfreqs = 10
     ntimes = 10
     ants = {j: tuple(np.random.rand(3)) for j in range(10)}
     uvd = io.empty_uvdata(nfreqs, ntimes, ants=ants)
     for ant1, ant2 in uvd.get_antpairs():
         self.assertLessEqual(ant1,ant2)
def uvdataJD():
    return io.empty_uvdata(nfreq=NFREQ,
                           integration_time=sday.to('s') / NTIMES,
                           ntimes=NTIMES,
                           ants={
                               0: (0, 0, 0),
                           },
                           start_time=2456659)
def uvdata2():
    return io.empty_uvdata(
        nfreq=NFREQ,
        integration_time=sday.to('s') / NTIMES,
        ntimes=NTIMES,
        ants={
            0: (0, 0, 0),
            1: (1, 1, 0)
        },
    )
Beispiel #5
0
    def test_bad_antpairs(self):
        # Make sure that empty_uvdata() can produce a UVData object
        nfreqs = 150
        ntimes = 20
        ants = {0: (1., 2., 3.), 1: (3., 4., 5.)}
        antpairs1 = [(0, 1), (1, 0), (1, 1), 1]

        with self.assertRaises(TypeError):
            uvd = io.empty_uvdata(nfreqs,
                                  ntimes,
                                  ants=ants,
                                  antpairs=antpairs1)
def empty_uvdata(ants=None,
                 nfreq=20,
                 ntimes=20,
                 bandwidth=0.2e8,
                 integration_time=40.,
                 start_time=2458902.33333,
                 start_freq=1.e8,
                 **kwargs):
    """
    Generate empty UVData object with the right shape.
    
    Parameters
    ----------
    ants (dict): None
        A dictionary mapping an integer to a three-tuple of ENU co-ordinates for
        each antenna. These antennas can be down-selected via keywords.

    ntimes : int, optional
        Number of time samples. Default: 20.
    
    bandwidth : float
        Total bandwidth, in Hz. Default: 0.2e8
    
    integration_time : float, optional
        Integration time per time sample. Default: 40. 
    
    start_time : float, optional
        Start date of observations, as Julian date. Default: 2458902.33333 
        (20:00 UTC on 2020-02-22)
    
    start_freq : float, optional
        Initial frequency channel, in Hz. Default: 1.e8.
    
    **kwargs : args
        Other arguments to be passed to `hera_sim.io.empty_uvdata`.
    
    Returns
    -------
    uvd : UVData
        Returns an empty UVData 
    """
    uvd = io.empty_uvdata(nfreq=nfreq,
                          start_freq=start_freq,
                          channel_width=bandwidth / nfreq,
                          start_time=start_time,
                          integration_time=integration_time,
                          ntimes=ntimes,
                          ants=ants,
                          **kwargs)

    # Add missing parameters
    uvd._x_orientation.value = 'east'
    return uvd