Ejemplo n.º 1
0
 def test_init(self):
     is1 = ImageSeries(name='is1',
                       data=np.ones((2, 2, 2)),
                       unit='unit',
                       external_file=['external_file'],
                       starting_frame=[1, 2, 3],
                       format='tiff',
                       timestamps=[1., 2.])
     is2 = ImageSeries(name='is2',
                       data=np.ones((2, 2, 2)),
                       unit='unit',
                       external_file=['external_file'],
                       starting_frame=[1, 2, 3],
                       format='tiff',
                       timestamps=[1., 2.])
     tstamps = np.arange(1.0, 100.0, 0.1, dtype=np.float)
     ts = TimeSeries("test_ts",
                     list(range(len(tstamps))),
                     'unit',
                     timestamps=tstamps)
     cis = CorrectedImageStack(is1, is2, ts)
     ProcessingModule('name', 'description').add(cis)
     self.assertEqual(cis.corrected, is1)
     self.assertEqual(cis.original, is2)
     self.assertEqual(cis.xy_translation, ts)
Ejemplo n.º 2
0
class TestProcessingModule(unittest.TestCase):

    def setUp(self):
        self.pm = ProcessingModule('test_procmod', 'PyNWB unit test, test_init', 'a fake processing module')

    def test_init(self):
        self.assertEqual(self.pm.name, 'test_procmod')
        self.assertEqual(self.pm.source, 'PyNWB unit test, test_init')
        self.assertEqual(self.pm.description, 'a fake processing module')

    def test_add_container(self):
        ts = TimeSeries('test_ts', 'unit test test_add_container', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        self.pm.add_container(ts)
        self.assertIn(ts.name, self.pm.containers)
        self.assertIs(ts, self.pm.containers[ts.name])

    def test_get_container(self):
        ts = TimeSeries('test_ts', 'unit test test_get_container', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        self.pm.add_container(ts)
        tmp = self.pm.get_container('test_ts')
        self.assertIs(tmp, ts)

    def test_getitem(self):
        ts = TimeSeries('test_ts', 'unit test test_getitem', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        self.pm.add_container(ts)
        tmp = self.pm['test_ts']
        self.assertIs(tmp, ts)
Ejemplo n.º 3
0
class TestProcessingModule(TestCase):

    def setUp(self):
        self.pm = ProcessingModule('test_procmod', 'a fake processing module')

    def test_init(self):
        self.assertEqual(self.pm.name, 'test_procmod')
        self.assertEqual(self.pm.description, 'a fake processing module')

    def test_add_data_interface(self):
        ts = TimeSeries('test_ts', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        self.pm.add(ts)
        self.assertIn(ts.name, self.pm.containers)
        self.assertIs(ts, self.pm.containers[ts.name])

    def test_deprecated_add_data_interface(self):
        ts = TimeSeries('test_ts', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        with self.assertWarnsWith(PendingDeprecationWarning, 'add_data_interface will be replaced by add'):
            self.pm.add_data_interface(ts)
        self.assertIn(ts.name, self.pm.containers)
        self.assertIs(ts, self.pm.containers[ts.name])

    def test_deprecated_add_container(self):
        ts = TimeSeries('test_ts', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        with self.assertWarnsWith(PendingDeprecationWarning, 'add_container will be replaced by add'):
            self.pm.add_container(ts)
        self.assertIn(ts.name, self.pm.containers)
        self.assertIs(ts, self.pm.containers[ts.name])

    def test_get_data_interface(self):
        ts = TimeSeries('test_ts', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        self.pm.add(ts)
        tmp = self.pm.get('test_ts')
        self.assertIs(tmp, ts)
        self.assertIs(self.pm['test_ts'], self.pm.get('test_ts'))

    def test_deprecated_get_data_interface(self):
        ts = TimeSeries('test_ts', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        self.pm.add(ts)
        with self.assertWarnsWith(PendingDeprecationWarning, 'get_data_interface will be replaced by get'):
            tmp = self.pm.get_data_interface('test_ts')
        self.assertIs(tmp, ts)

    def test_deprecated_get_container(self):
        ts = TimeSeries('test_ts', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        self.pm.add(ts)
        with self.assertWarnsWith(PendingDeprecationWarning, 'get_container will be replaced by get'):
            tmp = self.pm.get_container('test_ts')
        self.assertIs(tmp, ts)

    def test_getitem(self):
        ts = TimeSeries('test_ts', [0, 1, 2, 3, 4, 5],
                        'grams', timestamps=[0.0, 0.1, 0.2, 0.3, 0.4, 0.5])
        self.pm.add(ts)
        tmp = self.pm['test_ts']
        self.assertIs(tmp, ts)
Ejemplo n.º 4
0
 def setUp(self):
     self.pm = ProcessingModule('test_procmod', 'a fake processing module')
Ejemplo n.º 5
0
 def setUp(self):
     self.pm = ProcessingModule('test_procmod', 'PyNWB unit test, test_init', 'a fake processing module')