Skip to content
Snippets Groups Projects
Commit b97afd27 authored by Yngve Levinsen's avatar Yngve Levinsen
Browse files

density_file now works well

parent e39191c1
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,7 @@ class density_file:
'''
def __init__(self, filename):
import numpy
import numpy, sys
self.filename=filename
......@@ -75,7 +75,8 @@ class density_file:
counter+=1
except IndexError: # EOF reached..
break
print counter
if sys.flags.debug:
print "Number of steps found:", counter
self.fin.seek(0)
# set up the arrays..
......@@ -131,8 +132,7 @@ class density_file:
self._getHeader()
numpy.fromfile(self.fin, dtype=numpy.int16, count=8344/2)
numpy.fromfile(self.fin, dtype=numpy.int16, count=6788/2)
numpy.fromfile(self.fin, dtype=numpy.int16, count=15132/2)
def _getFullContent(self):
......@@ -141,6 +141,7 @@ class density_file:
#self._getHeader()
# no need to read the header again:
# (though only if we are SURE about content!)
numpy.fromfile(self.fin, dtype=numpy.int16, count=5)
nelp=numpy.fromfile(self.fin, dtype=numpy.int32, count=1)[0]
......@@ -166,12 +167,14 @@ class density_file:
min_pos_moy=numpy.fromfile(self.fin, dtype=numpy.float32, count=n)
max_pos_moy=numpy.fromfile(self.fin, dtype=numpy.float32, count=n)
if self.version>=7:
rms_emit=numpy.fromfile(self.fin, dtype=numpy.float32, count=n)
rms_emit2=numpy.fromfile(self.fin, dtype=numpy.float32, count=n)
rms_emit=numpy.fromfile(self.fin, dtype=numpy.float32, count=3)
rms_emit2=numpy.fromfile(self.fin, dtype=numpy.float32, count=3)
if self.version>=8:
e_ouv=numpy.fromfile(self.fin, dtype=numpy.float32, count=1)
phase_ouv_pos=numpy.fromfile(self.fin, dtype=numpy.float32, count=1)
phase_ouv_neg=numpy.fromfile(self.fin, dtype=numpy.float32, count=1)
self.Np[self.i]=numpy.fromfile(self.fin, dtype=numpy.int64, count=1)[0]
#print self.i, self.Np[self.i] # Nrun, nelp, ib, self.z[self.i], Np
if self.Np[self.i]:
powlost=numpy.zeros(self.Nrun)
......@@ -184,25 +187,12 @@ class density_file:
powlost2=numpy.fromfile(self.fin, dtype=numpy.float64, count=1)[0]
Minpowlost=numpy.fromfile(self.fin, dtype=numpy.float32, count=1)[0]
Maxpowlost=numpy.fromfile(self.fin, dtype=numpy.float32, count=1)[0]
if self.vlong==1:
tab=numpy.fromfile(self.fin, dtype=numpy.uint64, count=n)
tab=numpy.fromfile(self.fin, dtype=numpy.uint64, count=n*step)
else:
tab=numpy.fromfile(self.fin, dtype=numpy.uint32, count=n)
tab=numpy.fromfile(self.fin, dtype=numpy.uint32, count=n*step)
if self.ib[self.i]>0:
tabp=[]
for j in xrange(n):
tabp.append(numpy.fromfile(self.fin, dtype=numpy.uint32, count=step))
tabp=numpy.fromfile(self.fin, dtype=numpy.uint32, count=3*step)
# skip jibberish
if self.Np[self.i]:
numpy.fromfile(self.fin, dtype=numpy.int16, count=2352/2)
if self.Nrun==100:
numpy.fromfile(self.fin, dtype=numpy.int16, count=5572/2)
else:
numpy.fromfile(self.fin, dtype=numpy.int16, count=8032/2)
if self.Nrun==100:
numpy.fromfile(self.fin, dtype=numpy.int16, count=6788/2)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment