How to use the morphio.SpikeReportReader function in morphio

To help you get started, we’ve selected a few morphio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BlueBrain / MorphIO / tests / brain / python / spikes.py View on Github external
def test_properties(self):
        reader = morphio.SpikeReportReader(self.filename)
        # assertAlmostEqual fails due to a float <-> double conversion error
        assert(round(reader.end_time - 9.975, 6) == 0)

        # Until some read operation beyond the end is performed the report is
        # not ended
        assert(not reader.has_ended)
        # numpy.nextafter(reader.end_time) should be sufficient, but the result
        # can't be distinguished from end_time after demoted to float in the C++
        # side.
        spikes = reader.get_spikes(0, float("inf"))
        assert(reader.has_ended)
github BlueBrain / MorphIO / tests / brain / python / spikes.py View on Github external
def test_get_spikes_bad(self):
        reader = morphio.SpikeReportReader(self.filename)
        self.assertRaises(RuntimeError, lambda: reader.get_spikes(0, 0))
        self.assertRaises(RuntimeError, lambda: reader.get_spikes(0, -1))
github BlueBrain / MorphIO / tests / brain / python / spikes.py View on Github external
def test_get_spikes_filtered(self):
        gids = {1, 10, 100}
        reader = morphio.SpikeReportReader(self.filename, gids)
        spikes = reader.get_spikes(0, float("inf"))
        for time, gid in spikes:
            assert(gid in gids)
github BlueBrain / MorphIO / tests / brain / python / spikes.py View on Github external
def test_get_spikes(self):
        reader = morphio.SpikeReportReader(self.filename)
        spikes = reader.get_spikes(-10, 0)
        assert(len(spikes) == 0)

        spikes = reader.get_spikes(1, 5)
        assert(spikes[0][0] >= 1)
        assert(spikes[-1][0] < 5)

        spikes = reader.get_spikes(7, 9)
        assert(spikes[0][0] >= 7)
        assert(spikes[-1][0] < 9)
github BlueBrain / MorphIO / tests / brain / python / spikes.py View on Github external
        self.assertRaises(RuntimeError, lambda: morphio.SpikeReportReader("foo"))
github BlueBrain / MorphIO / tests / brain / python / spikes.py View on Github external
def test_creation(self):
        reader = morphio.SpikeReportReader(self.filename)