def test_save(self): d = load_bdf(psychic.find_data_path('sine-256Hz.bdf')) save_bdf(d, psychic.find_data_path('sine-256Hz-test.bdf')) d2 = load_bdf(psychic.find_data_path('sine-256Hz-test.bdf')) self.assertEqual(d.feat_lab, d2.feat_lab) np.testing.assert_allclose(d.data, d2.data, atol=0.0001) np.testing.assert_allclose(d.labels, d2.labels) np.testing.assert_allclose(d.ids, d2.ids)
def test_data(self): w = BDFWriter(psychic.find_data_path('sine-256Hz-test.bdf'), header=self.header) w.write(self.d) w.close() d2 = load_bdf(psychic.find_data_path('sine-256Hz-test.bdf')) np.testing.assert_allclose(self.d.data, d2.data, atol=0.05)
def test_load(self): d = load_bdf(psychic.find_data_path('sine-256Hz.bdf')) # test labels targets = [['A%d' % (i + 1) for i in range(16)]] self.assertEqual(d.feat_lab, targets) self.assertEqual(d.cl_lab, ['class254', 'class255']) # test ids ~ time self.assertAlmostEqual(d.ids[0, 256 + 1], 1, 2) # test dims self.assertEqual(d.nfeatures, 16) self.assertEqual(d.ninstances, 60 * 256) self.assertEqual(d.extra, {})
def setUp(self): self.d = load_bdf(psychic.find_data_path('sine-256Hz.bdf')) r = BDFReader(psychic.find_data_path('sine-256Hz.bdf')) self.header = r.header r.close()