Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 4726f970c4b56b9a0ebb9a03a0b6522e > files > 19

python-tables-doc-3.0.0-4.mga4.noarch.rpm

"""A small example showing the use of nested iterators within PyTables.

This program needs the output file, 'tutorial1.h5', generated by
'tutorial1-1.py' in order to work.

"""

import tables
f=tables.open_file("tutorial1.h5")
rout = f.root.detector.readout

print "*** Result of a three-folded nested iterator ***"
for p in rout.where('pressure < 16'):
    for q in rout.where('pressure < 9'):
        for n in rout.where('energy < 10'):
            print "pressure, energy-->", p['pressure'], n['energy']
print "*** End of selected data ***"
f.close()