Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
est
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
workflow
ewoksapps
est
Commits
8d1719a5
Commit
8d1719a5
authored
1 month ago
by
Wout De Nolf
Browse files
Options
Downloads
Patches
Plain Diff
split_bliss_scan: waiting for the end of the scan should be optional
parent
c57ab07a
No related branches found
No related tags found
1 merge request
!178
Resolve "Workflow to split multi-XAS scan"
Pipeline
#223979
passed
1 month ago
Stage: test
Stage: style
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/est/core/process/split.py
+2
-1
2 additions, 1 deletion
src/est/core/process/split.py
src/est/core/split_monotonic.py
+9
-1
9 additions, 1 deletion
src/est/core/split_monotonic.py
src/est/tests/test_split_monotonic.py
+61
-0
61 additions, 0 deletions
src/est/tests/test_split_monotonic.py
with
72 additions
and
2 deletions
src/est/core/process/split.py
+
2
−
1
View file @
8d1719a5
...
...
@@ -6,7 +6,7 @@ from est.core.split_monotonic import split_bliss_scan
class
SplitBlissScan
(
Task
,
input_names
=
[
"
filename
"
,
"
scan_number
"
,
"
monotonic_channel
"
,
"
out_filename
"
],
optional_input_names
=
[
"
retry_timeout
"
,
"
retry_period
"
],
optional_input_names
=
[
"
wait_finished
"
,
"
retry_timeout
"
,
"
retry_period
"
],
output_names
=
[
"
out_urls
"
],
):
"""
Split a Bliss scan in subscans as determined by a channel which
...
...
@@ -21,6 +21,7 @@ class SplitBlissScan(
:param optional_input_names:
* ``wait_finished``: Wait for the Bliss scan to be complete in HDF5.
* ``retry_timeout``: Timeout of waiting for the Bliss scan to be complete in HDF5.
* ``retry_period``: Check period of waiting for the Bliss scan to be complete in HDF5.
...
...
This diff is collapsed.
Click to expand it.
src/est/core/split_monotonic.py
+
9
−
1
View file @
8d1719a5
...
...
@@ -18,6 +18,7 @@ def split_bliss_scan(
scan_number
:
int
,
monotonic_channel
:
str
,
out_filename
:
str
,
wait_finished
:
bool
=
True
,
**
retry_args
,
)
->
List
[
str
]:
"""
Split a Bliss scan in subscans as determined by a channel which
...
...
@@ -27,12 +28,15 @@ def split_bliss_scan(
:param scan_number: The Bliss scan number.
:param monotonic_channel: HDF5 path relative to the scan group.
:param out_filename: HDF5 file name to save subscans as a result of splitting the Bliss scan.
:param wait_finished: Wait for the Bliss scan to be complete in HDF5.
:param retry_timeout: Timeout of waiting for the Bliss scan to be complete in HDF5.
:param retry_period: Check period of waiting for the Bliss scan to be complete in HDF5.
:returns: HDF5 URL
'
s of the subscans as a result of splitting the Bliss scan.
"""
entry_name
=
f
"
{
scan_number
}
.1
"
_wait_scan_finished
(
filename
,
entry_name
,
**
retry_args
)
if
wait_finished
:
_wait_scan_finished
(
filename
,
entry_name
,
**
retry_args
)
out_urls
=
[]
with
h5py_utils
.
File
(
filename
)
as
nxroot_in
:
...
...
@@ -41,6 +45,10 @@ def split_bliss_scan(
monotonic_values
=
nxentry_in
[
monotonic_channel
][()]
monotonic_slices
=
split_piecewise_monotonic
(
monotonic_values
)
if
monotonic_slices
and
not
wait_finished
:
# The last subscan might not be complete.
monotonic_slices
=
monotonic_slices
[:
-
1
]
for
subscan_number
,
subscan_slice
in
enumerate
(
monotonic_slices
,
1
):
out_url
=
_save_subscan
(
nxentry_in
,
scan_number
,
subscan_number
,
out_filename
,
subscan_slice
...
...
This diff is collapsed.
Click to expand it.
src/est/tests/test_split_monotonic.py
+
61
−
0
View file @
8d1719a5
...
...
@@ -90,6 +90,67 @@ def test_split_bliss_scan(tmp_path, split_function):
assert
split_data
==
expected_split_data
@pytest.mark.parametrize
(
"
split_function
"
,
[
split_bliss_scan
,
split_bliss_scan_task
])
def
test_split_unfinished_bliss_scan
(
tmp_path
,
split_function
):
bliss_scan_data
=
{
"
1.1
"
:
{
"
end_time
"
:
""
,
"
@attr1
"
:
"
value1
"
,
"
dataset1
"
:
"
value1
"
,
"
group1
"
:
{
"
@attr2
"
:
10
,
"
dataset2
"
:
"
value2
"
,
"
dataset3
"
:
[
0
,
1
,
2
,
2
,
1
,
0
],
"
dataset4
"
:
[
0
,
1
,
2
,
5
,
4
,
3
],
"
dataset5
"
:
10
,
"
dataset6
"
:
[
10
,
20
],
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
>dataset3
"
:
"
../group1/dataset3
"
,
"
>dataset4
"
:
"
/1.1/group1/dataset4
"
,
},
}
}
expected_split_data
=
{
"
1.1
"
:
{
"
@attr1
"
:
"
value1
"
,
"
dataset1
"
:
"
value1
"
,
"
end_time
"
:
""
,
"
group1
"
:
{
"
@attr2
"
:
10
,
"
dataset2
"
:
"
value2
"
,
"
dataset3
"
:
[
0
,
1
,
2
],
"
dataset4
"
:
[
0
,
1
,
2
],
"
dataset5
"
:
10
,
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
dataset3
"
:
[
0
,
1
,
2
],
"
dataset4
"
:
[
0
,
1
,
2
],
},
}
}
in_file
=
str
(
tmp_path
/
"
in.h5
"
)
dictdump
.
dicttonx
(
bliss_scan_data
,
in_file
,
add_nx_class
=
False
)
out_file
=
str
(
tmp_path
/
"
out.h5
"
)
out_urls
=
split_function
(
filename
=
in_file
,
scan_number
=
1
,
monotonic_channel
=
"
group1/dataset3
"
,
out_filename
=
out_file
,
wait_finished
=
False
,
)
assert
out_urls
==
[
f
"
silx://
{
out_file
}
::/1.1
"
]
split_data
=
_normalize_h5data
(
dictdump
.
nxtodict
(
out_file
,
asarray
=
False
))
assert
split_data
==
expected_split_data
@pytest.mark.parametrize
(
"
split_function
"
,
[
split_bliss_scan
,
split_bliss_scan_task
])
def
test_split_bliss_scan_timeout
(
tmp_path
,
split_function
):
bliss_scan_data
=
{
...
...
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