Example #1
0
 def test_pickler_save_load_layout_entry2(self):
     Pickler.save(self.image1+self.image2, 'test_pickler_save_load_layout_entry2',
                     info={'info':'example'}, key={1:2})
     entries = Unpickler.entries('test_pickler_save_load_layout_entry2.hvz')
     loaded = Unpickler.load('test_pickler_save_load_layout_entry2.hvz',
                             entries=['Image.II'])
     self.assertEqual(loaded, self.image2)
 def test_pickler_save_load_layout_entry1(self):
     Pickler.save(self.image1+self.image2, 'test_pickler_save_load_layout_entry1',
                     info={'info':'example'}, key={1:2})
     entries = Unpickler.entries('test_pickler_save_load_layout_entry1.hvz')
     assert ('Image.I' in entries), "Entry 'Image.I' missing"
     loaded = Unpickler.load('test_pickler_save_load_layout_entry1.hvz',
                             entries=['Image.I'])
     self.assertEqual(loaded, self.image1)
 def test_pickler_save_load_layout_entry2(self):
     Pickler.save(self.image1+self.image2, 'test_pickler_save_load_layout_entry2',
                     info={'info':'example'}, key={1:2})
     entries = Unpickler.entries('test_pickler_save_load_layout_entry2.hvz')
     assert ('Image.II' in entries), "Entry 'Image.II' missing"
     loaded = Unpickler.load('test_pickler_save_load_layout_entry2.hvz',
                             entries=['Image.II'])
     self.assertEqual(loaded, self.image2)
Example #4
0
    def test_pickler_save_load_single_layout(self):
        single_layout = Layout.from_values([self.image1])
        Pickler.save(single_layout, 'test_pickler_save_load_single_layout',
                        info={'info':'example'}, key={1:2})

        entries = Unpickler.entries('test_pickler_save_load_single_layout.hvz')
        self.assertEqual(entries, ['Image.I(L)'])
        loaded = Unpickler.load('test_pickler_save_load_single_layout.hvz',
                                entries=['Image.I(L)'])
        self.assertEqual(single_layout, loaded)
    def test_pickler_save_load_single_layout(self):
        single_layout = Layout([self.image1])
        Pickler.save(single_layout, 'test_pickler_save_load_single_layout',
                        info={'info':'example'}, key={1:2})

        entries = Unpickler.entries('test_pickler_save_load_single_layout.hvz')
        self.assertEqual(entries, ['Image.I(L)'])
        loaded = Unpickler.load('test_pickler_save_load_single_layout.hvz',
                                entries=['Image.I(L)'])
        self.assertEqual(single_layout, loaded)
 def test_pickler_save_and_load_key(self):
     input_key = {'test_key': 'key_val'}
     Pickler.save(self.image1,
                  'test_pickler_save_and_load_data.hvz',
                  key=input_key)
     key = Unpickler.key('test_pickler_save_and_load_data.hvz')
     self.assertEqual(key, input_key)
 def test_pickler_save_load_layout(self):
     Pickler.save(self.image1 + self.image2,
                  'test_pickler_save_load_layout',
                  info={'info': 'example'},
                  key={1: 2})
     loaded = Unpickler.load('test_pickler_save_load_layout.hvz')
     self.assertEqual(loaded, self.image1 + self.image2)
 def test_pickler_save_and_load_info(self):
     input_info = {'info': 'example'}
     Pickler.save(self.image1,
                  'test_pickler_save_and_load_data.hvz',
                  info=input_info)
     info = Unpickler.info('test_pickler_save_and_load_data.hvz')
     self.assertEqual(info['info'], input_info['info'])
 def test_pickler_save_load_layout_entries(self):
     Pickler.save(self.image1 + self.image2,
                  'test_pickler_save_load_layout_entries',
                  info={'info': 'example'},
                  key={1: 2})
     entries = Unpickler.entries(
         'test_pickler_save_load_layout_entries.hvz')
     self.assertEqual(entries, ['Image.I', 'Image.II'])
 def test_serialize_deserialize_2(self):
     data,_ = Pickler(self.image2)
     obj =   Unpickler(data)
     self.assertEqual(obj, self.image2)
Example #11
0
 def hvz_metadata_fn(f):
     from holoviews.core.io import Unpickler
     return Unpickler.key(f)
Example #12
0
 def test_pickler_save_load_layout_entries(self):
     Pickler.save(self.image1+self.image2, 'test_pickler_save_load_layout_entries',
                     info={'info':'example'}, key={1:2})
     entries = Unpickler.entries('test_pickler_save_load_layout_entries.hvz')
     self.assertEqual(entries, ['Image.I', 'Image.II'] )
Example #13
0
 def test_pickler_save_load_layout(self):
     Pickler.save(self.image1+self.image2, 'test_pickler_save_load_layout',
                     info={'info':'example'}, key={1:2})
     loaded = Unpickler.load('test_pickler_save_load_layout.hvz')
     self.assertEqual(loaded, self.image1+self.image2)
Example #14
0
 def test_pickler_save_and_load_info(self):
     input_info = {'info':'example'}
     Pickler.save(self.image1, 'test_pickler_save_and_load_data.hvz', info=input_info)
     info = Unpickler.info('test_pickler_save_and_load_data.hvz')
     self.assertEqual(info['info'], input_info['info'])
Example #15
0
 def test_pickler_save_and_load_key(self):
     input_key = {'test_key':'key_val'}
     Pickler.save(self.image1, 'test_pickler_save_and_load_data.hvz', key=input_key)
     key = Unpickler.key('test_pickler_save_and_load_data.hvz')
     self.assertEqual(key, input_key)
 def test_pickler_save_and_load_data_1(self):
     Pickler.save(self.image1, 'test_pickler_save_and_load_data_1.hvz')
     loaded = Unpickler.load('test_pickler_save_and_load_data_1.hvz')
     self.assertEqual(loaded, self.image1)
Example #17
0
 def hvz_data_fn(f):
     from holoviews.core.io import Unpickler
     return {e: Unpickler.load(f, [e]) for e in Unpickler.entries(f)}
Example #18
0
 def test_pickler_save_and_load_data_1(self):
     Pickler.save(self.image1, 'test_pickler_save_and_load_data_1.hvz')
     loaded = Unpickler.load('test_pickler_save_and_load_data_1.hvz')
     self.assertEqual(loaded, self.image1)
Example #19
0
 def hvz_metadata_fn(f):
     from holoviews.core.io import Unpickler
     return Unpickler.key(f)
Example #20
0
 def hvz_data_fn(f):
     from holoviews.core.io import Unpickler
     return {e: Unpickler.load(f, [e]) for e in Unpickler.entries(f)}
Example #21
0
import os
import re
import time
import glob as glob
import datetime as dt
from dateutil import tz
from functools import partial

import numpy as np
import param
import lancet
from lancet.filetypes import FileType, CustomFile
from holoviews.core.io import Unpickler
import holoviews as hv

custom=CustomFile(metadata_fn=lambda f: Unpickler.key(f),
                  data_fn = lambda f: {e: Unpickler.load(f, [e])
                                       for e in Unpickler.entries(f)})

def load_table(path):
    date = re.search("([0-9]{4}\-[0-9]{2}\-[0-9]{2}\_[0-9]{4})", path).group(1)
    dirs = glob.glob(os.path.join(path, date+'*'))
    if not dirs:
        raise Exception('No data found in directory.')
    dir_suffix = dirs[0].split(date)[-1]
    match = re.search('\_t\d{1,}\_', dir_suffix)
    if not match:
        raise Exception('No directories indexed by tid found.')
    file_pattern = ''.join(['*', dir_suffix[:match.start(0)], '_t{tid:d}_*/*.hvz'])
    viewfnames = lancet.FilePattern('filename', os.path.join(path, file_pattern))
    filedata = lancet.FileInfo(viewfnames, 'filename', custom)
Example #22
0
def load_holoviews(fpath):
    from holoviews.core.io import Unpickler
    return Unpickler.load(fpath)