Skip to content

Commit

Permalink
Fix ascii and axograph ios
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 committed Jan 17, 2025
1 parent a6c0182 commit 8b05510
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions neo/test/iotest/test_asciisignalio.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ def test_skiprows(self):
self.assertEqual(signal.units, pq.V)
assert_array_equal(signal.times, [0.0, 1.0, 2.0, 3.0] * pq.s)
assert_array_equal(signal.times.magnitude, [0.0, 1.0, 2.0, 3.0])
assert_array_equal(signal[0].magnitude, -64.8)
assert_array_equal(signal[1].magnitude, -64.6)
assert_array_equal(signal[2].magnitude, -64.3)
assert_array_equal(signal[3].magnitude, -66)
assert_array_almost_equal(signal[0].magnitude, -64.8, decimal=5)
assert_array_almost_equal(signal[1].magnitude, -64.6, decimal=5)
assert_array_almost_equal(signal[2].magnitude, -64.3, decimal=5)
assert_array_almost_equal(signal[3].magnitude, -66, decimal=5)
assert_array_almost_equal(np.asarray(signal).flatten(), np.array([-64.8, -64.6, -64.3, -66]), decimal=5)

os.remove(filename)
Expand All @@ -195,11 +195,11 @@ def test_usecols(self):
self.assertEqual(signal.units, pq.V)
assert_array_equal(signal.times, [0.0, 1.0, 2.0, 3.0, 4.0] * pq.s)
assert_array_equal(signal.times.magnitude, [0.0, 1.0, 2.0, 3.0, 4.0])
assert_array_equal(signal[0].magnitude, 0.5)
assert_array_equal(signal[1].magnitude, 0.6)
assert_array_equal(signal[2].magnitude, 0.7)
assert_array_equal(signal[3].magnitude, 0.8)
assert_array_equal(signal[4].magnitude, 1.4)
assert_array_almost_equal(signal[0].magnitude, 0.5, decimal=5)
assert_array_almost_equal(signal[1].magnitude, 0.6, decimal=5)
assert_array_almost_equal(signal[2].magnitude, 0.7, decimal=5)
assert_array_almost_equal(signal[3].magnitude, 0.8, decimal=5)
assert_array_almost_equal(signal[4].magnitude, 1.4, decimal=5)
assert_array_almost_equal(np.asarray(signal).flatten(), np.array([0.5, 0.6, 0.7, 0.8, 1.4]), decimal=5)

os.remove(filename)
Expand Down
12 changes: 6 additions & 6 deletions neo/test/iotest/test_axographio.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from neo.test.iotest.common_io_test import BaseTestIO

import numpy as np
from numpy.testing import assert_equal
from numpy.testing import assert_equal, assert_almost_equal
import quantities as pq
from neo.test.rawiotest.test_axographrawio import TestAxographRawIO

Expand All @@ -35,9 +35,9 @@ def test_version_1(self):
target = np.array([[-5.5078130], [-3.1171880], [+1.6640626], [+1.6640626], [+4.0546880]], dtype=np.float32)
assert_equal(arr, target)

assert_equal(sig.t_start, 0.0005000000237487257 * pq.s)
assert_almost_equal(sig.t_start, 0.0005000000237487257 * pq.s, decimal=9)

assert_equal(sig.sampling_period, 0.0005000010132789612 * pq.s)
assert_almost_equal(sig.sampling_period, 0.0005000010132789612 * pq.s, decimal=9)

def test_version_2(self):
"""Test reading a version 2 AxoGraph file"""
Expand Down Expand Up @@ -87,9 +87,9 @@ def test_version_2(self):
target = np.array([[0.3125], [9.6875], [9.6875], [9.6875], [9.3750]], dtype=np.float32)
assert_equal(arr, target)

assert_equal(sig.t_start, 0.00009999999747378752 * pq.s)
assert_almost_equal(sig.t_start, 0.00009999999747378752 * pq.s, decimal=9)

assert_equal(sig.sampling_period, 0.00009999999747378750 * pq.s)
assert_almost_equal(sig.sampling_period, 0.00009999999747378750 * pq.s, decimal=9)

def test_version_5(self):
"""Test reading a version 5 AxoGraph file"""
Expand Down Expand Up @@ -169,7 +169,7 @@ def test_file_written_by_axographio_package_without_linearsequence(self):

assert_equal(sig.t_start, 0 * pq.s)

assert_equal(sig.sampling_period, 0.009999999999999787 * pq.s)
assert_almost_equal(sig.sampling_period, 0.009999999999999787 * pq.s, decimal=9)

def test_file_with_corrupt_comment(self):
"""Test reading a file with a corrupt comment"""
Expand Down

0 comments on commit 8b05510

Please sign in to comment.