Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ess-python-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ESS Beam Physics
ess-python-tools
Commits
b97afd27
Commit
b97afd27
authored
10 years ago
by
Yngve Levinsen
Browse files
Options
Downloads
Patches
Plain Diff
density_file now works well
parent
e39191c1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ess/TraceWin.py
+15
-25
15 additions, 25 deletions
ess/TraceWin.py
with
15 additions
and
25 deletions
ess/TraceWin.py
+
15
−
25
View file @
b97afd27
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment