DMelt:DataAnalysis/8 Metadata

From HandWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Member

Metadata

Metadata is a short record which captures main characteristics of an entire data record or objects inside each data record. These characteristics appear to be useful when one needs to find a necessary record as fast as possible, without reading the entire data records. Read Metadata article.

Let us consider a script which fills an event record with many events. It can look as

from jhplot.io import *
from jhplot import *

ps=math.Poisson(500)
def event(entry):
  p1,p2,p3=P0D('a'),P0D('b'),P0D('c')
  p1.randomUniform(ps.next(),0,1)
  p2.randomNormal(ps.next(),0,1)
  p3.randomNormal(ps.next(),0,1)
  return [str(entry),p1,p2,p3]

f=HFile('data.jser','w')
for i in range(5000):
  ev=event(i)
  if (i%100 == 0):
     print 'event=',ev[0]
  f.write(ev)
f.close()

In this example, event consists of 3 data containers with Poisson random numbers. We write all such events into a file. in a zipped serialized form. How to insert a data record characterizing the sum of 3 random values, x+y+x, such that after reading this small record one can navigate to the necessary event without running over all 50000 events?