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

Python tools.assert_neo_object_is_compliant函数代码示例

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

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



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

示例1: test_time_slice_differnt_units

    def test_time_slice_differnt_units(self):
        params = {'test2': 'y1', 'test3': True}
        arr_ann = {'index': np.arange(9), 'test': np.arange(100, 109)}
        evt = Event([0.1, 0.5, 1.1, 1.5, 1.7, 2.2, 2.9, 3.1, 3.3] * pq.ms, name='test',
                    description='tester', file_origin='test.file', test1=1,
                    array_annotations=arr_ann, **params)
        assert_neo_object_is_compliant(evt)
        evt.annotate(test1=1.1, test0=[1, 2])

        targ = Event([2.2, 2.9] * pq.ms, name='test', description='tester',
                     file_origin='test.file', test1=1, **params)
        assert_neo_object_is_compliant(targ)
        targ.annotate(test1=1.1, test0=[1, 2])

        t_start = 0.002 * pq.s
        t_stop = 0.003 * pq.s

        result = evt.time_slice(t_start, t_stop)

        assert_arrays_equal(targ, result)
        self.assertEqual(targ.name, result.name)
        self.assertEqual(targ.description, result.description)
        self.assertEqual(targ.file_origin, result.file_origin)
        self.assertEqual(targ.annotations['test0'], result.annotations['test0'])
        self.assertEqual(targ.annotations['test1'], result.annotations['test1'])
        self.assertEqual(targ.annotations['test2'], result.annotations['test2'])
        assert_arrays_equal(result.array_annotations['index'], np.arange(5, 7))
        assert_arrays_equal(result.array_annotations['test'], np.arange(105, 107))
        self.assertIsInstance(result.array_annotations, ArrayDict)
开发者ID:INM-6,项目名称:python-neo,代码行数:29,代码来源:test_event.py


示例2: test__slice_should_return_AnalogSignalArray

    def test__slice_should_return_AnalogSignalArray(self):
        # slice
        for index in (0, np.int64(0)):
            result = self.signal1[3:8, index]
            self.assertIsInstance(result, AnalogSignal)
            assert_neo_object_is_compliant(result)
            self.assertEqual(result.name, 'spam')         # should slicing really preserve name and description?
            self.assertEqual(result.description, 'eggs')  # perhaps these should be modified to indicate the slice?
            self.assertEqual(result.file_origin, 'testfile.txt')
            self.assertEqual(result.annotations, {'arg1': 'test'})

            self.assertEqual(result.size, 5)
            self.assertEqual(result.sampling_period, self.signal1.sampling_period)
            self.assertEqual(result.sampling_rate, self.signal1.sampling_rate)
            self.assertEqual(result.t_start,
                             self.signal1.t_start+3*result.sampling_period)
            self.assertEqual(result.t_stop,
                             result.t_start + 5*result.sampling_period)
            assert_array_equal(result.magnitude, self.data1[3:8].reshape(-1, 1))

            # Test other attributes were copied over (in this case, defaults)
            self.assertEqual(result.file_origin, self.signal1.file_origin)
            self.assertEqual(result.name, self.signal1.name)
            self.assertEqual(result.description, self.signal1.description)
            self.assertEqual(result.annotations, self.signal1.annotations)
开发者ID:msenoville,项目名称:python-neo,代码行数:25,代码来源:test_analogsignal.py


示例3: test__children

    def test__children(self):
        params = {'test2': 'y1', 'test3': True}
        epc = Epoch([1.1, 1.5, 1.7]*pq.ms, durations=[20, 40, 60]*pq.ns,
                    labels=np.array(['test epoch 1',
                                     'test epoch 2',
                                     'test epoch 3'], dtype='S'),
                    name='test', description='tester',
                    file_origin='test.file',
                    test1=1, **params)
        epc.annotate(test1=1.1, test0=[1, 2])
        assert_neo_object_is_compliant(epc)

        segment = Segment(name='seg1')
        segment.epochs = [epc]
        segment.create_many_to_one_relationship()

        self.assertEqual(epc._single_parent_objects, ('Segment',))
        self.assertEqual(epc._multi_parent_objects, ())

        self.assertEqual(epc._single_parent_containers, ('segment',))
        self.assertEqual(epc._multi_parent_containers, ())

        self.assertEqual(epc._parent_objects, ('Segment',))
        self.assertEqual(epc._parent_containers, ('segment',))

        self.assertEqual(len(epc.parents), 1)
        self.assertEqual(epc.parents[0].name, 'seg1')

        assert_neo_object_is_compliant(epc)
开发者ID:Silmathoron,项目名称:python-neo,代码行数:29,代码来源:test_epoch.py


示例4: test_time_slice_none_both

    def test_time_slice_none_both(self):
        targdataquant = [[0.0], [1.0], [2.0], [3.0], [4.0], [5.0], [6.0], [7.0], [8.0],
                         [9.0]] * pq.mV
        targtime = np.logspace(1, 5, 10)
        targtimequant = targtime[0:10] * pq.ms
        targ_signal = IrregularlySampledSignal(targtimequant, signal=targdataquant, name='spam',
                                               description='eggs', file_origin='testfile.txt',
                                               arg1='test')

        t_start = None
        t_stop = None
        result = self.signal1.time_slice(t_start, t_stop)

        assert_array_equal(result, targ_signal)
        assert_array_equal(result.times, targtimequant)
        self.assertEqual(result.units, 1 * 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'})
        assert_arrays_equal(result.array_annotations['anno1'], np.array([23]))
        assert_arrays_equal(result.array_annotations['anno2'], np.array(['A']))
        self.assertIsInstance(result.array_annotations, ArrayDict)
开发者ID:INM-6,项目名称:python-neo,代码行数:25,代码来源:test_irregularysampledsignal.py


示例5: test__sampling_period

    def test__sampling_period(self):
        result1 = self.spike1.sampling_period

        self.spike1.sampling_rate = None
        assert_neo_object_is_compliant(self.spike1)
        result2 = self.spike1.sampling_period

        self.spike1.sampling_rate = self.sampling_rate1
        self.spike1.sampling_period = 10.0 * pq.ms
        assert_neo_object_is_compliant(self.spike1)
        result3a = self.spike1.sampling_period
        result3b = self.spike1.sampling_rate

        self.spike1.sampling_period = None
        result4a = self.spike1.sampling_period
        result4b = self.spike1.sampling_rate

        self.assertEqual(result1, 10.0 / pq.Hz)
        self.assertEqual(result1.units, 1.0 / pq.Hz)
        self.assertEqual(result2, None)
        self.assertEqual(result3a, 10.0 * pq.ms)
        self.assertEqual(result3a.units, 1.0 * pq.ms)
        self.assertEqual(result3b, 0.1 / pq.ms)
        self.assertEqual(result3b.units, 1.0 / pq.ms)
        self.assertEqual(result4a, None)
        self.assertEqual(result4b, None)
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:26,代码来源:test_spike.py


示例6: test_defaults

    def test_defaults(self):
        res = generate_one_simple_block()

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

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


示例7: test_time_slice_empty

    def test_time_slice_empty(self):
        params = {'test2': 'y1', 'test3': True}
        epc = Epoch([]*pq.ms, durations=[]*pq.ns,
                    labels=np.array([], dtype='S'),
                    name='test', description='tester',
                    file_origin='test.file',
                    test1=1, **params)
        epc.annotate(test1=1.1, test0=[1, 2])
        assert_neo_object_is_compliant(epc)

        targ = Epoch([]*pq.ms, durations=[]*pq.ns,
                    labels=np.array([], dtype='S'),
                    name='test', description='tester',
                    file_origin='test.file',
                    test1=1, **params)
        targ.annotate(test1=1.1, test0=[1, 2])
        assert_neo_object_is_compliant(targ)
        
        t_start = 1.2
        t_stop = 1.6
        result = epc.time_slice(t_start, t_stop)

        assert_arrays_equal(result.times, targ.times)
        assert_arrays_equal(result.durations, targ.durations)
        assert_arrays_equal(result.labels, targ.labels)
        self.assertEqual(result.name, targ.name)
        self.assertEqual(result.description, targ.description)
        self.assertEqual(result.file_origin, targ.file_origin)
        self.assertEqual(result.annotations['test0'], targ.annotations['test0'])
        self.assertEqual(result.annotations['test1'], targ.annotations['test1'])
        self.assertEqual(result.annotations['test2'], targ.annotations['test2'])
开发者ID:CINPLA,项目名称:python-neo,代码行数:31,代码来源:test_epoch.py


示例8: test__children

    def test__children(self):
        params = {"test2": "y1", "test3": True}
        evt = Event(
            1.5 * pq.ms,
            label="test epoch",
            name="test",
            description="tester",
            file_origin="test.file",
            test1=1,
            **params
        )
        evt.annotate(test1=1.1, test0=[1, 2])
        assert_neo_object_is_compliant(evt)

        segment = Segment(name="seg1")
        segment.events = [evt]
        segment.create_many_to_one_relationship()

        self.assertEqual(evt._single_parent_objects, ("Segment",))
        self.assertEqual(evt._multi_parent_objects, ())

        self.assertEqual(evt._single_parent_containers, ("segment",))
        self.assertEqual(evt._multi_parent_containers, ())

        self.assertEqual(evt._parent_objects, ("Segment",))
        self.assertEqual(evt._parent_containers, ("segment",))

        self.assertEqual(len(evt.parents), 1)
        self.assertEqual(evt.parents[0].name, "seg1")

        assert_neo_object_is_compliant(evt)
开发者ID:bal47,项目名称:python-neo,代码行数:31,代码来源:test_event.py


示例9: test__children

    def test__children(self):
        segment = Segment(name='seg1')
        segment.spikes = [self.spike1]
        segment.create_many_to_one_relationship()

        unit = Unit(name='unit1')
        unit.spikes = [self.spike1]
        unit.create_many_to_one_relationship()

        self.assertEqual(self.spike1._single_parent_objects,
                         ('Segment', 'Unit'))
        self.assertEqual(self.spike1._multi_parent_objects, ())

        self.assertEqual(self.spike1._single_parent_containers,
                         ('segment', 'unit'))
        self.assertEqual(self.spike1._multi_parent_containers, ())

        self.assertEqual(self.spike1._parent_objects,
                         ('Segment', 'Unit'))
        self.assertEqual(self.spike1._parent_containers,
                         ('segment', 'unit'))

        self.assertEqual(len(self.spike1.parents), 2)
        self.assertEqual(self.spike1.parents[0].name, 'seg1')
        self.assertEqual(self.spike1.parents[1].name, 'unit1')

        assert_neo_object_is_compliant(self.spike1)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:27,代码来源:test_spike.py


示例10: test__create_with_copy_true_should_return_copy

 def test__create_with_copy_true_should_return_copy(self):
     data = np.arange(20.0).reshape((10, 2)) * pq.mV
     rate = 5000 * pq.Hz
     signal = AnalogSignal(data, copy=True, sampling_rate=rate)
     assert_neo_object_is_compliant(signal)
     data[3, 0] = 0.099 * pq.V
     self.assertNotEqual(signal[3, 0], 99 * pq.mV)
开发者ID:INM-6,项目名称:python-neo,代码行数:7,代码来源:test_analogsignalarray.py


示例11: test__children

    def test__children(self):
        signal = self.signals[0]

        segment = Segment(name='seg1')
        segment.analogsignals = [signal]
        segment.create_many_to_one_relationship()

        chx = ChannelIndex(name='chx1', index=np.arange(signal.shape[1]))
        chx.analogsignals = [signal]
        chx.create_many_to_one_relationship()

        self.assertEqual(signal._single_parent_objects, ('Segment', 'ChannelIndex'))
        self.assertEqual(signal._multi_parent_objects, ())

        self.assertEqual(signal._single_parent_containers, ('segment', 'channel_index'))
        self.assertEqual(signal._multi_parent_containers, ())

        self.assertEqual(signal._parent_objects, ('Segment', 'ChannelIndex'))
        self.assertEqual(signal._parent_containers, ('segment', 'channel_index'))

        self.assertEqual(len(signal.parents), 2)
        self.assertEqual(signal.parents[0].name, 'seg1')
        self.assertEqual(signal.parents[1].name, 'chx1')

        assert_neo_object_is_compliant(signal)
开发者ID:INM-6,项目名称:python-neo,代码行数:25,代码来源:test_analogsignalarray.py


示例12: check_creation

    def check_creation(self, rchan):
        assert_neo_object_is_compliant(rchan)

        seed = rchan.annotations['seed']

        targ0 = get_fake_value('index', int, seed=seed+0, obj=RecordingChannel)
        self.assertEqual(rchan.index, targ0)

        targ1 = get_fake_value('coordinate', pq.Quantity, dim=1, seed=seed+1)
        assert_arrays_equal(rchan.coordinate, targ1)

        targ2 = get_fake_value('name', str, seed=seed+2, obj=RecordingChannel)
        self.assertEqual(rchan.name, targ2)

        targ3 = get_fake_value('description', str,
                               seed=seed+3, obj=RecordingChannel)
        self.assertEqual(rchan.description, targ3)

        targ4 = get_fake_value('file_origin', str)
        self.assertEqual(rchan.file_origin, targ4)

        targ5 = get_annotations()
        targ5['seed'] = seed
        self.assertEqual(rchan.annotations, targ5)

        self.assertTrue(hasattr(rchan, 'analogsignals'))
        self.assertTrue(hasattr(rchan, 'irregularlysampledsignals'))

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


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


示例14: test_recordingchannelgroup__compliance

    def test_recordingchannelgroup__compliance(self):
        assert_neo_object_is_compliant(self.rcg1)
        assert_neo_object_is_compliant(self.rcg2)

        self.assertEqual(self.rcg1.name, 'test')
        self.assertEqual(self.rcg2.name, 'test')

        self.assertEqual(self.rcg1.description, 'tester 1')
        self.assertEqual(self.rcg2.description, 'tester 2')

        self.assertEqual(self.rcg1.file_origin, 'test.file')
        self.assertEqual(self.rcg2.file_origin, 'test.file')

        self.assertEqual(self.rcg1.annotations['testarg0'], [1, 2, 3])
        self.assertEqual(self.rcg2.annotations['testarg10'], [1, 2, 3])

        self.assertEqual(self.rcg1.annotations['testarg1'], 1.1)
        self.assertEqual(self.rcg2.annotations['testarg1'], 1)
        self.assertEqual(self.rcg2.annotations['testarg11'], 1.1)

        self.assertEqual(self.rcg1.annotations['testarg2'], 'yes')
        self.assertEqual(self.rcg2.annotations['testarg2'], 'yes')

        self.assertTrue(self.rcg1.annotations['testarg3'])
        self.assertTrue(self.rcg2.annotations['testarg3'])

        self.assertTrue(hasattr(self.rcg1, 'units'))
        self.assertTrue(hasattr(self.rcg2, 'units'))

        self.assertEqual(len(self.rcg1.units), 2)
        self.assertEqual(len(self.rcg2.units), 3)

        self.assertEqual(self.rcg1.units, self.units1)
        self.assertEqual(self.rcg2.units, self.units2)

        self.assertTrue(hasattr(self.rcg1, 'recordingchannels'))
        self.assertTrue(hasattr(self.rcg2, 'recordingchannels'))

        self.assertEqual(len(self.rcg1.recordingchannels), 2)
        self.assertEqual(len(self.rcg2.recordingchannels), 3)

        for res, targ in zip(self.rcg1.recordingchannels, self.rchan1):
            self.assertEqual(res.name, targ.name)

        for res, targ in zip(self.rcg2.recordingchannels, self.rchan2):
            self.assertEqual(res.name, targ.name)

        self.assertTrue(hasattr(self.rcg1, 'analogsignalarrays'))
        self.assertTrue(hasattr(self.rcg2, 'analogsignalarrays'))

        self.assertEqual(len(self.rcg1.analogsignalarrays), 2)
        self.assertEqual(len(self.rcg2.analogsignalarrays), 3)

        for res, targ in zip(self.rcg1.analogsignalarrays, self.sigarr1):
            assert_arrays_equal(res, targ)
            self.assertEqual(res.name, targ.name)

        for res, targ in zip(self.rcg2.analogsignalarrays, self.sigarr2):
            assert_arrays_equal(res, targ)
            self.assertEqual(res.name, targ.name)
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:60,代码来源:test_recordingchannelgroup.py


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


示例16: test_time_slice_differnt_units

    def test_time_slice_differnt_units(self): 
        params = {'test2': 'y1', 'test3': True}
        evt = Event([0.1, 0.5, 1.1, 1.5, 1.7, 2.2, 2.9, 3.1, 3.3]*pq.ms,
                    name='test', description='tester',
                    file_origin='test.file',
                    test1=1, **params)
        assert_neo_object_is_compliant(evt)        
        evt.annotate(test1=1.1, test0=[1, 2]) 

        targ = Event([ 2.2, 2.9 ]*pq.ms,
                    name='test', description='tester',
                    file_origin='test.file',
                    test1=1, **params)
        assert_neo_object_is_compliant(targ)        
        targ.annotate(test1=1.1, test0=[1, 2]) 
        
        t_start = 0.002 * pq.s
        t_stop = 0.003 * pq.s

        result = evt.time_slice(t_start, t_stop)

        assert_arrays_equal(targ, result)
        self.assertEqual(targ.name, result.name)
        self.assertEqual(targ.description, result.description)
        self.assertEqual(targ.file_origin, result.file_origin)
        self.assertEqual(targ.annotations['test0'], result.annotations['test0'])
        self.assertEqual(targ.annotations['test1'], result.annotations['test1'])
        self.assertEqual(targ.annotations['test2'], result.annotations['test2'])
开发者ID:msenoville,项目名称:python-neo,代码行数:28,代码来源:test_event.py


示例17: test_block_segment

    def test_block_segment(self):
        objects = [Segment, Block]

        res = generate_from_supported_objects(objects)

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

        self.assertEqual(len(res.segments), 3)
        seg1, seg2, seg3 = res.segments

        self.assertEqual(len(seg1.analogsignals), 0)
        self.assertEqual(len(seg1.irregularlysampledsignals), 0)
        self.assertEqual(len(seg1.spiketrains), 0)
        self.assertEqual(len(seg1.events), 0)
        self.assertEqual(len(seg1.epochs), 0)

        self.assertEqual(len(seg2.analogsignals), 0)
        self.assertEqual(len(seg2.irregularlysampledsignals), 0)
        self.assertEqual(len(seg2.spiketrains), 0)
        self.assertEqual(len(seg2.events), 0)
        self.assertEqual(len(seg2.epochs), 0)

        self.assertEqual(len(seg3.analogsignals), 0)
        self.assertEqual(len(seg3.irregularlysampledsignals), 0)
        self.assertEqual(len(seg3.spiketrains), 0)
        self.assertEqual(len(seg3.events), 0)
        self.assertEqual(len(seg3.epochs), 0)
开发者ID:INM-6,项目名称:python-neo,代码行数:28,代码来源:test_generate_datasets.py


示例18: test_time_slice_none_both

    def test_time_slice_none_both(self):
        params = {'test2': 'y1', 'test3': True}
        arr_ann = {'index': np.arange(3), 'test': ['a', 'b', 'c']}
        epc = Epoch([1.1, 1.5, 1.7] * pq.ms, durations=[20, 40, 60] * pq.ns,
                    labels=np.array(['test epoch 1', 'test epoch 2', 'test epoch 3'], dtype='S'),
                    name='test', description='tester', file_origin='test.file', test1=1,
                    array_annotations=arr_ann, **params)
        epc.annotate(test1=1.1, test0=[1, 2])
        assert_neo_object_is_compliant(epc)

        targ = Epoch([1.1, 1.5, 1.7] * pq.ms, durations=[20, 40, 60] * pq.ns,
                     labels=np.array(['test epoch 1', 'test epoch 2', 'test epoch 3'], dtype='S'),
                     name='test', description='tester', file_origin='test.file', test1=1,
                     array_annotations=arr_ann, **params)
        targ.annotate(test1=1.1, test0=[1, 2])
        assert_neo_object_is_compliant(targ)

        t_start = None
        t_stop = None
        result = epc.time_slice(t_start, t_stop)

        assert_arrays_equal(result.times, targ.times)
        assert_arrays_equal(result.durations, targ.durations)
        assert_arrays_equal(result.labels, targ.labels)
        self.assertEqual(result.name, targ.name)
        self.assertEqual(result.description, targ.description)
        self.assertEqual(result.file_origin, targ.file_origin)
        self.assertEqual(result.annotations['test0'], targ.annotations['test0'])
        self.assertEqual(result.annotations['test1'], targ.annotations['test1'])
        self.assertEqual(result.annotations['test2'], targ.annotations['test2'])
        assert_arrays_equal(result.array_annotations['index'], np.array([0, 1, 2]))
        assert_arrays_equal(result.array_annotations['test'], np.array(['a', 'b', 'c']))
        self.assertIsInstance(result.array_annotations, ArrayDict)
开发者ID:INM-6,项目名称:python-neo,代码行数:33,代码来源:test_epoch.py


示例19: test_all_supported

    def test_all_supported(self):
        objects = [Block, Segment, ChannelIndex, Unit, AnalogSignal, IrregularlySampledSignal,
                   SpikeTrain, Event, Epoch]

        res = generate_one_simple_block(supported_objects=objects)

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

        self.assertEqual(len(res.segments), 3)
        seg1, seg2, seg3 = res.segments

        self.assertEqual(len(seg1.analogsignals), 4)
        self.assertEqual(len(seg1.irregularlysampledsignals), 0)
        self.assertEqual(len(seg1.spiketrains), 6)
        self.assertEqual(len(seg1.events), 3)
        self.assertEqual(len(seg1.epochs), 2)

        self.assertEqual(len(seg2.analogsignals), 4)
        self.assertEqual(len(seg2.irregularlysampledsignals), 0)
        self.assertEqual(len(seg2.spiketrains), 6)
        self.assertEqual(len(seg2.events), 3)
        self.assertEqual(len(seg2.epochs), 2)

        self.assertEqual(len(seg3.analogsignals), 4)
        self.assertEqual(len(seg3.irregularlysampledsignals), 0)
        self.assertEqual(len(seg3.spiketrains), 6)
        self.assertEqual(len(seg3.events), 3)
        self.assertEqual(len(seg3.epochs), 2)
开发者ID:INM-6,项目名称:python-neo,代码行数:29,代码来源:test_generate_datasets.py


示例20: test__create_with_copy_false_should_return_view

 def test__create_with_copy_false_should_return_view(self):
     data = np.arange(20.0).reshape((10, 2)) * pq.mV
     rate = 5000*pq.Hz
     signal = AnalogSignalArray(data, copy=False, sampling_rate=rate)
     assert_neo_object_is_compliant(signal)
     data[3, 0] = 99*pq.mV
     self.assertEqual(signal[3, 0], 99000*pq.uV)
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:7,代码来源:test_analogsignalarray.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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