Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
calibration
pycalibration
Commits
bd69c051
Commit
bd69c051
authored
1 year ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Silence some line-length warnings
parent
b0f1c5f0
No related branches found
No related tags found
1 merge request
!933
[Tests] clearer comparison of HDF5 files
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_reference_runs/test_pre_deployment.py
+11
-9
11 additions, 9 deletions
tests/test_reference_runs/test_pre_deployment.py
with
11 additions
and
9 deletions
tests/test_reference_runs/test_pre_deployment.py
+
11
−
9
View file @
bd69c051
...
...
@@ -72,9 +72,9 @@ def validate_file(
ref_ds
=
fref
[
dsname
]
out_ds
=
fout
[
dsname
]
if
out_ds
.
shape
!=
ref_ds
.
shape
:
changed
.
append
((
dsname
,
f
"
Shape:
{
ref_ds
.
shape
}
->
{
out_ds
.
shape
}
"
))
changed
.
append
((
dsname
,
f
"
Shape:
{
ref_ds
.
shape
}
->
{
out_ds
.
shape
}
"
))
# noqa
elif
out_ds
.
dtype
!=
ref_ds
.
dtype
:
changed
.
append
((
dsname
,
f
"
Dtype:
{
ref_ds
.
dtype
}
->
{
out_ds
.
dtype
}
"
))
changed
.
append
((
dsname
,
f
"
Dtype:
{
ref_ds
.
dtype
}
->
{
out_ds
.
dtype
}
"
))
# noqa
else
:
# Compare chunk by chunk to not use lots of RAM
nanable
=
np
.
issubdtype
(
ref_ds
.
dtype
,
np
.
floating
)
\
...
...
@@ -82,7 +82,7 @@ def validate_file(
for
chunk_slice
in
ref_ds
.
iter_chunks
():
ref_chunk
=
ref_ds
[
chunk_slice
]
out_chunk
=
out_ds
[
chunk_slice
]
if
not
np
.
allclose
(
ref_chunk
,
out_chunk
,
equal_nan
=
nanable
):
if
not
np
.
allclose
(
ref_chunk
,
out_chunk
,
equal_nan
=
nanable
):
# noqa
# If just 1 entry, show the values
if
ref_ds
.
size
==
1
:
r
,
o
=
np
.
squeeze
(
ref_chunk
),
np
.
squeeze
(
out_chunk
)
...
...
@@ -99,7 +99,9 @@ def validate_file(
)
def
parse_config
(
cmd
:
List
[
str
],
config
:
Dict
[
str
,
Any
],
out_folder
:
str
)
->
List
[
str
]:
def
parse_config
(
cmd
:
List
[
str
],
config
:
Dict
[
str
,
Any
],
out_folder
:
str
)
->
List
[
str
]:
"""
Convert a dictionary to a list of arguments.
Values that are not strings will be cast.
...
...
@@ -242,7 +244,7 @@ def slurm_watcher(test_key: str, std_out: str):
list
(
automated_test_config
.
items
()),
ids
=
list
(
automated_test_config
.
keys
()),
)
def
test_xfel_calibrate
(
test_key
:
str
,
val_dict
:
dict
,
release_test_config
:
Tuple
):
def
test_xfel_calibrate
(
test_key
:
str
,
val_dict
:
dict
,
release_test_config
:
Tuple
):
# noqa
"""
Test xfel calibrate detectors and calibrations written
in the given callab_test YAML file.
Args:
...
...
@@ -284,16 +286,16 @@ def test_xfel_calibrate(test_key: str, val_dict: dict, release_test_config: Tupl
cal_conf
=
val_dict
[
"
config
"
]
out_folder
=
pathlib
.
Path
(
cal_conf
[
"
out-folder
"
].
format
(
out_dir_base
,
cal_conf
[
"
karabo-id
"
],
test_key
)
)
out_folder
=
pathlib
.
Path
(
cal_conf
[
"
out-folder
"
].
format
(
out_dir_base
,
cal_conf
[
"
karabo-id
"
],
test_key
)
)
reference_folder
=
pathlib
.
Path
(
val_dict
[
"
reference-folder
"
].
format
(
reference_dir_base
,
cal_conf
[
"
karabo-id
"
],
test_key
)
)
report_name
=
out_folder
/
f
"
{
test_key
}
_
{
datetime
.
now
().
strftime
(
'
%y%m%d_%H%M%S
'
)
}
"
report_name
=
out_folder
/
f
"
{
test_key
}
_
{
datetime
.
now
().
strftime
(
'
%y%m%d_%H%M%S
'
)
}
"
# noqa
cal_conf
[
"
report-to
"
]
=
str
(
report_name
)
...
...
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