Source code for brainbox.tests.test_io

import unittest

import numpy as np

from brainbox.io import one as bbone


[docs] class TestIO_ONE(unittest.TestCase): """Tests for brainbox.io.one functions that don't require fixtures on disk."""
[docs] def test_load_iti(self): """Test for brainbox.io.one.load_iti function.""" trials = bbone.alfio.AlfBunch({}) trials.intervals = np.array([ [114.52487625, 117.88103707], [118.5169474, 122.89742147], [123.49302927, 126.12216664], [126.68107337, 129.53872083], [130.11952807, 133.90539162] ]) trials.stimOff_times = [117.38098379, 122.39736201, 125.62210278, 129.03865947, 133.4053633] expected = np.array([1.13596361, 1.09566726, 1.05897059, 1.0808686, np.nan]) np.testing.assert_array_almost_equal(bbone.load_iti(trials), expected) _ = trials.pop('stimOff_times') self.assertRaises(ValueError, bbone.load_iti, trials)
if __name__ == '__main__': unittest.main(exit=False, verbosity=2)