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
96640c25
Commit
96640c25
authored
8 years ago
by
Yngve Levinsen
Browse files
Options
Downloads
Patches
Plain Diff
xrange is not python3
made sure forward compatibility is preserved
parent
1bea2709
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
+6
-3
6 additions, 3 deletions
ess/TraceWin.py
with
6 additions
and
3 deletions
ess/TraceWin.py
+
6
−
3
View file @
96640c25
...
@@ -1008,6 +1008,9 @@ class partran(dict):
...
@@ -1008,6 +1008,9 @@ class partran(dict):
'''
'''
Read partran1.out files..
Read partran1.out files..
'''
'''
# python 3 forward compatibility:
from
builtins
import
range
def
__init__
(
self
,
filename
):
def
__init__
(
self
,
filename
):
self
.
filename
=
filename
self
.
filename
=
filename
self
.
_readAsciiFile
()
self
.
_readAsciiFile
()
...
@@ -1016,8 +1019,8 @@ class partran(dict):
...
@@ -1016,8 +1019,8 @@ class partran(dict):
import
numpy
import
numpy
stream
=
file
(
self
.
filename
,
'
r
'
)
stream
=
open
(
self
.
filename
,
'
r
'
)
for
i
in
x
range
(
10
):
for
i
in
range
(
10
):
line
=
stream
.
readline
()
line
=
stream
.
readline
()
if
line
.
strip
()[
0
]
==
'
#
'
:
if
line
.
strip
()[
0
]
==
'
#
'
:
break
break
...
@@ -1025,7 +1028,7 @@ class partran(dict):
...
@@ -1025,7 +1028,7 @@ class partran(dict):
self
.
data
=
numpy
.
loadtxt
(
stream
)
self
.
data
=
numpy
.
loadtxt
(
stream
)
self
.
_dict
=
{}
self
.
_dict
=
{}
for
i
in
x
range
(
len
(
self
.
columns
)):
for
i
in
range
(
len
(
self
.
columns
)):
self
[
self
.
columns
[
i
]]
=
self
.
data
[:,
i
]
self
[
self
.
columns
[
i
]]
=
self
.
data
[:,
i
]
class
field_map
:
class
field_map
:
...
...
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