• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python generate_datasets.fake_neo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neo.test.generate_datasets.fake_neo函数的典型用法代码示例。如果您正苦于以下问题:Python fake_neo函数的具体用法?Python fake_neo怎么用?Python fake_neo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: setUp

    def setUp(self):
        self.nchildren = 2
        self.seed1 = 0
        self.seed2 = 10000
        self.chx1 = fake_neo(ChannelIndex,
                             seed=self.seed1, n=self.nchildren)
        self.chx2 = fake_neo(ChannelIndex,
                             seed=self.seed2, n=self.nchildren)
        self.targobj = self.chx1

        self.units1 = self.chx1.units
        self.units2 = self.chx2.units
        self.sigarrs1 = self.chx1.analogsignals
        self.sigarrs2 = self.chx2.analogsignals
        self.irrsig1 = self.chx1.irregularlysampledsignals
        self.irrsig2 = self.chx2.irregularlysampledsignals

        self.units1a = clone_object(self.units1)
        self.sigarrs1a = clone_object(self.sigarrs1, n=2)
        self.irrsig1a = clone_object(self.irrsig1, n=2)

        self.trains1 = [[train for train in unit.spiketrains]
                        for unit in self.units1]
        self.trains2 = [[train for train in unit.spiketrains]
                        for unit in self.units2]

        self.trains1 = sum(self.trains1, [])
        self.trains2 = sum(self.trains2, [])
开发者ID:msenoville,项目名称:python-neo,代码行数:28,代码来源:test_channelindex.py


示例2: setUp

    def setUp(self):
        self.nchildren = 2
        self.seed1 = 0
        self.seed2 = 10000
        self.blk1 = fake_neo(Block, seed=self.seed1, n=self.nchildren)
        self.blk2 = fake_neo(Block, seed=self.seed2, n=self.nchildren)
        self.targobj = self.blk1

        self.segs1 = self.blk1.segments
        self.segs2 = self.blk2.segments
        self.chxs1 = self.blk1.channel_indexes
        self.chxs2 = self.blk2.channel_indexes

        self.units1 = [[unit for unit in chx.units] for chx in self.chxs1]
        self.units2 = [[unit for unit in chx.units] for chx in self.chxs2]

        self.units1 = sum(self.units1, [])
        self.units2 = sum(self.units2, [])

        self.sigarrs1 = [[sigarr for sigarr in chx.analogsignals]
                         for chx in self.chxs1]
        self.sigarrs2 = [[sigarr for sigarr in chx.analogsignals]
                         for chx in self.chxs2]

        self.trains1 = [[train for train in unit.spiketrains]
                        for unit in self.units1]
        self.trains2 = [[train for train in unit.spiketrains]
                        for unit in self.units2]

        self.irsigs1 = [[irsig for irsig in chx.irregularlysampledsignals]
                        for chx in self.chxs1]
        self.irsigs2 = [[irsig for irsig in chx.irregularlysampledsignals]
                        for chx in self.chxs2]

        self.epcs1 = [[epc for epc in seg.epochs]
                      for seg in self.segs1]
        self.epcs2 = [[epc for epc in seg.epochs]
                      for seg in self.segs2]
        self.evts1 = [[evt for evt in seg.events]
                      for seg in self.segs1]
        self.evts2 = [[evt for evt in seg.events]
                      for seg in self.segs2]

        self.sigarrs1 = sum(self.sigarrs1, [])
        self.sigarrs2 = sum(self.sigarrs2, [])

        self.trains1 = sum(self.trains1, [])
        self.trains2 = sum(self.trains2, [])
        self.irsigs1 = sum(self.irsigs1, [])
        self.irsigs2 = sum(self.irsigs2, [])

        self.epcs1 = sum(self.epcs1, [])
        self.epcs2 = sum(self.epcs2, [])
        self.evts1 = sum(self.evts1, [])
        self.evts2 = sum(self.evts2, [])
开发者ID:msenoville,项目名称:python-neo,代码行数:55,代码来源:test_block.py


示例3: subcheck__generate_datasets

    def subcheck__generate_datasets(self, cls, cascade, seed=None):
        self.annotations['seed'] = seed

        if seed is None:
            res = fake_neo(obj_type=cls, cascade=cascade)
        else:
            res = fake_neo(obj_type=cls, cascade=cascade, seed=seed)

        if not hasattr(cls, 'lower'):
            self.assertTrue(isinstance(res, cls))
        else:
            self.assertEqual(res.__class__.__name__, cls)

        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)

        resattr = get_fake_values(cls, annotate=False, seed=0)
        if seed is not None:
            for name, value in resattr.items():
                if name in ['channel_names',
                            'channel_indexes',
                            'channel_index']:
                    continue
                try:
                    try:
                        resvalue = getattr(res, name)
                    except AttributeError:
                        if name == 'signal':
                            continue
                        raise
                    try:
                        self.assertEqual(resvalue, value)
                    except ValueError:
                        assert_arrays_equal(resvalue, value)
                except BaseException as exc:
                    exc.args += ('from %s' % name,)
                    raise

        if not getattr(res, '_child_objects', ()):
            pass
        elif not cascade:
            self.assertEqual(res.children, ())
        else:
            self.assertNotEqual(res.children, ())

        if cls in ['RecordingChannelGroup', RecordingChannelGroup]:
            for i, rchan in enumerate(res.recordingchannels):
                self.assertEqual(rchan.name, res.channel_names[i].astype(str))
                self.assertEqual(rchan.index, res.channel_indexes[i])
            for i, unit in enumerate(res.units):
                for sigarr in res.analogsignalarrays:
                    self.assertEqual(unit.channel_indexes[0],
                                     sigarr.channel_index[i])
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:53,代码来源:test_generate_datasets.py


示例4: setUp

    def setUp(self):
        self.nchildren = 2
        self.seed1 = 0
        self.seed2 = 10000
        self.unit1 = fake_neo(Unit, seed=self.seed1, n=self.nchildren)
        self.unit2 = fake_neo(Unit, seed=self.seed2, n=self.nchildren)
        self.targobj = self.unit1

        self.trains1 = self.unit1.spiketrains
        self.trains2 = self.unit2.spiketrains

        self.trains1a = clone_object(self.trains1)
开发者ID:INM-6,项目名称:python-neo,代码行数:12,代码来源:test_unit.py


示例5: setUp

    def setUp(self):
        self.nchildren = 2
        blk = fake_neo(Block, seed=0, n=self.nchildren)
        self.unit1, self.unit2, self.unit3, self.unit4 = blk.list_units
        self.seg1, self.seg2 = blk.segments
        self.targobj = self.seg1
        self.seed1 = self.seg1.annotations['seed']
        self.seed2 = self.seg2.annotations['seed']

        del self.seg1.annotations['i']
        del self.seg2.annotations['i']
        del self.seg1.annotations['j']
        del self.seg2.annotations['j']

        self.sigarrs1 = self.seg1.analogsignals
        self.sigarrs2 = self.seg2.analogsignals
        self.irsigs1 = self.seg1.irregularlysampledsignals
        self.irsigs2 = self.seg2.irregularlysampledsignals

        self.trains1 = self.seg1.spiketrains
        self.trains2 = self.seg2.spiketrains

        self.epcs1 = self.seg1.epochs
        self.epcs2 = self.seg2.epochs
        self.evts1 = self.seg1.events
        self.evts2 = self.seg2.events

        self.sigarrs1a = clone_object(self.sigarrs1, n=2)
        self.irsigs1a = clone_object(self.irsigs1)

        self.trains1a = clone_object(self.trains1)

        self.epcs1a = clone_object(self.epcs1)
        self.evts1a = clone_object(self.evts1)
开发者ID:msenoville,项目名称:python-neo,代码行数:34,代码来源:test_segment.py


示例6: test__fake_neo__cascade

    def test__fake_neo__cascade(self):
        self.annotations['seed'] = None
        obj_type = 'ChannelIndex'
        cascade = True
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, ChannelIndex))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)

        for child in res.children_recur:
            del child.annotations['i']
            del child.annotations['j']

        self.assertEqual(len(res.units), 1)
        unit = res.units[0]
        self.assertEqual(unit.annotations, self.annotations)

        self.assertEqual(len(res.analogsignals), 1)
        self.assertEqual(res.analogsignals[0].annotations,
                         self.annotations)

        self.assertEqual(len(unit.spiketrains), 1)
        self.assertEqual(unit.spiketrains[0].annotations,
                         self.annotations)
开发者ID:msenoville,项目名称:python-neo,代码行数:25,代码来源:test_channelindex.py


示例7: test__fake_neo__cascade

    def test__fake_neo__cascade(self):
        self.annotations['seed'] = None
        obj_type = Segment
        cascade = True
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, Segment))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)

        self.assertEqual(len(res.analogsignals), 1)
        self.assertEqual(len(res.irregularlysampledsignals), 1)
        self.assertEqual(len(res.spiketrains), 1)
        self.assertEqual(len(res.events), 1)
        self.assertEqual(len(res.epochs), 1)
        for child in res.children:
            del child.annotations['i']
            del child.annotations['j']

        self.assertEqual(res.analogsignals[0].annotations,
                         self.annotations)
        self.assertEqual(res.irregularlysampledsignals[0].annotations,
                         self.annotations)
        self.assertEqual(res.spiketrains[0].annotations,
                         self.annotations)
        self.assertEqual(res.events[0].annotations,
                         self.annotations)
        self.assertEqual(res.epochs[0].annotations,
                         self.annotations)
开发者ID:msenoville,项目名称:python-neo,代码行数:29,代码来源:test_segment.py


示例8: setUp

    def setUp(self):
        self.nchildren = 2
        self.seed1 = 0
        self.seed2 = 10000
        self.rcg1 = fake_neo(RecordingChannelGroup,
                             seed=self.seed1, n=self.nchildren)
        self.rcg2 = fake_neo(RecordingChannelGroup,
                             seed=self.seed2, n=self.nchildren)
        self.targobj = self.rcg1

        self.rchans1 = self.rcg1.recordingchannels
        self.rchans2 = self.rcg2.recordingchannels
        self.units1 = self.rcg1.units
        self.units2 = self.rcg2.units
        self.sigarrs1 = self.rcg1.analogsignalarrays
        self.sigarrs2 = self.rcg2.analogsignalarrays

        self.rchans1a = clone_object(self.rchans1)
        self.units1a = clone_object(self.units1)
        self.sigarrs1a = clone_object(self.sigarrs1, n=2)

        self.spikes1 = [[spike for spike in unit.spikes]
                        for unit in self.units1]
        self.spikes2 = [[spike for spike in unit.spikes]
                        for unit in self.units2]
        self.trains1 = [[train for train in unit.spiketrains]
                        for unit in self.units1]
        self.trains2 = [[train for train in unit.spiketrains]
                        for unit in self.units2]
        self.sigs1 = [[sig for sig in rchan.analogsignals]
                      for rchan in self.rchans1]
        self.sigs2 = [[sig for sig in rchan.analogsignals]
                      for rchan in self.rchans2]
        self.irsigs1 = [[irsig for irsig in rchan.irregularlysampledsignals]
                        for rchan in self.rchans1]
        self.irsigs2 = [[irsig for irsig in rchan.irregularlysampledsignals]
                        for rchan in self.rchans2]

        self.spikes1 = sum(self.spikes1, [])
        self.spikes2 = sum(self.spikes2, [])
        self.trains1 = sum(self.trains1, [])
        self.trains2 = sum(self.trains2, [])
        self.sigs1 = sum(self.sigs1, [])
        self.sigs2 = sum(self.sigs2, [])
        self.irsigs1 = sum(self.irsigs1, [])
        self.irsigs2 = sum(self.irsigs2, [])
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:46,代码来源:test_recordingchannelgroup.py


示例9: setUp

    def setUp(self):
        self.nchildren = 2
        self.seed1 = 0
        self.seed2 = 10000
        self.rchan1 = fake_neo(RecordingChannel,
                               seed=self.seed1, n=self.nchildren)
        self.rchan2 = fake_neo(RecordingChannel,
                               seed=self.seed2, n=self.nchildren)
        self.targobj = self.rchan1

        self.sigs1 = self.rchan1.analogsignals
        self.sigs2 = self.rchan2.analogsignals
        self.irsigs1 = self.rchan1.irregularlysampledsignals
        self.irsigs2 = self.rchan2.irregularlysampledsignals

        self.sigs1a = clone_object(self.sigs1)
        self.irsigs1a = clone_object(self.irsigs1)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:17,代码来源:test_recordingchannel.py


示例10: test__fake_neo__cascade

    def test__fake_neo__cascade(self):
        self.annotations['seed'] = None
        obj_type = AnalogSignal
        cascade = True
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, AnalogSignal))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)
开发者ID:msenoville,项目名称:python-neo,代码行数:9,代码来源:test_analogsignal.py


示例11: test__fake_neo__cascade

    def test__fake_neo__cascade(self):
        self.annotations["seed"] = None
        obj_type = "Event"
        cascade = True
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, Event))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)
开发者ID:bal47,项目名称:python-neo,代码行数:9,代码来源:test_event.py


示例12: test__fake_neo__nocascade

    def test__fake_neo__nocascade(self):
        self.annotations['seed'] = None
        obj_type = 'IrregularlySampledSignal'
        cascade = False
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, IrregularlySampledSignal))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)
开发者ID:msenoville,项目名称:python-neo,代码行数:9,代码来源:test_irregularysampledsignal.py


示例13: test__fake_neo__nocascade

    def test__fake_neo__nocascade(self):
        self.annotations['seed'] = None
        obj_type = 'Epoch'
        cascade = False
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, Epoch))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)
开发者ID:Silmathoron,项目名称:python-neo,代码行数:9,代码来源:test_epoch.py


示例14: test_property_change

 def test_property_change(self):
     """ Make sure all attributes are saved properly after the change,
     including quantities, units, types etc."""
     iom = NeoHdf5IO(filename=self.test_file)
     for obj_type in objectnames:
         obj = fake_neo(obj_type, cascade=False)
         iom.save(obj)
         self.assertTrue(hasattr(obj, "hdf5_path"))
         replica = iom.get(obj.hdf5_path, cascade=False)
         assert_objects_equivalent(obj, replica)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:10,代码来源:test_hdf5io.py


示例15: test__merge

    def test__merge(self):
        unit1a = fake_neo(Unit, seed=self.seed1, n=self.nchildren)
        assert_same_sub_schema(self.unit1, unit1a)
        unit1a.annotate(seed=self.seed2)
        unit1a.spiketrains.append(self.trains2[0])
        unit1a.merge(self.unit2)
        self.check_creation(self.unit2)

        assert_same_sub_schema(self.trains1a + self.trains2,
                               unit1a.spiketrains)
开发者ID:INM-6,项目名称:python-neo,代码行数:10,代码来源:test_unit.py


示例16: test__fake_neo__nocascade

    def test__fake_neo__nocascade(self):
        self.annotations['seed'] = None
        obj_type = Unit
        cascade = False
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, Unit))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)

        self.assertEqual(len(res.spiketrains), 0)
开发者ID:INM-6,项目名称:python-neo,代码行数:11,代码来源:test_unit.py


示例17: test__fake_neo__nocascade

    def test__fake_neo__nocascade(self):
        self.annotations['seed'] = None
        obj_type = ChannelIndex
        cascade = False
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, ChannelIndex))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)

        self.assertEqual(len(res.units), 0)
        self.assertEqual(len(res.analogsignals), 0)
开发者ID:msenoville,项目名称:python-neo,代码行数:12,代码来源:test_channelindex.py


示例18: test__merge

    def test__merge(self):
        rchan1a = fake_neo(RecordingChannel, seed=self.seed1, n=self.nchildren)
        assert_same_sub_schema(self.rchan1, rchan1a)
        rchan1a.annotate(seed=self.seed2)
        rchan1a.analogsignals.append(self.sigs2[0])
        rchan1a.merge(self.rchan2)
        self.check_creation(self.rchan2)

        assert_same_sub_schema(self.sigs1a + self.sigs2,
                               rchan1a.analogsignals)
        assert_same_sub_schema(self.irsigs1a + self.irsigs2,
                               rchan1a.irregularlysampledsignals)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:12,代码来源:test_recordingchannel.py


示例19: test__fake_neo__nocascade

    def test__fake_neo__nocascade(self):
        self.annotations['seed'] = None
        obj_type = 'RecordingChannel'
        cascade = False
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, RecordingChannel))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)

        self.assertEqual(len(res.analogsignals), 0)
        self.assertEqual(len(res.irregularlysampledsignals), 0)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:12,代码来源:test_recordingchannel.py


示例20: test__fake_neo__nocascade

    def test__fake_neo__nocascade(self):
        self.annotations['seed'] = None
        obj_type = Block
        cascade = False
        res = fake_neo(obj_type=obj_type, cascade=cascade)

        self.assertTrue(isinstance(res, Block))
        assert_neo_object_is_compliant(res)
        self.assertEqual(res.annotations, self.annotations)

        self.assertEqual(len(res.segments), 0)
        self.assertEqual(len(res.channel_indexes), 0)
开发者ID:msenoville,项目名称:python-neo,代码行数:12,代码来源:test_block.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python generate_datasets.get_fake_value函数代码示例发布时间:2022-05-27
下一篇:
Python nestio.NestIO类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap