Page MenuHomec4science

gheader
No OneTemporary

File Metadata

Created
Sat, Feb 1, 09:41
#!/usr/bin/env python
#!/usr/bin/env python
import os,thread,sys,string,time,glob
from numpy import *
from pNbody import *
from optparse import OptionParser
########################################
#
# parser
#
########################################
def parse_options():
usage = "usage: %prog [options] file"
parser = OptionParser(usage=usage)
parser.add_option("-t",
action="store",
dest="ftype",
type="string",
default = None,
help="type of the file",
metavar=" TYPE")
parser.add_option("--exec",
action="store",
dest="execline",
type="string",
default = None,
help="give command to execute before",
metavar=" STRING")
(options, args) = parser.parse_args()
if len(args) == 0:
#print "you must specify a filename"
#sys.exit(0)
file = None
else:
file = args
return file,options
################################################################################
#
# MAIN
#
################################################################################
files,opt = parse_options()
opt.pio = 'no'
opt.byteorder = sys.byteorder
for file in files:
tpl = (24,48,float,float,int32,int32,24,int32,int32,float,float,float,float,int32,int32,24,int32,int32,float,48)
f = open(file,'r')
header = io.ReadBlock(f,tpl,byteorder=opt.byteorder,pio=opt.pio)
f.close()
npart,massarr,atime,redshift,flag_sfr,flag_feedback,nall,flag_cooling,num_files,boxsize,omega0,omegalambda,hubbleparam,flag_age,flag_metals,nallhw,flag_entr_ic,flag_chimie_extraheader,critical_energy_spec,empty = header
npart = fromstring(npart,int32)
massarr = fromstring(massarr,float)
nall = fromstring(nall,int32)
nallhw = fromstring(nallhw,int32)
nbody = sum(npart)
print "%s atime=%13.10f redshift=%13.10f nbody=%8d"%(file,atime,redshift,nbody)
#print " atime = %g"%atime
#print " redshift = %g"%redshift
#print " npart = %s"%npart

Event Timeline