Skip to content
GitLab
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
2ba295da
Commit
2ba295da
authored
Feb 01, 2022
by
Henri Payno
Browse files
PEP8
parent
d247c4fb
Pipeline
#65834
passed with stages
in 3 minutes and 6 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nxtomomill/converter/dxfile/dxfileconverter.py
View file @
2ba295da
...
...
@@ -471,8 +471,8 @@ class _DxFileToNxConverter(BaseConverter):
self
.
_path_nxtomo_attrs
(
root_grp
)
def
_path_nxtomo_attrs
(
self
,
root_grp
):
root_grp
.
attrs
[
"NX_class"
]
=
u
"NXentry"
root_grp
.
attrs
[
"definition"
]
=
u
"NXtomo"
root_grp
.
attrs
[
"NX_class"
]
=
"NXentry"
root_grp
.
attrs
[
"definition"
]
=
"NXtomo"
root_grp
.
attrs
[
"version"
]
=
converter_version
()
root_grp
.
attrs
[
"default"
]
=
"instrument/detector"
instrument_grp
=
root_grp
.
require_group
(
"instrument"
)
...
...
@@ -486,7 +486,7 @@ class _DxFileToNxConverter(BaseConverter):
if
"data"
in
detector_grp
:
detector_grp
[
"data"
].
attrs
[
"interpretation"
]
=
"image"
sample_node
=
root_grp
.
require_group
(
"sample"
)
sample_node
.
attrs
[
"NX_class"
]
=
u
"NXsample"
sample_node
.
attrs
[
"NX_class"
]
=
"NXsample"
def
_convert_frames_without_duplication
(
self
):
image_key
=
[]
...
...
nxtomomill/converter/edf/edfconverter.py
View file @
2ba295da
...
...
@@ -273,7 +273,7 @@ def edf_to_nx(
)
if
distance
is
not
None
:
h5d
[
"/entry/instrument/detector/distance"
]
=
distance
h5d
[
"/entry/instrument/detector/distance"
].
attrs
[
"unit"
]
=
u
"m"
h5d
[
"/entry/instrument/detector/distance"
].
attrs
[
"unit"
]
=
"m"
pixel_size
=
scan
.
retrieve_information
(
scan
=
os
.
path
.
abspath
(
scan
.
path
),
...
...
@@ -285,11 +285,11 @@ def edf_to_nx(
h5d
[
"/entry/instrument/detector/x_pixel_size"
]
=
(
pixel_size
*
metricsystem
.
millimeter
.
value
)
h5d
[
"/entry/instrument/detector/x_pixel_size"
].
attrs
[
"unit"
]
=
u
"m"
h5d
[
"/entry/instrument/detector/x_pixel_size"
].
attrs
[
"unit"
]
=
"m"
h5d
[
"/entry/instrument/detector/y_pixel_size"
]
=
(
pixel_size
*
metricsystem
.
millimeter
.
value
)
h5d
[
"/entry/instrument/detector/y_pixel_size"
].
attrs
[
"unit"
]
=
u
"m"
h5d
[
"/entry/instrument/detector/y_pixel_size"
].
attrs
[
"unit"
]
=
"m"
energy
=
scan
.
retrieve_information
(
scan
=
os
.
path
.
abspath
(
scan
.
path
),
...
...
@@ -300,7 +300,7 @@ def edf_to_nx(
)
if
energy
is
not
None
:
h5d
[
"/entry/instrument/beam/incident_energy"
]
=
energy
h5d
[
"/entry/instrument/beam/incident_energy"
].
attrs
[
"unit"
]
=
u
"keV"
h5d
[
"/entry/instrument/beam/incident_energy"
].
attrs
[
"unit"
]
=
"keV"
# rotations values
rotation_dataset
=
h5d
.
create_dataset
(
...
...
@@ -590,13 +590,13 @@ def edf_to_nx(
)
# we can add some more NeXus look and feel
h5d
[
"/entry"
].
attrs
[
"NX_class"
]
=
u
"NXentry"
h5d
[
"/entry"
].
attrs
[
"definition"
]
=
u
"NXtomo"
h5d
[
"/entry"
].
attrs
[
"NX_class"
]
=
"NXentry"
h5d
[
"/entry"
].
attrs
[
"definition"
]
=
"NXtomo"
h5d
[
"/entry"
].
attrs
[
"version"
]
=
converter_version
()
h5d
[
"/entry/instrument"
].
attrs
[
"NX_class"
]
=
u
"NXinstrument"
h5d
[
"/entry/instrument/detector"
].
attrs
[
"NX_class"
]
=
u
"NXdetector"
h5d
[
"/entry/instrument/detector/data"
].
attrs
[
"interpretation"
]
=
u
"image"
h5d
[
"/entry/sample"
].
attrs
[
"NX_class"
]
=
u
"NXsample"
h5d
[
"/entry/instrument"
].
attrs
[
"NX_class"
]
=
"NXinstrument"
h5d
[
"/entry/instrument/detector"
].
attrs
[
"NX_class"
]
=
"NXdetector"
h5d
[
"/entry/instrument/detector/data"
].
attrs
[
"interpretation"
]
=
"image"
h5d
[
"/entry/sample"
].
attrs
[
"NX_class"
]
=
"NXsample"
h5d
[
"/entry/definition"
]
=
"NXtomo"
source_grp
=
h5d
[
"/entry/instrument"
].
get
(
"source"
,
None
)
if
source_grp
is
not
None
and
"NX_class"
not
in
source_grp
.
attrs
:
...
...
nxtomomill/test/utils/bliss.py
View file @
2ba295da
...
...
@@ -196,7 +196,7 @@ class _BlissSample:
# add sequence init information
with
h5py
.
File
(
self
.
sample_file
,
mode
=
"a"
)
as
h5f
:
seq_node
=
h5f
.
require_group
(
str
(
seq_ini_index
)
+
".1"
)
seq_node
.
attrs
[
"NX_class"
]
=
u
"NXentry"
seq_node
.
attrs
[
"NX_class"
]
=
"NXentry"
seq_node
[
"title"
]
=
self
.
get_main_entry_title
()
seq_node
.
require_group
(
"instrument/positioners"
)
# write energy
...
...
@@ -267,7 +267,7 @@ class _BlissSample:
acq_grp
[
"acq_expo_time"
]
=
4
det_path_2
=
"/"
.
join
((
"technique"
,
"scan"
,
self
.
_detector_name
))
seq_node
[
det_path_2
]
=
data
seq_node
.
attrs
[
"NX_class"
]
=
u
"NXentry"
seq_node
.
attrs
[
"NX_class"
]
=
"NXentry"
# write rotation angle value and translations
hrsrot_pos
=
seq_node
.
require_group
(
"/"
.
join
((
"instrument"
,
"positioners"
)))
hrsrot_pos
[
"hrsrot"
]
=
numpy
.
random
.
randint
(
...
...
@@ -451,7 +451,7 @@ class _BlissXRD_CT(_BlissSample):
with
h5py
.
File
(
self
.
sample_file
,
mode
=
"a"
)
as
h5f
:
scan_node
=
h5f
.
require_group
(
scan_name
)
scan_node
.
attrs
[
"NX_class"
]
=
u
"NXentry"
scan_node
.
attrs
[
"NX_class"
]
=
"NXentry"
measrurement_node
=
h5f
.
require_group
(
"/"
.
join
((
scan_name
,
"measurement"
)))
data
=
numpy
.
random
.
random
(
self
.
_n_frame_per_scan
)
*
256.2
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment