Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin committed Dec 18, 2023
1 parent dd2e848 commit dda869d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/unit/test_ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from pynwb.device import Device
from pynwb.file import ElectrodeTable
from pynwb.testing import TestCase
from pynwb.testing.mock.ecephys import mock_ElectricalSeries

from hdmf.common import DynamicTableRegion

Expand Down Expand Up @@ -116,6 +117,24 @@ def test_dimensions_warning(self):
) in str(w[-1].message)


def test_get_data_in_units():

data = np.asarray([[1, 1, 1, 1, 1], [1, 1, 1, 1, 1]])
conversion = 1.0
offset = 3.0
channel_conversion = np.asarray([2.0, 2.0])
electrical_series = mock_ElectricalSeries(
data=data,
conversion=conversion,
offset=offset,
channel_conversion=channel_conversion,
)

data_in_units = electrical_series.get_data_in_units()
expected_data = data * conversion * channel_conversion[:, np.newaxis] + offset

np.testing.assert_almost_equal(data_in_units, expected_data)

class SpikeEventSeriesConstructor(TestCase):

def _create_table_and_region(self):
Expand Down

0 comments on commit dda869d

Please sign in to comment.