Skip to content

Commit 732a3b3

Browse files
authored
Correctly store sample sounts timestamps as seconds (#150)
1 parent 5359ff6 commit 732a3b3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/trodes_to_nwb/convert_intervals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def add_sample_count(
9191
)
9292

9393
# get the systime information
94-
systime = np.array(rec_dci.timestamps) * NANOSECONDS_PER_SECOND
94+
systime = np.array(rec_dci.timestamps)
9595
# get the sample count information
9696
trodes_sample = np.concatenate(
9797
[neo_io.get_analogsignal_timestamps(0, None) for neo_io in rec_dci.neo_io]

src/trodes_to_nwb/tests/test_convert_intervals.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from trodes_to_nwb.tests.test_convert_rec_header import default_test_xml_tree
1111
from trodes_to_nwb.tests.utils import data_path
1212

13+
NANOSECONDS_PER_SECOND = 1e9
14+
1315

1416
def test_add_epochs():
1517
metadata_path = data_path / "20230622_sample_metadata.yml"
@@ -69,7 +71,8 @@ def test_add_sample_count():
6971
== old_nwbfile.processing["sample_count"]["sample_count"].data[:]
7072
).all()
7173
assert np.allclose(
72-
read_nwbfile.processing["sample_count"]["sample_count"].timestamps[:],
74+
read_nwbfile.processing["sample_count"]["sample_count"].timestamps[:]
75+
* NANOSECONDS_PER_SECOND, # Account for error in old file timestamps
7376
old_nwbfile.processing["sample_count"]["sample_count"].timestamps[:],
7477
rtol=0,
7578
atol=(1.0 / 30000) * 1e9,

0 commit comments

Comments
 (0)