import ostap.io.zipshelve as zipshelve import ostap.io.bz2shelve as bz2shelve if 2 < python_version.major : import ostap.io.lzshelve as lzshelve else : lzshelve = None import ostap.io.sqliteshelve as sqliteshelve import ostap.io.rootshelve as rootshelve # ============================================================================= bins = 1000 data = {} h1 = ROOT.TH1D('h1','1D-histogram',bins,-5,5) ; h1.Sumw2() m1 = VE(1,2) for i in range ( 0, 100000) : h1.Fill( m1.gauss() ) bins = 50 h2 = ROOT.TH2D('h2','2D-histogram',bins,-5,5,bins,-5,5) ; h2.Sumw2() for i in range ( 0, 100000) : h2.Fill( m1.gauss() , m1.gauss() ) data [ 'histo-1D' ] = h1 data [ 'histo-2D' ] = h2 data [ 'both' ] = (123 , h1 , {'a':2}, h2,'comment',()) data [ 'histos' ] = {} for i in range ( 5000 ) : ht = 'histo#%d' % i hh = ROOT.TH1D ( ht , '' , 500 , 0 , 100 ) for j in range ( 200 ) : hh.Fill ( random.gauss ( 50 , 10) ) data['histos'][ht] = hh
import ostap.io.sqliteshelve as sqliteshelve import ostap.io.rootshelve as rootshelve # ============================================================================= db_sql_name = tempfile.mktemp(suffix='.msql') db_zip_name = tempfile.mktemp(suffix='.zdb') db_root_name = tempfile.mktemp(suffix='.root') bins = 1000 data = {} h1 = ROOT.TH1D('h1', '1D-histogram', bins, -5, 5) h1.Sumw2() m1 = VE(1, 2) for i in range(0, 100000): h1.Fill(m1.gauss()) bins = 50 h2 = ROOT.TH2D('h2', '2D-histogram', bins, -5, 5, bins, -5, 5) h2.Sumw2() for i in range(0, 100000): h2.Fill(m1.gauss(), m1.gauss()) data['histo-1D'] = h1 data['histo-2D'] = h2 data['both'] = (123, h1, {'a': 2}, h2, 'comment') def test_shelves(): db_sql = sqliteshelve.open(db_sql_name, 'c')