当前位置: 首页>>代码示例>>Python>>正文


Python NestIO.read_spiketrain方法代码示例

本文整理汇总了Python中neo.io.nestio.NestIO.read_spiketrain方法的典型用法代码示例。如果您正苦于以下问题:Python NestIO.read_spiketrain方法的具体用法?Python NestIO.read_spiketrain怎么用?Python NestIO.read_spiketrain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在neo.io.nestio.NestIO的用法示例。


在下文中一共展示了NestIO.read_spiketrain方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_t_stop_undefined_raises_error

# 需要导入模块: from neo.io.nestio import NestIO [as 别名]
# 或者: from neo.io.nestio.NestIO import read_spiketrain [as 别名]
 def test_t_stop_undefined_raises_error(self):
     """
     Tests if undefined t_stop, i.e., t_stop=None raises error.
     """
     filename = get_test_file_full_path(
             ioclass=NestIO,
             filename='0gid-1time-1256-0.gdf',
             directory=self.local_test_dir, clean=False)
     r = NestIO(filenames=filename)
     with self.assertRaises(ValueError):
         r.read_spiketrain(gdf_id=1, t_start=400. * pq.ms, lazy=False,
                           id_column=0, time_column=1)
     with self.assertRaises(ValueError):
         r.read_segment(gid_list=[1, 2, 3], t_start=400. * pq.ms, lazy=False,
                        id_column_gdf=0, time_column_gdf=1)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:17,代码来源:test_nestio.py

示例2: test_read_spiketrain

# 需要导入模块: from neo.io.nestio import NestIO [as 别名]
# 或者: from neo.io.nestio.NestIO import read_spiketrain [as 别名]
    def test_read_spiketrain(self):
        """
        Tests reading files in the 4 different formats:
        - without GIDs, with times as floats
        - without GIDs, with times as integers in time steps
        - with GIDs, with times as floats
        - with GIDs, with times as integers in time steps
        """
        filename = get_test_file_full_path(
                ioclass=NestIO,
                filename='0time-1255-0.gdf',
                directory=self.local_test_dir, clean=False)
        r = NestIO(filenames=filename)
        r.read_spiketrain(t_start=400. * pq.ms, t_stop=500. * pq.ms, lazy=False,
                          id_column=None, time_column=0)
        r.read_segment(t_start=400. * pq.ms, t_stop=500. * pq.ms, lazy=False,
                       id_column_gdf=None, time_column_gdf=0)

        filename = get_test_file_full_path(
                ioclass=NestIO,
                filename='0time_in_steps-1257-0.gdf',
                directory=self.local_test_dir, clean=False)
        r = NestIO(filenames=filename)
        r.read_spiketrain(t_start=400. * pq.ms, t_stop=500. * pq.ms,
                          time_unit=pq.CompoundUnit('0.1*ms'), lazy=False,
                          id_column=None, time_column=0)
        r.read_segment(t_start=400. * pq.ms, t_stop=500. * pq.ms,
                       time_unit=pq.CompoundUnit('0.1*ms'), lazy=False,
                       id_column_gdf=None, time_column_gdf=0)

        filename = get_test_file_full_path(
                ioclass=NestIO,
                filename='0gid-1time-1256-0.gdf',
                directory=self.local_test_dir, clean=False)
        r = NestIO(filenames=filename)
        r.read_spiketrain(gdf_id=1, t_start=400. * pq.ms, t_stop=500. * pq.ms,
                          lazy=False, id_column_gdf=0, time_column_gdf=1)
        r.read_segment(gid_list=[1], t_start=400. * pq.ms, t_stop=500. * pq.ms,
                       lazy=False, id_column_gdf=0, time_column_gdf=1)

        filename = get_test_file_full_path(
                ioclass=NestIO,
                filename='0gid-1time_in_steps-1258-0.gdf',
                directory=self.local_test_dir, clean=False)
        r = NestIO(filenames=filename)
        r.read_spiketrain(gdf_id=1, t_start=400. * pq.ms, t_stop=500. * pq.ms,
                          time_unit=pq.CompoundUnit('0.1*ms'), lazy=False,
                          id_column=0, time_column=1)
        r.read_segment(gid_list=[1], t_start=400. * pq.ms, t_stop=500. * pq.ms,
                       time_unit=pq.CompoundUnit('0.1*ms'), lazy=False,
                       id_column_gdf=0, time_column_gdf=1)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:53,代码来源:test_nestio.py

示例3: test_read_spiketrain_can_return_empty_spiketrain

# 需要导入模块: from neo.io.nestio import NestIO [as 别名]
# 或者: from neo.io.nestio.NestIO import read_spiketrain [as 别名]
 def test_read_spiketrain_can_return_empty_spiketrain(self):
     """
     Tests if read_spiketrain returns an empty SpikeTrain if no spikes are in
     time range.
     """
     filename = get_test_file_full_path(
             ioclass=NestIO,
             filename='0gid-1time-1256-0.gdf',
             directory=self.local_test_dir, clean=False)
     r = NestIO(filenames=filename)
     st = r.read_spiketrain(gdf_id=0, t_start=400. * pq.ms,
                            t_stop=1. * pq.ms)
     self.assertEqual(st.size, 0)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:15,代码来源:test_nestio.py

示例4: test_read_spiketrain_annotates

# 需要导入模块: from neo.io.nestio import NestIO [as 别名]
# 或者: from neo.io.nestio.NestIO import read_spiketrain [as 别名]
 def test_read_spiketrain_annotates(self):
     """
     Tests if correct annotation is added when reading a spike train.
     """
     filename = get_test_file_full_path(
             ioclass=NestIO,
             filename='0gid-1time-1256-0.gdf',
             directory=self.local_test_dir, clean=False)
     r = NestIO(filenames=filename)
     ID = 7
     st = r.read_spiketrain(gdf_id=ID, t_start=400. * pq.ms,
                            t_stop=500. * pq.ms)
     self.assertEqual(ID, st.annotations['id'])
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:15,代码来源:test_nestio.py

示例5: test_read_integer

# 需要导入模块: from neo.io.nestio import NestIO [as 别名]
# 或者: from neo.io.nestio.NestIO import read_spiketrain [as 别名]
    def test_read_integer(self):
        """
        Tests if spike times are actually stored as integers if they are stored
        in time steps in the file.
        """
        filename = get_test_file_full_path(
                ioclass=NestIO,
                filename='0time_in_steps-1257-0.gdf',
                directory=self.local_test_dir, clean=False)
        r = NestIO(filenames=filename)
        st = r.read_spiketrain(gdf_id=None, t_start=400. * pq.ms,
                               t_stop=500. * pq.ms,
                               time_unit=pq.CompoundUnit('0.1*ms'),
                               lazy=False, id_column=None, time_column=0)
        self.assertTrue(st.magnitude.dtype == np.int32)
        seg = r.read_segment(gid_list=[None], t_start=400. * pq.ms,
                             t_stop=500. * pq.ms,
                             time_unit=pq.CompoundUnit('0.1*ms'),
                             lazy=False, id_column_gdf=None, time_column_gdf=0)
        sts = seg.spiketrains
        self.assertTrue(all([st.magnitude.dtype == np.int32 for st in sts]))

        filename = get_test_file_full_path(
                ioclass=NestIO,
                filename='0gid-1time_in_steps-1258-0.gdf',
                directory=self.local_test_dir, clean=False)
        r = NestIO(
                filenames=filename)
        st = r.read_spiketrain(gdf_id=1, t_start=400. * pq.ms,
                               t_stop=500. * pq.ms,
                               time_unit=pq.CompoundUnit('0.1*ms'),
                               lazy=False, id_column=0, time_column=1)
        self.assertTrue(st.magnitude.dtype == np.int32)
        seg = r.read_segment(gid_list=[1], t_start=400. * pq.ms,
                             t_stop=500. * pq.ms,
                             time_unit=pq.CompoundUnit('0.1*ms'),
                             lazy=False, id_column_gdf=0, time_column_gdf=1)
        sts = seg.spiketrains
        self.assertTrue(all([st.magnitude.dtype == np.int32 for st in sts]))
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:41,代码来源:test_nestio.py

示例6: test_adding_custom_annotation

# 需要导入模块: from neo.io.nestio import NestIO [as 别名]
# 或者: from neo.io.nestio.NestIO import read_spiketrain [as 别名]
 def test_adding_custom_annotation(self):
     """
     Tests if custom annotation is correctly added.
     """
     filename = get_test_file_full_path(
             ioclass=NestIO,
             filename='0gid-1time-1256-0.gdf',
             directory=self.local_test_dir, clean=False)
     r = NestIO(filenames=filename)
     st = r.read_spiketrain(gdf_id=0, t_start=400. * pq.ms,
                            t_stop=500. * pq.ms,
                            layer='L23', population='I')
     self.assertEqual(0, st.annotations.pop('id'))
     self.assertEqual('L23', st.annotations.pop('layer'))
     self.assertEqual('I', st.annotations.pop('population'))
     self.assertEqual({}, st.annotations)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:18,代码来源:test_nestio.py

示例7: test_read_float

# 需要导入模块: from neo.io.nestio import NestIO [as 别名]
# 或者: from neo.io.nestio.NestIO import read_spiketrain [as 别名]
 def test_read_float(self):
     """
     Tests if spike times are stored as floats if they
     are stored as floats in the file.
     """
     filename = get_test_file_full_path(
             ioclass=NestIO,
             filename='0gid-1time-1256-0.gdf',
             directory=self.local_test_dir, clean=False)
     r = NestIO(filenames=filename)
     st = r.read_spiketrain(gdf_id=1, t_start=400. * pq.ms,
                            t_stop=500. * pq.ms,
                            lazy=False, id_column=0, time_column=1)
     self.assertTrue(st.magnitude.dtype == np.float)
     seg = r.read_segment(gid_list=[1], t_start=400. * pq.ms,
                          t_stop=500. * pq.ms,
                          lazy=False, id_column_gdf=0, time_column_gdf=1)
     sts = seg.spiketrains
     self.assertTrue(all([s.magnitude.dtype == np.float for s in sts]))
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:21,代码来源:test_nestio.py

示例8: test_gdf_id_illdefined_raises_error

# 需要导入模块: from neo.io.nestio import NestIO [as 别名]
# 或者: from neo.io.nestio.NestIO import read_spiketrain [as 别名]
 def test_gdf_id_illdefined_raises_error(self):
     """
     Tests if ill-defined gdf_id in read_spiketrain (i.e., None, list, or
     empty list) raises error.
     """
     filename = get_test_file_full_path(
             ioclass=NestIO,
             filename='0gid-1time-1256-0.gdf',
             directory=self.local_test_dir, clean=False)
     r = NestIO(filenames=filename)
     with self.assertRaises(ValueError):
         r.read_spiketrain(gdf_id=[], t_start=400. * pq.ms,
                           t_stop=500. * pq.ms)
     with self.assertRaises(ValueError):
         r.read_spiketrain(gdf_id=[1], t_start=400. * pq.ms,
                           t_stop=500. * pq.ms)
     with self.assertRaises(ValueError):
         r.read_spiketrain(t_start=400. * pq.ms, t_stop=500. * pq.ms)
开发者ID:MartinHeroux,项目名称:ScientificallySound_files,代码行数:20,代码来源:test_nestio.py


注:本文中的neo.io.nestio.NestIO.read_spiketrain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。