Skip to content

Commit

Permalink
Check timestamps in test_add_raw_ephys_two_epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelbray32 committed Aug 4, 2023
1 parent b06b758 commit 72fe3a6
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions src/spikegadgets_to_nwb/tests/test_convert_ephys.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import pynwb
from spikegadgets_to_nwb.convert_ephys import add_raw_ephys
import warnings
from spikegadgets_to_nwb.convert_ephys import add_raw_ephys, RecFileDataChunkIterator
from spikegadgets_to_nwb import convert_yaml, convert_rec_header
from spikegadgets_to_nwb.tests.test_convert_rec_header import default_test_xml_tree

Expand Down Expand Up @@ -273,5 +274,34 @@ def test_add_raw_ephys_two_epoch():
)
== old_nwbfile.acquisition["e-series"].data[:, 0]
).all()

# check the timestamps match
assert (
read_nwbfile.acquisition["e-series"].timestamps[:]
== old_nwbfile.acquisition["e-series"].timestamps[:]
).all()
os.remove(filename)


def test_misordered_rec_warning():
# load rec files in wrong order
try:
# running on github
recfile = [
os.environ.get("DOWNLOAD_DIR") + "/20230622_160016.rec",
os.environ.get("DOWNLOAD_DIR") + "/20230622_155936.rec",
]
rec_to_nwb_file = os.environ.get("DOWNLOAD_DIR") + "/minirec20230622_.nwb"
except (TypeError, FileNotFoundError):
# running locally
recfile = [
path + "/test_data/20230622_160016.rec",
path + "/test_data/20230622_155936.rec",
]
# TODO: run this test once the timesmps loading is fixed
# with warnings.catch_warnings(record=True) as w:
# warnings.simplefilter("always")
# # warnings.warn("abc")
# RecFileDataChunkIterator(
# recfile,
# )
# assert len(w) == 1

0 comments on commit 72fe3a6

Please sign in to comment.