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

Python tools.assert_same_sub_schema函数代码示例

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

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



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

示例1: test__add_two_consistent_signals_should_preserve_data_complement

    def test__add_two_consistent_signals_should_preserve_data_complement(self):
        data2 = np.arange(10.0, 20.0)
        data2quant = data2*pq.mV
        signal2 = IrregularlySampledSignal(self.time1quant, signal=data2quant)
        assert_neo_object_is_compliant(signal2)

        result = self.signal1 + signal2
        self.assertIsInstance(result, IrregularlySampledSignal)
        assert_neo_object_is_compliant(result)
        self.assertEqual(result.name, 'spam')
        self.assertEqual(result.description, 'eggs')
        self.assertEqual(result.file_origin, 'testfile.txt')
        self.assertEqual(result.annotations, {'arg1': 'test'})

        targ = IrregularlySampledSignal(self.time1quant,
                                        signal=np.arange(10.0, 30.0, 2.0),
                                        units="mV",
                                        name='spam', description='eggs',
                                        file_origin='testfile.txt',
                                        arg1='test')
        assert_neo_object_is_compliant(targ)

        assert_array_equal(result, targ)
        assert_array_equal(self.time1quant, targ.times)
        assert_array_equal(result.times, targ.times)
        assert_same_sub_schema(result, targ)
开发者ID:msenoville,项目名称:python-neo,代码行数:26,代码来源:test_irregularysampledsignal.py


示例2: test__add_two_consistent_signals_should_preserve_data_complement

    def test__add_two_consistent_signals_should_preserve_data_complement(self):
        data2 = np.arange(10.0, 20.0)
        data2quant = data2 * pq.mV
        signal2 = AnalogSignal(data2quant, sampling_rate=1 * pq.kHz)
        assert_neo_object_is_compliant(signal2)

        result = self.signal1 + signal2
        self.assertIsInstance(result, AnalogSignal)
        assert_neo_object_is_compliant(result)
        self.assertEqual(result.name, "spam")
        self.assertEqual(result.description, "eggs")
        self.assertEqual(result.file_origin, "testfile.txt")
        self.assertEqual(result.annotations, {"arg1": "test"})

        targ = AnalogSignal(
            np.arange(10.0, 30.0, 2.0),
            units="mV",
            sampling_rate=1 * pq.kHz,
            name="spam",
            description="eggs",
            file_origin="testfile.txt",
            arg1="test",
        )
        assert_neo_object_is_compliant(targ)

        assert_arrays_equal(result, targ)
        assert_same_sub_schema(result, targ)
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:27,代码来源:test_analogsignal.py


示例3: test__filter_single_annotation_nodata_container

 def test__filter_single_annotation_nodata_container(self):
     targ = [self.segs1[1], self.chxs1[1],
             self.units1[1],
             self.units1[3]]
     res0 = self.targobj.filter(j=1,
                                data=False, container=True)
     assert_same_sub_schema(res0, targ)
开发者ID:msenoville,项目名称:python-neo,代码行数:7,代码来源:test_block.py


示例4: test__time_slice__offset

    def test__time_slice__offset(self):
        self.signal2.t_start = 10.0 * pq.s
        assert_neo_object_is_compliant(self.signal2)

        t_start = 12 * pq.s
        t_stop = 14 * pq.s

        result = self.signal2.time_slice(t_start, t_stop)
        self.assertIsInstance(result, AnalogSignalArray)
        assert_neo_object_is_compliant(result)
        self.assertEqual(result.name, 'spam')
        self.assertEqual(result.description, 'eggs')
        self.assertEqual(result.file_origin, 'testfile.txt')
        self.assertEqual(result.annotations, {'arg1': 'test'})

        targ = AnalogSignalArray(np.array([[2, 3], [2, 3]]).T,
                                 t_start=12.0*pq.ms,
                                 sampling_rate=1.0*pq.Hz, units='mV',
                                 name='spam', description='eggs',
                                 file_origin='testfile.txt', arg1='test')
        assert_neo_object_is_compliant(result)

        self.assertEqual(self.signal2.t_start, 10.0 * pq.s)
        self.assertEqual(result.t_stop, t_stop)
        self.assertEqual(result.t_start, t_start)
        self.assertEqual(result.sampling_rate, targ.sampling_rate)
        assert_arrays_equal(result, targ)
        assert_same_sub_schema(result, targ)
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:28,代码来源:test_analogsignalarray.py


示例5: test__time_slice__different_units

    def test__time_slice__different_units(self):
        self.signal2.t_start = 10.0 * pq.ms
        assert_neo_object_is_compliant(self.signal2)

        t_start = 2 * pq.s + 10.0 * pq.ms
        t_stop = 4 * pq.s + 10.0 * pq.ms

        result = self.signal2.time_slice(t_start, t_stop)
        self.assertIsInstance(result, AnalogSignalArray)
        assert_neo_object_is_compliant(result)
        self.assertEqual(result.name, 'spam')
        self.assertEqual(result.description, 'eggs')
        self.assertEqual(result.file_origin, 'testfile.txt')
        self.assertEqual(result.annotations, {'arg1': 'test'})

        targ = AnalogSignalArray(np.array([[2, 3], [2, 3]]).T,
                                 t_start=t_start.rescale(pq.ms),
                                 sampling_rate=1.0*pq.Hz, units='mV',
                                 name='spam', description='eggs',
                                 file_origin='testfile.txt', arg1='test')
        assert_neo_object_is_compliant(result)

        assert_neo_object_is_compliant(self.signal2)
        self.assertEqual(self.signal2.t_start, 10.0 * pq.ms)
        self.assertAlmostEqual(result.t_stop, t_stop, delta=1e-12*pq.ms)
        self.assertAlmostEqual(result.t_start, t_start, delta=1e-12*pq.ms)
        assert_arrays_almost_equal(result.times, targ.times, 1e-12*pq.ms)
        self.assertEqual(result.sampling_rate, targ.sampling_rate)
        assert_arrays_equal(result, targ)
        assert_same_sub_schema(result, targ)
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:30,代码来源:test_analogsignalarray.py


示例6: test__filter_single_annotation_container

    def test__filter_single_annotation_container(self):
        targ = [self.sigarrs1[1], self.irrsig1[1],
                self.trains1[1], self.trains1[3],
                self.units1[1]]

        res0 = self.targobj.filter(j=1, container=True)

        assert_same_sub_schema(res0, targ)
开发者ID:msenoville,项目名称:python-neo,代码行数:8,代码来源:test_channelindex.py


示例7: test_segment_take_analogsignal_by_unit

    def test_segment_take_analogsignal_by_unit(self):
        result1 = self.seg1.take_analogsignal_by_unit()
        result21 = self.seg1.take_analogsignal_by_unit([self.unit1])
        result22 = self.seg1.take_analogsignal_by_unit([self.unit2])

        self.assertEqual(result1, [])

        assert_same_sub_schema(result21, [self.sigs1a[0]])
        assert_same_sub_schema(result22, [self.sigs1a[1]])
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:9,代码来源:test_segment.py


示例8: test_segment_take_spiketrains_by_unit

    def test_segment_take_spiketrains_by_unit(self):
        result1 = self.seg1.take_spiketrains_by_unit()
        result21 = self.seg1.take_spiketrains_by_unit([self.unit1])
        result22 = self.seg1.take_spiketrains_by_unit([self.unit2])

        self.assertEqual(result1, [])

        assert_same_sub_schema(result21, [self.trains1a[0]])
        assert_same_sub_schema(result22, [self.trains1a[1]])
开发者ID:msenoville,项目名称:python-neo,代码行数:9,代码来源:test_segment.py


示例9: 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


示例10: test_segment_take_analogsignal_by_channelindex

    def test_segment_take_analogsignal_by_channelindex(self):
        ind1 = self.unit1.channel_indexes[0]
        ind2 = self.unit2.channel_indexes[0]
        result1 = self.seg1.take_analogsignal_by_channelindex()
        result21 = self.seg1.take_analogsignal_by_channelindex([ind1])
        result22 = self.seg1.take_analogsignal_by_channelindex([ind2])

        self.assertEqual(result1, [])

        assert_same_sub_schema(result21, [self.sigs1a[0]])
        assert_same_sub_schema(result22, [self.sigs1a[1]])
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:11,代码来源:test_segment.py


示例11: test__filter_single_annotation_container

    def test__filter_single_annotation_container(self):
        targ = ([self.epcs1[1], self.evts1[1]] +
                 self.sigarrs1[1::2] +
                [self.epcs1[3], self.evts1[3]] +
                self.irsigs1[1::2] +
                self.trains1[1::2] +
                [self.segs1[1], self.chxs1[1],
                 self.units1[1],
                 self.units1[3]])

        res0 = self.targobj.filter(j=1, container=True)

        assert_same_sub_schema(res0, targ)
开发者ID:msenoville,项目名称:python-neo,代码行数:13,代码来源:test_block.py


示例12: test_reading_same

    def test_reading_same(self):
        for ioobj, path in self.iter_io_objects(return_path=True):
            obj_reader_base = create_generic_reader(ioobj, target=False)
            obj_reader_single = create_generic_reader(ioobj)

            obj_base = obj_reader_base()
            obj_single = obj_reader_single()

            try:
                assert_same_sub_schema(obj_base, obj_single)
            except BaseException as exc:
                exc.args += ("from " + os.path.basename(path),)
                raise
开发者ID:bal47,项目名称:python-neo,代码行数:13,代码来源:test_brainwaref32io.py


示例13: test_against_reference

    def test_against_reference(self):
        for obj, path in self.iter_objects(return_path=True):
            filename = os.path.basename(path)

            refpath = os.path.splitext(path)[0] + self.suffix
            refobj = proc_f32(refpath)

            try:
                assert_neo_object_is_compliant(obj)
                assert_neo_object_is_compliant(refobj)
                assert_same_sub_schema(obj, refobj)
            except BaseException as exc:
                exc.args += ("from " + filename,)
                raise
开发者ID:bal47,项目名称:python-neo,代码行数:14,代码来源:test_brainwaref32io.py


示例14: test__filter_annotation_single

    def test__filter_annotation_single(self):
        targ = [self.trains1a[1]]

        res0 = self.targobj.filter(j=1)
        res1 = self.targobj.filter({'j': 1})
        res2 = self.targobj.filter(targdict={'j': 1})
        res3 = self.targobj.filter([{'j': 1}])
        res4 = self.targobj.filter(targdict=[{'j': 1}])

        assert_same_sub_schema(res0, targ)
        assert_same_sub_schema(res1, targ)
        assert_same_sub_schema(res2, targ)
        assert_same_sub_schema(res3, targ)
        assert_same_sub_schema(res4, targ)
开发者ID:INM-6,项目名称:python-neo,代码行数:14,代码来源:test_unit.py


示例15: test_seg_take_slice_of_analogsignalarray_by_unit

    def test_seg_take_slice_of_analogsignalarray_by_unit(self):
        seg = self.seg1
        result1 = seg.take_slice_of_analogsignalarray_by_unit()
        result21 = seg.take_slice_of_analogsignalarray_by_unit([self.unit1])
        result23 = seg.take_slice_of_analogsignalarray_by_unit([self.unit3])

        self.assertEqual(result1, [])

        targ1 = [self.sigarrs1a[0][:, np.array([True])],
                 self.sigarrs1a[1][:, np.array([False])]]
        targ3 = [self.sigarrs1a[0][:, np.array([False])],
                 self.sigarrs1a[1][:, np.array([True])]]
        assert_same_sub_schema(result21, targ1)
        assert_same_sub_schema(result23, targ3)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:14,代码来源:test_segment.py


示例16: test__rescale_same

    def test__rescale_same(self):
        result = self.signal1.copy()
        result = result.rescale(pq.nA)

        self.assertIsInstance(result, AnalogSignal)
        assert_neo_object_is_compliant(result)
        self.assertEqual(result.name, 'spam')
        self.assertEqual(result.description, 'eggs')
        self.assertEqual(result.file_origin, 'testfile.txt')
        self.assertEqual(result.annotations, {'arg1': 'test'})

        self.assertEqual(result.units, 1*pq.nA)
        assert_arrays_equal(result, self.data1)
        assert_same_sub_schema(result, self.signal1)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:14,代码来源:test_analogsignal.py


示例17: test_create

 def test_create(self):
     """
     Create test file with signals, segments, blocks etc.
     """
     iom = NeoHdf5IO(filename=self.test_file)
     b1 = fake_neo()  # creating a structure
     iom.save(b1)  # saving
     # must be assigned after save
     self.assertTrue(hasattr(b1, "hdf5_path"))
     iom.close()
     iom.connect(filename=self.test_file)
     b2 = iom.get(b1.hdf5_path)  # new object
     assert_neo_object_is_compliant(b2)
     assert_same_sub_schema(b1, b2)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:14,代码来源:test_hdf5io.py


示例18: test__filter_single_annotation_nores

    def test__filter_single_annotation_nores(self):
        targ = []

        res0 = self.targobj.filter(j=5)
        res1 = self.targobj.filter({'j': 5})
        res2 = self.targobj.filter(targdict={'j': 5})
        res3 = self.targobj.filter([{'j': 5}])
        res4 = self.targobj.filter(targdict=[{'j': 5}])

        assert_same_sub_schema(res0, targ)
        assert_same_sub_schema(res1, targ)
        assert_same_sub_schema(res2, targ)
        assert_same_sub_schema(res3, targ)
        assert_same_sub_schema(res4, targ)
开发者ID:INM-6,项目名称:python-neo,代码行数:14,代码来源:test_unit.py


示例19: test_against_reference

 def test_against_reference(self):
     for filename, refname in zip(self.files_to_test,
                                  self.files_to_compare):
         if not refname:
             continue
         obj = self.read_file(filename=filename, readall=True)[0]
         refobj = proc_src(self.get_filename_path(refname))
         try:
             assert_neo_object_is_compliant(obj)
             assert_neo_object_is_compliant(refobj)
             assert_same_sub_schema(obj, refobj)
         except BaseException as exc:
             exc.args += ('from ' + filename,)
             raise
开发者ID:INM-6,项目名称:python-neo,代码行数:14,代码来源:test_brainwaresrcio.py


示例20: test__rescale_same

    def test__rescale_same(self):
        result = self.signal1.copy()
        result = result.rescale(pq.mV)

        self.assertIsInstance(result, IrregularlySampledSignal)
        assert_neo_object_is_compliant(result)
        self.assertEqual(result.name, 'spam')
        self.assertEqual(result.description, 'eggs')
        self.assertEqual(result.file_origin, 'testfile.txt')
        self.assertEqual(result.annotations, {'arg1': 'test'})

        self.assertEqual(result.units, 1*pq.mV)
        assert_array_equal(result.magnitude, self.data1.reshape(-1, 1))
        assert_array_equal(result.times, self.time1quant)
        assert_same_sub_schema(result, self.signal1)
开发者ID:CINPLA,项目名称:python-neo,代码行数:15,代码来源:test_irregularysampledsignal.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tests.Person类代码示例发布时间:2022-05-27
下一篇:
Python tools.assert_neo_object_is_compliant函数代码示例发布时间: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