How to use the pynwb.core.DynamicTableRegion function in pynwb

To help you get started, we’ve selected a few pynwb 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 NeurodataWithoutBorders / pynwb / tests / unit / pynwb_tests / test_ephys.py View on Github external
def test_init(self):
        event_times = [1.9, 3.5]
        table = make_electrode_table()
        region = DynamicTableRegion('electrodes', [0, 2], 'the first and third electrodes', table)
        description = ['desc1', 'desc2', 'desc3']
        features = [[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]]
        fe = FeatureExtraction(region, description, event_times, features)   # noqa: F405
        self.assertEqual(fe.description, description)
        self.assertEqual(fe.times, event_times)
        self.assertEqual(fe.features, features)
github NeurodataWithoutBorders / pynwb / tests / unit / pynwb_tests / test_ephys.py View on Github external
def test_init(self):
        data = list(range(10))
        ts = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
        table = make_electrode_table()
        region = DynamicTableRegion('electrodes', [0, 2], 'the first and third electrodes', table)
        eS = ElectricalSeries('test_eS', data, region, timestamps=ts)  # noqa: F405
        self.assertEqual(eS.name, 'test_eS')
        self.assertEqual(eS.data, data)
        self.assertEqual(eS.timestamps, ts)
github NeurodataWithoutBorders / pynwb / tests / unit / pynwb_tests / test_ephys.py View on Github external
def test_init(self):
        dev1 = Device('dev1')  # noqa: F405
        group = ElectrodeGroup(  # noqa: F405, F841
            'tetrode1', 'tetrode description', 'tetrode location', dev1)
        table = make_electrode_table()
        region = DynamicTableRegion('electrodes', [0, 2], 'the first and third electrodes', table)
        sES = SpikeEventSeries(  # noqa: F405
            'test_sES', list(range(10)), list(range(10)), region)

        ew = EventWaveform(sES)  # noqa: F405
        self.assertEqual(ew.spike_event_series['test_sES'], sES)
        self.assertEqual(ew['test_sES'], ew.spike_event_series['test_sES'])
github NeurodataWithoutBorders / pynwb / tests / unit / test_ecephys.py View on Github external
def test_init(self):
        dev1 = Device('dev1')  # noqa: F405
        group = ElectrodeGroup(  # noqa: F405, F841
            'tetrode1', 'tetrode description', 'tetrode location', dev1)
        table = make_electrode_table()
        region = DynamicTableRegion('electrodes', [0, 2], 'the first and third electrodes', table)
        eS = ElectricalSeries(  # noqa: F405
            'test_eS', [0, 1, 2, 3], region, timestamps=[0.1, 0.2, 0.3, 0.4])
        fe = FilteredEphys(eS)  # noqa: F405
        self.assertEqual(fe.electrical_series.get('test_eS'), eS)
        self.assertEqual(fe['test_eS'], fe.electrical_series.get('test_eS'))
github NeurodataWithoutBorders / pynwb / tests / unit / test_core.py View on Github external
def test_indexed_dynamic_table_region(self):
        table = self.with_columns_and_data()

        dynamic_table_region = DynamicTableRegion('dtr', [0, 1, 1], 'desc', table=table)
        fetch_ids = [x[1] for x in dynamic_table_region[:3]]
        self.assertEqual(fetch_ids, [1, 2, 2])
github NeurodataWithoutBorders / pynwb / tests / unit / pynwb_tests / test_core.py View on Github external
def test_dynamic_table_iteration(self):
        table = self.with_columns_and_data()

        dynamic_table_region = DynamicTableRegion('dtr', [0, 1, 2, 3, 4], 'desc', table=table)
        for ii, item in enumerate(dynamic_table_region):
            self.assertEqual(table[ii], item)
github NeurodataWithoutBorders / pynwb / tests / unit / pynwb_tests / test_ephys.py View on Github external
def test_no_rate(self):
        table = make_electrode_table()
        region = DynamicTableRegion('electrodes', [1, 3], 'the second and fourth electrodes', table)
        data = np.zeros(10)
        with self.assertRaises(TypeError):
            SpikeEventSeries('test_sES', data, region, rate=1.)  # noqa: F405
github NeurodataWithoutBorders / pynwb / tests / unit / test_ecephys.py View on Github external
def test_link(self):
        table = make_electrode_table()
        region = DynamicTableRegion('electrodes', [0, 2], 'the first and third electrodes', table)
        ts1 = ElectricalSeries('test_ts1', [0, 1, 2, 3, 4, 5], region, timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        ts2 = ElectricalSeries('test_ts2', ts1, region, timestamps=ts1)
        ts3 = ElectricalSeries('test_ts3', ts2, region, timestamps=ts2)
        self.assertEqual(ts2.data, [0, 1, 2, 3, 4, 5])
        self.assertEqual(ts2.timestamps, [0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        self.assertEqual(ts3.data, [0, 1, 2, 3, 4, 5])
        self.assertEqual(ts3.timestamps, [0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
github NeurodataWithoutBorders / pynwb / tests / unit / test_ecephys.py View on Github external
def test_invalid_init_mismatched_electrodes(self):
        event_times = [1]
        table = make_electrode_table()
        electrodes = DynamicTableRegion('electrodes', [0], 'the first electrodes', table)
        description = ['desc1', 'desc2', 'desc3']
        features = [[[0, 1, 2], [3, 4, 5]]]
        self.assertRaises(ValueError, FeatureExtraction, electrodes,
                          description, event_times, features)
github NeurodataWithoutBorders / pynwb / tests / unit / test_ecephys.py View on Github external
def test_no_rate(self):
        table = make_electrode_table()
        region = DynamicTableRegion('electrodes', [1, 3], 'the second and fourth electrodes', table)
        data = ((1, 1, 1), (2, 2, 2))
        with self.assertRaises(TypeError):
            SpikeEventSeries('test_sES', data, region, rate=1.)  # noqa: F405