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
c57ab07a
Commit
c57ab07a
authored
1 month ago
by
Wout De Nolf
Browse files
Options
Downloads
Patches
Plain Diff
split_bliss_scan: fix softlinks
parent
6747b209
No related branches found
No related tags found
1 merge request
!178
Resolve "Workflow to split multi-XAS scan"
Pipeline
#223974
passed
1 month ago
Stage: test
Stage: style
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/est/core/split_monotonic.py
+13
-1
13 additions, 1 deletion
src/est/core/split_monotonic.py
src/est/tests/test_split_monotonic.py
+23
-7
23 additions, 7 deletions
src/est/tests/test_split_monotonic.py
with
36 additions
and
8 deletions
src/est/core/split_monotonic.py
+
13
−
1
View file @
c57ab07a
...
...
@@ -87,7 +87,8 @@ def _save_subgroup(
link
=
group_in
.
get
(
name
,
getlink
=
True
)
if
isinstance
(
link
,
h5py
.
SoftLink
):
group_out
[
name
]
=
link
target
=
_relative_link
(
group_in
,
link
.
path
,
group_out
)
group_out
[
name
]
=
h5py
.
SoftLink
(
path
=
target
)
continue
h5item
=
group_in
[
name
]
...
...
@@ -116,6 +117,17 @@ def _save_subgroup(
_logger
.
warning
(
"
%s of type %s is not supported
"
,
h5item
.
name
,
type
(
h5item
))
def
_relative_link
(
org_parent
:
h5py
.
Group
,
link_target
:
str
,
new_parent
:
h5py
.
Group
)
->
str
:
parent_path
=
org_parent
.
name
.
replace
(
"
/
"
,
os
.
path
.
sep
)
link_target_path
=
link_target
.
replace
(
"
/
"
,
os
.
path
.
sep
)
rel_link_target_path
=
os
.
path
.
relpath
(
link_target_path
,
parent_path
)
new_link_target_path
=
os
.
path
.
join
(
new_parent
.
name
,
rel_link_target_path
)
return
os
.
path
.
normpath
(
new_link_target_path
)
def
_slice_dataset
(
h5dataset
:
h5py
.
Dataset
,
dim0_slice
:
slice
)
->
numpy
.
ndarray
:
expected_size
=
(
dim0_slice
.
stop
-
dim0_slice
.
start
)
//
dim0_slice
.
step
...
...
This diff is collapsed.
Click to expand it.
src/est/tests/test_split_monotonic.py
+
23
−
7
View file @
c57ab07a
...
...
@@ -28,7 +28,11 @@ def test_split_bliss_scan(tmp_path, split_function):
"
dataset5
"
:
10
,
"
dataset6
"
:
[
10
,
20
],
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
dataset3
"
:
"
>../group1/dataset3
"
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
>dataset3
"
:
"
../group1/dataset3
"
,
"
>dataset4
"
:
"
/1.1/group1/dataset4
"
,
},
}
}
...
...
@@ -44,7 +48,11 @@ def test_split_bliss_scan(tmp_path, split_function):
"
dataset4
"
:
[
0
,
1
,
2
],
"
dataset5
"
:
10
,
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
dataset3
"
:
"
>../group1/dataset3
"
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
dataset3
"
:
[
0
,
1
,
2
],
"
dataset4
"
:
[
0
,
1
,
2
],
},
},
"
1.2
"
:
{
"
@attr1
"
:
"
value1
"
,
...
...
@@ -57,12 +65,16 @@ def test_split_bliss_scan(tmp_path, split_function):
"
dataset4
"
:
[
3
,
4
,
5
],
"
dataset5
"
:
10
,
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
dataset3
"
:
"
>../group1/dataset3
"
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
dataset3
"
:
[
0
,
1
,
2
],
"
dataset4
"
:
[
3
,
4
,
5
],
},
},
}
in_file
=
str
(
tmp_path
/
"
in.h5
"
)
dictdump
.
dictto
h5
(
bliss_scan_data
,
in_file
)
dictdump
.
dictto
nx
(
bliss_scan_data
,
in_file
,
add_nx_class
=
False
)
out_file
=
str
(
tmp_path
/
"
out.h5
"
)
out_urls
=
split_function
(
...
...
@@ -74,7 +86,7 @@ def test_split_bliss_scan(tmp_path, split_function):
assert
out_urls
==
[
f
"
silx://
{
out_file
}
::/1.1
"
,
f
"
silx://
{
out_file
}
::/1.2
"
]
split_data
=
_normalize_h5data
(
dictdump
.
h5
todict
(
out_file
,
asarray
=
False
))
split_data
=
_normalize_h5data
(
dictdump
.
nx
todict
(
out_file
,
asarray
=
False
))
assert
split_data
==
expected_split_data
...
...
@@ -92,12 +104,16 @@ def test_split_bliss_scan_timeout(tmp_path, split_function):
"
dataset5
"
:
10
,
"
dataset6
"
:
[
10
,
20
],
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
dataset3
"
:
"
>../group1/dataset3
"
},
"
group2
"
:
{
"
@attr3
"
:
"
value3
"
,
"
>dataset3
"
:
"
../group1/dataset3
"
,
"
>dataset4
"
:
"
/1.1/group1/dataset4
"
,
},
}
}
in_file
=
str
(
tmp_path
/
"
in.h5
"
)
dictdump
.
dictto
h5
(
bliss_scan_data
,
in_file
)
dictdump
.
dictto
nx
(
bliss_scan_data
,
in_file
,
add_nx_class
=
False
)
out_file
=
tmp_path
/
"
out.h5
"
...
...
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