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
tomoscan
Commits
9efb8db0
Commit
9efb8db0
authored
Sep 09, 2020
by
payno
Browse files
Merge branch 'add_estimated_cor_frm_motor' into 'master'
add property `estimated_cor_frm_motor` See merge request
!24
parents
9cd81acf
e8f11706
Pipeline
#33159
passed with stages
in 3 minutes and 54 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tomoscan/esrf/edfscan.py
View file @
9efb8db0
...
...
@@ -89,6 +89,7 @@ class EDFTomoScan(TomoScanBase):
self
.
_edf_n_frames
=
n_frames
self
.
__distance
=
None
self
.
__energy
=
None
self
.
__estimated_cor_frm_motor
=
None
self
.
update
()
@
docstring
(
TomoScanBase
.
clear_caches
)
...
...
@@ -458,11 +459,14 @@ class EDFTomoScan(TomoScanBase):
return
self
.
__distance
*
MetricSystem
.
MILLIMETER
.
value
@
property
@
docstring
(
TomoScanBase
.
field_of_view
)
def
field_of_view
(
self
):
"""
# not managed for EDF files
return
None
:return: field of view of the scan. None if unknow else Full or Half
"""
@
property
@
docstring
(
TomoScanBase
.
estimated_cor_frm_motor
)
def
estimated_cor_frm_motor
(
self
):
# not managed for EDF files
return
None
...
...
tomoscan/esrf/hdf5scan.py
View file @
9efb8db0
...
...
@@ -104,6 +104,8 @@ class HDF5TomoScan(TomoScanBase):
_FOV_PATH
=
"instrument/detector/field_of_view"
_ESTIMATED_COR_FRM_MOTOR_PATH
=
"instrument/detector/estimated_cor_from_motor"
_ENERGY_PATH
=
"beam/incident_energy"
_SCHEME
=
"silx"
...
...
@@ -169,6 +171,7 @@ class HDF5TomoScan(TomoScanBase):
self
.
_distance
=
None
self
.
_fov
=
None
self
.
_energy
=
None
self
.
_estimated_cor_frm_motor
=
None
@
staticmethod
def
get_master_file
(
scan_path
):
...
...
@@ -550,6 +553,14 @@ class HDF5TomoScan(TomoScanBase):
else
:
return
None
def
_get_estimated_cor_frm_motor
(
self
):
with
HDF5File
(
self
.
master_file
,
"r"
,
swmr
=
True
,
libver
=
"latest"
)
as
h5_file
:
if
self
.
_ESTIMATED_COR_FRM_MOTOR_PATH
in
h5_file
[
self
.
_entry
]:
value
=
h5_file
[
self
.
_entry
][
self
.
_ESTIMATED_COR_FRM_MOTOR_PATH
][()]
return
float
(
value
)
else
:
return
None
def
_get_dim1_dim2
(
self
):
if
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
):
if
self
.
projections
is
not
None
:
...
...
@@ -612,15 +623,23 @@ class HDF5TomoScan(TomoScanBase):
return
self
.
_distance
@
property
@
docstring
(
TomoScanBase
.
field_of_view
)
def
field_of_view
(
self
):
"""
:return: field of view of the scan. None if unknow else Full or Half
"""
if
self
.
_fov
is
None
and
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
):
self
.
_fov
=
self
.
_get_fov
()
return
self
.
_fov
@
property
@
docstring
(
TomoScanBase
.
estimated_cor_frm_motor
)
def
estimated_cor_frm_motor
(
self
):
if
(
self
.
_estimated_cor_frm_motor
is
None
and
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
)
):
self
.
_estimated_cor_frm_motor
=
self
.
_get_estimated_cor_frm_motor
()
return
self
.
_estimated_cor_frm_motor
@
property
def
energy
(
self
)
->
typing
.
Union
[
None
,
float
]:
"""energy in keV"""
...
...
tomoscan/scanbase.py
View file @
9efb8db0
...
...
@@ -236,6 +236,15 @@ class TomoScanBase:
"""
raise
NotImplementedError
(
"Base class"
)
@
property
def
estimated_cor_frm_motor
(
self
):
"""
:return: Estimated center of rotation estimated from motor position
:rtype: Union[None, float]. If return value is in [-frame_width, +frame_width]
"""
raise
NotImplementedError
(
"Base class"
)
def
get_distance
(
self
,
unit
=
"m"
)
->
Union
[
None
,
float
]:
"""
...
...
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