Beispiel #1
0
    def test_EventArray_merge(self):
        params1 = {'testarg2': 'yes', 'testarg3': True}
        params2 = {'testarg2': 'no', 'testarg4': False}
        paramstarg = {
            'testarg2': 'yes;no',
            'testarg3': True,
            'testarg4': False
        }
        epca1 = EventArray(
            [1.1, 1.5, 1.7] * pq.ms,
            labels=np.array(
                ['test event 1 1', 'test event 1 2', 'test event 1 3'],
                dtype='S'),
            name='test',
            description='tester 1',
            file_origin='test.file',
            testarg1=1,
            **params1)
        epca2 = EventArray(
            [2.1, 2.5, 2.7] * pq.us,
            labels=np.array(
                ['test event 2 1', 'test event 2 2', 'test event 2 3'],
                dtype='S'),
            name='test',
            description='tester 2',
            file_origin='test.file',
            testarg1=1,
            **params2)
        epcatarg = EventArray(
            [1.1, 1.5, 1.7, .0021, .0025, .0027] * pq.ms,
            labels=np.array([
                'test event 1 1', 'test event 1 2', 'test event 1 3',
                'test event 2 1', 'test event 2 2', 'test event 2 3'
            ],
                            dtype='S'),
            name='test',
            description='merge(tester 1, tester 2)',
            file_origin='test.file',
            testarg1=1,
            **paramstarg)
        assert_neo_object_is_compliant(epca1)
        assert_neo_object_is_compliant(epca2)
        assert_neo_object_is_compliant(epcatarg)

        epcares = epca1.merge(epca2)
        assert_neo_object_is_compliant(epcares)
        assert_same_sub_schema(epcatarg, epcares)
    def test_EventArray_merge(self):
        params1 = {'testarg2': 'yes', 'testarg3': True}
        params2 = {'testarg2': 'no', 'testarg4': False}
        paramstarg = {'testarg2': 'yes;no',
                      'testarg3': True,
                      'testarg4': False}
        epca1 = EventArray([1.1, 1.5, 1.7]*pq.ms,
                           labels=np.array(['test event 1 1',
                                            'test event 1 2',
                                            'test event 1 3'], dtype='S'),
                           name='test', description='tester 1',
                           file_origin='test.file',
                           testarg1=1, **params1)
        epca2 = EventArray([2.1, 2.5, 2.7]*pq.us,
                           labels=np.array(['test event 2 1',
                                            'test event 2 2',
                                            'test event 2 3'], dtype='S'),
                           name='test', description='tester 2',
                           file_origin='test.file',
                           testarg1=1, **params2)
        epcatarg = EventArray([1.1, 1.5, 1.7, .0021, .0025, .0027]*pq.ms,
                              labels=np.array(['test event 1 1',
                                               'test event 1 2',
                                               'test event 1 3',
                                               'test event 2 1',
                                               'test event 2 2',
                                               'test event 2 3'], dtype='S'),
                              name='test',
                              description='merge(tester 1, tester 2)',
                              file_origin='test.file',
                              testarg1=1, **paramstarg)
        assert_neo_object_is_compliant(epca1)
        assert_neo_object_is_compliant(epca2)
        assert_neo_object_is_compliant(epcatarg)

        epcares = epca1.merge(epca2)
        assert_neo_object_is_compliant(epcares)
        assert_same_sub_schema(epcatarg, epcares)