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
33c94ba6
Commit
33c94ba6
authored
7 years ago
by
Yngve Levinsen
Browse files
Options
Downloads
Patches
Plain Diff
error study script
- python3 prints - settings.yml is optional - clarifying question
parent
2a29e914
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/tracewin_errorstudy
+19
-14
19 additions, 14 deletions
scripts/tracewin_errorstudy
with
19 additions
and
14 deletions
scripts/tracewin_errorstudy
+
19
−
14
View file @
33c94ba6
#!/usr/bin/env python
from
__future__
import
print_function
from
ess
import
__queue_templates__
def
define_and_handle_args
():
...
...
@@ -42,18 +43,22 @@ def create_and_copy_lattice(args, calc_dir, commented=[], extra_line=''):
'''
import
yaml
,
shutil
,
os
# Create the lattice file from template:
lattice_settings
=
yaml
.
load
(
file
(
args
.
settings
,
'
r
'
).
read
())
lattice_settings
[
'
extra_line
'
]
=
extra_line
if
os
.
path
.
exists
(
args
.
settings
):
# Create the lattice file from template:
lattice_settings
=
yaml
.
load
(
file
(
args
.
settings
,
'
r
'
).
read
())
lattice_settings
[
'
extra_line
'
]
=
extra_line
lattice_template
=
file
(
args
.
lattice
+
'
.tmp
'
,
'
r
'
).
read
()
for
cmd
in
commented
:
lattice_template
=
lattice_template
.
replace
(
cmd
.
lower
(),
'
;
'
+
cmd
)
lattice_template
=
lattice_template
.
replace
(
cmd
.
upper
(),
'
;
'
+
cmd
)
lattice_template
=
file
(
args
.
lattice
+
'
.tmp
'
,
'
r
'
).
read
()
for
cmd
in
commented
:
lattice_template
=
lattice_template
.
replace
(
cmd
.
lower
(),
'
;
'
+
cmd
)
lattice_template
=
lattice_template
.
replace
(
cmd
.
upper
(),
'
;
'
+
cmd
)
file
(
calc_dir
+
'
/
'
+
args
.
lattice
,
'
w
'
).
write
(
lattice_template
.
format
(
**
lattice_settings
))
file
(
os
.
path
.
join
(
calc_dir
,
args
.
lattice
)
,
'
w
'
).
write
(
lattice_template
.
format
(
**
lattice_settings
))
shutil
.
copy
(
args
.
settings
,
calc_dir
)
shutil
.
copy
(
args
.
settings
,
calc_dir
)
else
:
shutil
.
copy
(
args
.
lattice
,
os
.
path
.
join
(
calc_dir
,
args
.
lattice
))
for
folder
in
os
.
listdir
(
calc_dir
):
if
folder
[
0
:
15
]
==
"
Local_TraceWin_
"
:
...
...
@@ -100,7 +105,7 @@ def delete_output_files(args,folder):
def
setup_multi
(
args
):
import
os
print
"
multi study..
"
print
(
"
multi study..
"
)
# the statistical study in TW to do, normally 14
stat_study
=
args
.
study
+
13
...
...
@@ -151,7 +156,7 @@ def setup_multi(args):
if
num_jobs
==
0
:
raise
ValueError
(
"
Could not find any simulation folders in
"
+
args
.
calc_dir
)
print
"
Total number of new jobs
"
,
num_jobs
print
(
"
Total number of new jobs
"
,
num_jobs
)
args
.
num_jobs
=
num_jobs
def
setup
(
args
):
...
...
@@ -207,10 +212,10 @@ def setup(args):
out
.
write
(
queue_template
.
format
(
**
locals
()))
def
ask
(
args
):
print
"
You have now set up an error study running {} jobs in folder {}
"
.
format
(
args
.
num_jobs
,
args
.
calc_dir
)
print
(
"
You have now set up an error study running {} jobs in folder {}
"
.
format
(
args
.
num_jobs
,
args
.
calc_dir
)
)
if
args
.
multi
>
1
:
print
"
This is a multi-error study
"
answer
=
raw_input
(
"
Are you sure
you want to
continue
? (yes/no)
"
)
print
(
"
This is a multi-error study
"
)
answer
=
raw_input
(
"
Do
you want to
submit the jobs immediately
? (yes/no)
"
)
if
answer
==
'
yes
'
:
return
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