Ejemplo n.º 1
0
 def test_load_wfdb_annotation(self, setup_module_load):  #pylint: disable=redefined-outer-name
     """
     Testing wfdb loader for annotation.
     """
     # Arrange
     path = setup_module_load[1]
     ind = bf.FilesIndex(path=os.path.join(path, 'sel100.hea'),
                         no_ext=True,
                         sort=True)
     batch = EcgBatch(ind)
     # Act
     batch = batch.load(fmt="wfdb",
                        components=["signal", "annotation", "meta"],
                        ann_ext="pu1")
     # Assert
     assert isinstance(batch.signal, np.ndarray)
     assert isinstance(batch.meta, np.ndarray)
     assert isinstance(batch.annotation, np.ndarray)
     assert batch.signal.shape == (1, )
     assert batch.annotation.shape == (1, )
     assert batch.meta.shape == (1, )
     assert isinstance(batch.signal[0], np.ndarray)
     assert isinstance(batch.annotation[0], dict)
     assert isinstance(batch.meta[0], dict)
     assert 'annsamp' in batch.annotation[0]
     assert 'anntype' in batch.annotation[0]
     del batch
Ejemplo n.º 2
0
 def test_load_wfdb(self, setup_module_load): #pylint: disable=redefined-outer-name
     """
     Testing wfdb loader.
     """
     # Arrange
     ind = setup_module_load[0]
     batch = EcgBatch(ind)
     # Act
     batch = batch.load(fmt="wfdb", components=["signal", "annotation", "meta"])
     # Assert
     assert isinstance(batch.signal, np.ndarray)
     assert isinstance(batch.meta, np.ndarray)
     assert isinstance(batch.annotation, np.ndarray)
     assert batch.signal.shape == (6,)
     assert batch.annotation.shape == (6,)
     assert batch.meta.shape == (6,)
     assert isinstance(batch.signal[0], np.ndarray)
     assert isinstance(batch.annotation[0], dict)
     assert isinstance(batch.meta[0], dict)
     del batch
Ejemplo n.º 3
0
 def test_load_wav(self, setup_module_load): #pylint: disable=redefined-outer-name
     """
     Testing EDF loader.
     """
     # Arrange
     path = setup_module_load[1]
     ind = ds.FilesIndex(path=os.path.join(path, 'sample*.wav'), no_ext=True, sort=True)
     batch = EcgBatch(ind)
     # Act
     batch = batch.load(fmt="wav", components=["signal", "annotation", "meta"])
     # Assert
     assert isinstance(batch.signal, np.ndarray)
     assert isinstance(batch.meta, np.ndarray)
     assert isinstance(batch.annotation, np.ndarray)
     assert batch.signal.shape == (1,)
     assert batch.annotation.shape == (1,)
     assert batch.meta.shape == (1,)
     assert isinstance(batch.signal[0], np.ndarray)
     assert isinstance(batch.annotation[0], dict)
     assert isinstance(batch.meta[0], dict)
     del batch