Exemplo n.º 1
0
    def test_ldp_splitfilewrapper_mixed(self):
        """Test the LDP interface for a SplitFileWrapper in a contorted way."""

        w = SplitFileWrapper([tbwFile, tbnFile], sort=False)
        f = ldp.LWA1DataFile(fh=w)

        # File info
        self.assertTrue(isinstance(f, ldp.TBWFile))

        # Read some
        frames = []
        while True:
            try:
                frame = f.read_frame()
                if frame.is_tbw:
                    frames.append(frame)
            except errors.SyncError:
                continue
            except errors.EOFError:
                break
        self.assertEqual(len(frames),
                         8 + 1)  # There is data at the end of the "file" now
Exemplo n.º 2
0
    def test_ldp_splitfilewrapper_discover(self):
        """Test the LDP interface for type discover with a SplitFileWrapper."""

        w = SplitFileWrapper([
            tbnFile,
        ])
        f = ldp.LWA1DataFile(fh=w)

        # File info
        self.assertTrue(isinstance(f, ldp.TBNFile))
        self.assertEqual(f.get_info("sample_rate"), 100e3)
        self.assertEqual(f.get_info("data_bits"), 8)
        self.assertEqual(f.get_info('nframe'), 29)

        self.assertEqual(f.sample_rate, 100e3)
        self.assertEqual(f.data_bits, 8)
        self.assertEqual(f.nframe, 29)

        # Read a frame
        frame = f.read_frame()

        f.close()
        w.close()
Exemplo n.º 3
0
 def test_ldp_discover_drx(self):
     """Test the LDP LWA1DataFile function of DRX."""
     # DRX
     f = ldp.LWA1DataFile(drxFile)
     self.assertEqual(type(f), ldp.DRXFile)
Exemplo n.º 4
0
 def test_ldp_discover_drspec(self):
     """Test the LDP LWA1DataFile function of DR Spectrometer."""
     # DR Spectrometer
     f = ldp.LWA1DataFile(drspecFile)
     self.assertEqual(type(f), ldp.DRSpecFile)
Exemplo n.º 5
0
 def test_ldp_discover_tbn(self):
     """Test the LDP LWA1DataFile function of TBN."""
     # TBN
     f = ldp.LWA1DataFile(tbnFile)
     self.assertEqual(type(f), ldp.TBNFile)