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
27211382
Commit
27211382
authored
5 years ago
by
Yngve Levinsen
Browse files
Options
Downloads
Patches
Plain Diff
flake8 compatibility for two more files
parent
b4fd9de1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#19312
failed
5 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ess/__queue_templates__.py
+1
-1
1 addition, 1 deletion
ess/__queue_templates__.py
ess/fieldmap.py
+9
-8
9 additions, 8 deletions
ess/fieldmap.py
with
10 additions
and
9 deletions
ess/__queue_templates__.py
+
1
−
1
View file @
27211382
...
@@ -57,6 +57,6 @@ def _get_template(filename, template):
...
@@ -57,6 +57,6 @@ def _get_template(filename, template):
import
os
import
os
if
os
.
path
.
exists
(
filename
):
if
os
.
path
.
exists
(
filename
):
return
file
(
filename
).
read
()
return
open
(
filename
).
read
()
else
:
else
:
return
template
return
template
This diff is collapsed.
Click to expand it.
ess/fieldmap.py
+
9
−
8
View file @
27211382
...
@@ -79,7 +79,8 @@ __all__ = [
...
@@ -79,7 +79,8 @@ __all__ = [
"
read_fieldmap
"
,
"
read_fieldmap
"
,
"
cut_fieldmap_length
"
,
"
cut_fieldmap_length
"
,
"
field_on_axis
"
,
"
field_on_axis
"
,
"
field_on_axis_from_file
"
"
save_to_ascii
"
,
"
field_on_axis_from_file
"
,
"
save_to_ascii
"
,
"
batch_convert_to_ascii
"
,
"
batch_convert_to_ascii
"
,
"
unify_grid_size
"
,
"
unify_grid_size
"
,
"
batch_cut_fieldmap
"
,
"
batch_cut_fieldmap
"
,
...
@@ -88,9 +89,9 @@ __all__ = [
...
@@ -88,9 +89,9 @@ __all__ = [
]
]
# class FieldMapy:
# class FieldMapy:
#'''
#
'''
# class contains functions needed for manipulating fieldmaps for TraceWin.
#
class contains functions needed for manipulating fieldmaps for TraceWin.
#'''
#
'''
__version__
=
"
0.4
"
__version__
=
"
0.4
"
import
os
import
os
...
@@ -418,12 +419,12 @@ def save_to_ascii(Header, Field, output_filepath: str):
...
@@ -418,12 +419,12 @@ def save_to_ascii(Header, Field, output_filepath: str):
fieldmap_dim
=
3
fieldmap_dim
=
3
else
:
else
:
raise
ValueError
(
raise
ValueError
(
"
Wrong length of header, cannot write {}
"
.
format
(
output_file
_
path
)
"
Wrong length of header, cannot write {}
"
.
format
(
output_filepath
)
)
)
with
open
(
output_file
_
path
,
"
w
"
)
as
out_file
:
with
open
(
output_filepath
,
"
w
"
)
as
out_file
:
stepZ
=
Header
[
1
]
/
Header
[
0
]
# stepZ = Zmax / Nz
#
stepZ = Header[1] / Header[0] # stepZ = Zmax / Nz
out_file
.
write
(
"
{0[0]:.0f} {0[1]}
\n
"
.
format
(
Header
))
out_file
.
write
(
"
{0[0]:.0f} {0[1]}
\n
"
.
format
(
Header
))
if
fieldmap_dim
==
1
:
if
fieldmap_dim
==
1
:
...
@@ -623,7 +624,7 @@ def create_tw_fieldmap(
...
@@ -623,7 +624,7 @@ def create_tw_fieldmap(
tabular_file_with_path
=
os
.
path
.
join
(
fieldmaps_path
,
tabular_file_name
)
tabular_file_with_path
=
os
.
path
.
join
(
fieldmaps_path
,
tabular_file_name
)
field_File
=
open
(
tabular_file_with_path
,
"
r
"
)
field_File
=
open
(
tabular_file_with_path
,
"
r
"
)
if
header
==
True
:
if
header
is
True
:
field_array
=
np
.
genfromtxt
(
field_File
,
delimiter
=
delim
,
skip_header
=
1
)
field_array
=
np
.
genfromtxt
(
field_File
,
delimiter
=
delim
,
skip_header
=
1
)
else
:
else
:
field_array
=
np
.
genfromtxt
(
field_File
,
delimiter
=
delim
,
skip_header
=
0
)
field_array
=
np
.
genfromtxt
(
field_File
,
delimiter
=
delim
,
skip_header
=
0
)
...
...
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