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
90267919
Commit
90267919
authored
10 years ago
by
Yngve Levinsen
Browse files
Options
Downloads
Patches
Plain Diff
added partran file reader (ascii)
parent
104749ca
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
+33
-0
33 additions, 0 deletions
ess/TraceWin.py
with
33 additions
and
0 deletions
ess/TraceWin.py
+
33
−
0
View file @
90267919
class
dst
:
'''
Simple class to read in a
...
...
@@ -309,3 +310,35 @@ class remote_data_merger:
return
data
class
partran
:
'''
Read partran1.out files..
'''
def
__init__
(
self
,
filename
):
self
.
filename
=
filename
self
.
_readAsciiFile
()
def
_readAsciiFile
(
self
):
import
numpy
stream
=
file
(
self
.
filename
,
'
r
'
)
for
i
in
xrange
(
10
):
line
=
stream
.
readline
()
self
.
columns
=
[
'
NUM
'
]
+
line
.
split
()
self
.
data
=
numpy
.
loadtxt
(
stream
)
# seems we have some inconsistencies with columns...
#self._dict={}
#print self.data.shape,len(self.columns)
#for i in xrange(len(self.columns)):
# self._dict[self.columns[i]]=self.data[:,i]
def
get
(
self
,
column
):
if
column
not
in
self
.
columns
:
print
"
WARNING, could not find
"
,
column
return
i
=
self
.
columns
.
index
(
column
)
return
self
.
data
[:,
i
]
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