[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: 2 make errors installing gwave



Hi Dan and all,

On Samstag, 1. Dezember 2007, Dan McMahill wrote:
> Werner Hoch wrote:
> > Yes, but I'd still would like to have a "standard" binary format.
> > hdf5 would be nice.
> > http://hdf.ncsa.uiuc.edu/products/hdf5/index.html
>
> How well to ascii output files scale when you want to write out
> 30,000 node voltages and be able to pick out one to plot without it
> taking a long time?  I don't know the answer, but it seems like a
> binary format could have advantages there.
>
> Like Werner, I've also wondered about hdf5 since there is a library
> available for it and octave and I believe scilab both support it.  

I guess nearly every math package supports hdf5. A quick google search 
tells that you have support for R, ruby, python, perl, ...

Appended is a short python script that writes a table using the pytables 
modul. It takes 10 seconds to write a table with 1 million entries and 
creates a file with ~60MB.

> My 
> weak understanding of hdf5 is that it would meet some of the
> requirements for a simulator output file (you can write many
> variables a sample at a time instead of .mat file where you write all
> the samples of 1 variable followed by all the samples of another). 

That's right.

> It also appears that it would not nearly be enough to just say "hdf5"
> but you'd have to further specify the file format.

Yes, but it's quit easy doing it in the hierarchical structur of hdf5:

simulation_n --> plot_n --> table
or 
simulation_n --> plot_n --> metadata
simulation_n --> plot_n --> vector_n

> In terms of commercial simulators, it is annoying as all get out that
> they insist on wanting to use their own proprietary binary formats
> for results because sometimes you really want to get the data into a
> different tool.  grrrrrr.  This is clearly an area where geda can
> hands down win just by documenting the file format used.

Fully agreed.

Regards
Werner
#!/usr/bin/python
from tables import *

# Define a user record to characterize some kind of particles
class Particle(IsDescription):
    name      = StringCol(30)   # 16-character String
    idnumber  = Int64Col()      # Signed 64-bit integer
    ADCcount  = UInt16Col()     # Unsigned short integer
    TDCcount  = UInt8Col()      # unsigned byte
    grid_i    = Int32Col()      # integer
    grid_j    = Int32Col()      # integer
    pressure  = Float32Col()    # float  (single-precision)
    energy    = FloatCol()      # double (double-precision)

filename="largetable.hdf5"
# Open a file in "w"rite mode
h5file = openFile(filename, mode = "w", title = "Test file")
# Create a new group under "/" (root)
group = h5file.createGroup("/", 'detector', 'Detector information')
# Create one table on it
table = h5file.createTable(group, 'readout', Particle, "Readout example")
# Fill the table with 10 particles
particle = table.row
for i in xrange(1000000):
    particle['name']  = 'Particle: %6d' % (i)
    particle['TDCcount'] = i % 256
    particle['ADCcount'] = (i * 256) % (1 << 16)
    particle['grid_i'] = i
    particle['grid_j'] = 10 - i
    particle['pressure'] = float(i*i)
    particle['energy'] = float(particle['pressure'] ** 4)
    particle['idnumber'] = i * (2 ** 34)
    # Insert a new particle record
    particle.append()
# Close (and flush) the file
h5file.close()

_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user