def test_export_image(self):
        shared_file = SharedFile(self.test_file, self.frame_path)
        self.output_file_name = os.path.join(
            iutils_testing.data_dir, 'output.avi')
        video.export(shared_file, output=self.output_file_name)

        shared_file.close()

        self.assertTrue(os.path.exists(self.output_file_name))
    def test_export_profile(self):
        shared_file = SharedFile(self.test_file)

        self.assertFalse(os.path.exists(self.output_file_name))
        
        r=video.export(
            shared_file, self.profile_path, output=self.output_file_name)
        shared_file.close()
        self.assertTrue(r)
        self.assertTrue(os.path.exists(self.output_file_name))
Exemple #3
0
 def setUp(self):
     self.zerotime = time()
     self.k = os.path.join(dspath, 'refup', 'h', 'self')
     if os.path.exists(self.k):
         os.remove(self.k)
     self.sh = SharedFile('reftest.h5', mode='w')
     self.ru = refupdater.ReferenceUpdater(dspath, self.sh, self.zerotime)
     self.ds = dirshelf.DirShelf(dspath, 'refup', {
         'h':
         Option(handle='h', type='Integer', attr=['History'], kid='/h')
     })
 def test_gui(self):
     shared_file = SharedFile(self.test_file)
     video_exporter = video.VideoExporter(shared_file)
     video_exporter.show()
     QtGui.qApp.exec_()
     shared_file.close()
        plt = plot_line(sampled_x, sampled_y, z, color=colors[i])
        w.addItem(plt)
    #add_grids(w)
    ax = gl.GLAxisItem()

    w.addItem(ax)
    ##w.pan(0,0,0)
    return w


def extrude(f, data_path, cut=0):
    prf = get_node_reference(f, data_path)
    #prf = get_node_reference(f, '/hsm/sample0/profile')
    xs, ys, zs, colors = read_file(prf, cut=cut)
    w = plot3d(xs, ys, zs, colors)
    return w


if __name__ == '__main__':
    test_path = '/home/daniele/Sviluppo/3d/cube.h5'
    test_path = '/home/daniele/MisuraData/hsm/BORAX powder 10 C min.h5'
    data_path = '/hsm/sample0/profile'
    cut = 0
    #test_path = '/home/daniele/MisuraData/horizontal/profiles/System Interbau 80 1400.h5'
    #data_path = '/horizontal/sample0/Right/profile'
    app = pg.QtGui.QApplication([])
    f = SharedFile(test_path)
    w = extrude(f, data_path)
    w.show()
    pg.QtGui.QApplication.exec_()
 def _recalculate_metadata(self, node):
     shared_file = SharedFile(node.linked.filename)
     shared_file.conf = node.get_configuration().root
     shared_file.run_scripts()
Exemple #7
0
def getFileProxy(filename, **kw):
    if filename.startswith('http'):
        r = getRemoteFile(filename)
    else:
        r = SharedFile(filename, **kw)
    return r
Exemple #8
0
class TestRefUpdater(unittest.TestCase):
    def setUp(self):
        self.zerotime = time()
        self.k = os.path.join(dspath, 'refup', 'h', 'self')
        if os.path.exists(self.k):
            os.remove(self.k)
        self.sh = SharedFile('reftest.h5', mode='w')
        self.ru = refupdater.ReferenceUpdater(dspath, self.sh, self.zerotime)
        self.ds = dirshelf.DirShelf(dspath, 'refup', {
            'h':
            Option(handle='h', type='Integer', attr=['History'], kid='/h')
        })

    def tearDown(self):
        self.sh.close()
        self.ru.close()
        self.ds.close()

    @unittest.skip('Maybe not needed')
    def test_dump(self):
        dumps(self.ru)

    def changeval(self, nval):
        print 'CHANGEVAL', nval
        t0 = time()
        sleep(0.1)
        t1 = time()
        self.ds.set_current('h', nval, t1)
        sleep(0.1)
        t2 = time()
        self.assertTrue(self.ru.sync())
        rt = self.ru.cache[self.k].mtime
        print '{:f} < {:f} < {:f}'.format(t0, rt, t2)
        self.assertEqual(rt, t1)
        self.assertGreater(rt, t0)
        self.assertLess(rt, t2)

    def test_refupdater(self):
        # FIXME: The reference is created but the first point is missed
        self.ru.nthreads = 1
        self.ru.sync()
        print self.ru.cache
        self.assertTrue(self.ru.cache.has_key(self.k))
        rt = self.ru.cache[self.k].mtime
        self.assertAlmostEqual(rt, self.zerotime, delta=0.1)

        self.changeval(1)

        # Check double appending
        for i in range(10):
            print 'Changing values', i
            self.changeval(i + 2)
        sleep(5)
        for i in range(10):
            print 'Sync', i
            self.ru.sync()
        # Check summary
        for i in range(10):
            print 'Changing values', i
            self.changeval(i + 2)
            sleep(1)
 def _recalculate_metadata(self, node):
     shared_file = SharedFile(node.linked.filename)
     shared_file.conf = node.get_configuration().root
     shared_file.run_scripts()