Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
0ad369fd
Commit
0ad369fd
authored
1 year ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
early handling of tolerance and reference instead of runargs
parent
7202cf28
No related branches found
No related tags found
1 merge request
!1699
Provide infrastructure and convert examples for configuring Python example scripts using embedded Ruby (#554)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tests/Examples/CMakeLists.txt
+1
-1
1 addition, 1 deletion
Tests/Examples/CMakeLists.txt
Wrap/Python/ba_plot.py
+17
-10
17 additions, 10 deletions
Wrap/Python/ba_plot.py
with
18 additions
and
11 deletions
Tests/Examples/CMakeLists.txt
+
1
−
1
View file @
0ad369fd
...
...
@@ -79,7 +79,7 @@ function(test_equality example reference tolerance)
cmake_path
(
SET reffile NORMALIZE
${
REFERENCE_DIR_EXAMPLES_MINI
}
/
${
reference
}
)
add_test
(
NAME
${
TARGET_NAME
}
${
launch_env
}
${
launch_py
}
${
MINI_SCRIPT
}
show=n datfile=
${
outfile
}
run_
tolerance=
${
tolerance
}
run_
reference=
${
reffile
}
tolerance=
${
tolerance
}
reference=
${
reffile
}
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
)
add_custom_target
(
${
TARGET_NAME
}
${
launch_env
}
${
launch_py
}
${
PUBL_SCRIPT
}
...
...
This diff is collapsed.
Click to expand it.
Wrap/Python/ba_plot.py
+
17
−
10
View file @
0ad369fd
...
...
@@ -52,11 +52,12 @@ rc('text', usetex=usetex_default)
plotargs
=
{}
simargs
=
{}
runargs
=
{}
datfile
=
None
figfile
=
None
saveformat
=
None
do_show
=
True
tolerance
=
None
reference
=
None
# ************************************************************************** #
# internal functions
...
...
@@ -125,13 +126,11 @@ def get_axes_labels(result, units):
def
check_or_save
(
result
,
fname
,
subname
=
""
):
outfile
=
fname
+
subname
+
"
.int.gz
"
tolerance
=
runargs
.
get
(
'
tolerance
'
)
reference
=
runargs
.
get
(
'
reference
'
)
ba
.
writeDatafield
(
result
,
outfile
)
if
not
tolerance
or
not
reference
:
return
reffile
=
reference
+
subname
+
"
.int.gz
"
ok
=
ba
.
filesAgree
(
outfile
,
reffile
,
float
(
tolerance
)
)
ok
=
ba
.
filesAgree
(
outfile
,
reffile
,
tolerance
)
if
not
ok
:
raise
Exception
(
f
"
=> no agreement between result and reference:
{
datfile
}
{
reffile
}
"
)
...
...
@@ -420,12 +419,10 @@ Support for bp.simargs will be removed in future releases.
Replace
\"
bp.simargs[
'
{
key
[
4
:
]
}
'
]
\"
by a hard-coded value
or by variable under your own control.
"""
)
elif
key
[
0
:
4
]
==
'
run_
'
:
runargs
[
key
[
4
:]]
=
tmp
[
key
]
else
:
plotargs
[
key
]
=
tmp
[
key
]
global
datfile
,
figfile
,
do_show
global
datfile
,
figfile
,
do_show
,
tolerance
,
reference
a
=
plotargs
.
pop
(
'
datfile
'
,
None
)
if
a
:
datfile
=
a
...
...
@@ -444,19 +441,29 @@ or by variable under your own control.
a
=
plotargs
.
pop
(
'
show
'
,
None
)
if
a
:
if
a
==
'
y
'
:
print
(
"
DEBUG Y
"
)
do_show
=
True
elif
a
==
'
n
'
:
print
(
"
DEBUG N
"
)
do_show
=
False
else
:
raise
Exception
(
"
Parameter
'
show
'
must be
'
y
'
or
'
n
'"
)
a
=
plotargs
.
pop
(
'
tolerance
'
,
None
)
if
a
:
tolerance
=
float
(
a
)
a
=
plotargs
.
pop
(
'
reference
'
,
None
)
if
a
:
reference
=
a
if
(
tolerance
is
not
None
and
reference
is
None
)
or
\
(
tolerance
is
None
and
reference
is
not
None
):
raise
Exception
(
"
If one of tolerance and reference is given, then the other must also be given
"
)
def
show_or_export
():
if
figfile
:
plt
.
savefig
(
figfile
,
format
=
save_format
,
bbox_inches
=
'
tight
'
)
print
(
f
"
DEBUG S=
{
do_show
}
"
)
if
do_show
:
plt
.
show
()
...
...
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