Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tomotools
nxtomomill
Commits
6c7cb9be
Commit
6c7cb9be
authored
Sep 02, 2021
by
Henri Payno
Browse files
[test_h5_2nx] improve tests
- incorporated estimaged_cor, start_time, end_time...
parent
53b9cb42
Pipeline
#53973
failed with stages
in 4 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nxtomomill/converter/hdf5/test/test_h52nx.py
View file @
6c7cb9be
...
...
@@ -457,6 +457,7 @@ class TestStandardAcqConversionWithExternalUrls(unittest.TestCase):
with_nx_detector_attr
=
True
,
output_dir
=
output_dir
,
detector_name
=
"pcolinux"
,
y_rot
=
True
,
)
return
bliss_mock
.
samples
[
0
].
sample_file
...
...
@@ -655,6 +656,41 @@ class TestStandardAcqConversionWithExternalUrls(unittest.TestCase):
url_has_been_copied
(
file_path
=
self
.
config
.
output_file
,
url
=
url
)
)
# test with some extra parameters
self
.
config
.
param_already_defined
=
{
"x_pixel_size"
:
2.6
*
10e-6
,
"y_pixel_size"
:
2.7
*
10e-6
,
"energy"
:
12.2
,
}
self
.
config
.
overwrite
=
True
self
.
config
.
field_of_view
=
"Half"
init_url_1
=
DataUrl
(
file_path
=
file_1
,
data_path
=
"/1.1"
,
scheme
=
"silx"
)
self
.
config
.
default_copy_behavior
=
True
self
.
config
.
data_frame_grps
=
(
FrameGroup
(
frame_type
=
"init"
,
url
=
init_url_1
),
FrameGroup
(
frame_type
=
"dark"
,
url
=
dark_url_1
),
FrameGroup
(
frame_type
=
"flat"
,
url
=
flat_url_1
),
FrameGroup
(
frame_type
=
"proj"
,
url
=
proj_url_1
,
copy
=
False
),
FrameGroup
(
frame_type
=
"proj"
,
url
=
proj_url_2
,
copy
=
False
),
FrameGroup
(
frame_type
=
"proj"
,
url
=
proj_url_3
),
FrameGroup
(
frame_type
=
"proj"
,
url
=
proj_url_4
),
)
converter
.
from_h5_to_nx
(
configuration
=
self
.
config
,
)
scan
.
clear_caches
()
assert
numpy
.
isclose
(
scan
.
energy
,
12.2
)
assert
numpy
.
isclose
(
scan
.
x_pixel_size
,
2.6
*
10e-6
)
assert
numpy
.
isclose
(
scan
.
y_pixel_size
,
2.7
*
10e-6
)
with
EntryReader
(
DataUrl
(
file_path
=
scan
.
master_file
,
data_path
=
scan
.
entry
,
scheme
=
"h5py"
)
)
as
entry
:
assert
"instrument/detector"
in
entry
assert
"instrument/detector/estimated_cor_from_motor"
in
entry
class
TestZSeriesConversionWithExternalUrls
(
unittest
.
TestCase
):
"""
...
...
nxtomomill/test/utils/bliss.py
View file @
6c7cb9be
...
...
@@ -31,6 +31,7 @@ __date__ = "10/10/2020"
import
os
import
h5py
import
numpy
import
datetime
class
MockBlissAcquisition
:
...
...
@@ -63,6 +64,7 @@ class MockBlissAcquisition:
detector_name
=
"pcolinux"
,
acqui_type
=
"basic"
,
z_values
=
None
,
y_rot
=
False
,
):
self
.
__folder
=
output_dir
if
not
os
.
path
.
exists
(
output_dir
):
...
...
@@ -86,6 +88,7 @@ class MockBlissAcquisition:
n_flats
=
n_flats
,
with_nx_detector_attr
=
with_nx_detector_attr
,
detector_name
=
detector_name
,
y_rot
=
y_rot
,
)
elif
acqui_type
==
"zseries"
:
if
z_values
is
None
:
...
...
@@ -100,6 +103,7 @@ class MockBlissAcquisition:
with_nx_detector_attr
=
with_nx_detector_attr
,
detector_name
=
detector_name
,
z_values
=
z_values
,
y_rot
=
y_rot
,
)
elif
acqui_type
==
"xrd-ct"
:
acqui_tomo
=
_BlissXRD_CT
(
...
...
@@ -111,6 +115,7 @@ class MockBlissAcquisition:
n_flats
=
n_flats
,
with_nx_detector_attr
=
with_nx_detector_attr
,
detector_name
=
detector_name
,
y_rot
=
y_rot
,
)
else
:
raise
NotImplementedError
(
""
)
...
...
@@ -146,6 +151,7 @@ class _BlissSample:
n_flats
,
detector_name
,
with_nx_detector_attr
=
True
,
y_rot
=
False
,
):
self
.
_with_nx_detector_attr
=
with_nx_detector_attr
self
.
_sample_dir
=
sample_dir
...
...
@@ -163,6 +169,7 @@ class _BlissSample:
self
.
_energy
=
19.0
self
.
_distance
=
1.0
self
.
_pixel_size
=
(
0.0065
,
0.0066
)
self
.
_y_rot
=
y_rot
for
i_sequence
in
range
(
n_sequence
):
self
.
add_sequence
()
...
...
@@ -201,6 +208,12 @@ class _BlissSample:
seq_node
[
"technique/optic/sample_pixel_size"
]
=
numpy
.
asarray
(
self
.
_pixel_size
)
if
self
.
_y_rot
:
seq_node
[
"instrument/positioners/yrot"
]
=
0.13
seq_node
[
"start_time"
]
=
str
(
datetime
.
datetime
.
now
())
seq_node
[
"end_time"
]
=
str
(
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
minutes
=
10
)
)
def
register_scan_in_parent_seq
(
self
,
parent_index
,
scan_index
):
with
h5py
.
File
(
self
.
sample_file
,
mode
=
"a"
)
as
h5f
:
...
...
@@ -338,6 +351,7 @@ class _BlissZseriesTomo(_BlissSample):
detector_name
,
z_values
,
with_nx_detector_attr
=
True
,
y_rot
=
False
,
):
self
.
_z_values
=
z_values
super
().
__init__
(
...
...
@@ -349,6 +363,7 @@ class _BlissZseriesTomo(_BlissSample):
n_flats
=
n_flats
,
detector_name
=
detector_name
,
with_nx_detector_attr
=
with_nx_detector_attr
,
y_rot
=
y_rot
,
)
def
get_main_entry_title
(
self
):
...
...
@@ -389,6 +404,7 @@ class _BlissXRD_CT(_BlissSample):
n_flats
,
detector_name
,
with_nx_detector_attr
=
True
,
y_rot
=
False
,
):
"""XRD-CT are scan with only projection. Projections are store in
the init group. Data can be store under 1.1 but also 1.2..."""
...
...
@@ -401,6 +417,7 @@ class _BlissXRD_CT(_BlissSample):
n_flats
=
n_flats
,
detector_name
=
detector_name
,
with_nx_detector_attr
=
with_nx_detector_attr
,
y_rot
=
y_rot
,
)
def
get_main_entry_title
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment