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
15f8b707
Commit
15f8b707
authored
Feb 25, 2020
by
Pierre Paleo
Browse files
Merge branch 'add_hdf5' of gitlab.esrf.fr:tomotools/tomoscan into add_hdf5
parents
79caeb74
21308146
Pipeline
#21898
failed with stages
in 1 minute and 2 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tomoscan/esrf/hdf5scan.py
View file @
15f8b707
...
...
@@ -293,34 +293,40 @@ class HDF5TomoScan(TomoScanBase):
@
property
@
docstring
(
TomoScanBase
.
projections
)
def
projections
(
self
)
->
typing
.
Union
[
lis
t
,
None
]:
def
projections
(
self
)
->
typing
.
Union
[
dic
t
,
None
]:
"""projections / radio, does not include the return projections"""
if
self
.
_projections
is
None
:
if
self
.
frames
:
proj_frames
=
tuple
(
filter
(
lambda
x
:
x
.
image_key
is
ImageKey
.
PROJECTION
and
x
.
is_return
is
False
,
self
.
frames
))
self
.
_projections
=
[
proj_frame
.
url
for
proj_frame
in
proj_frames
]
self
.
_projections
=
{}
for
proj_frame
in
proj_frames
:
self
.
_projections
[
proj_frame
.
index
]
=
proj_frame
.
url
return
self
.
_projections
@
projections
.
setter
def
projections
(
self
,
projections
:
lis
t
):
def
projections
(
self
,
projections
:
dic
t
):
self
.
_projections
=
projections
@
property
@
docstring
(
TomoScanBase
.
darks
)
def
darks
(
self
)
->
typing
.
Union
[
lis
t
,
None
]:
def
darks
(
self
)
->
typing
.
Union
[
dic
t
,
None
]:
if
self
.
_darks
is
None
:
if
self
.
frames
:
dark_frames
=
tuple
(
filter
(
lambda
x
:
x
.
image_key
is
ImageKey
.
DARK_FIELD
,
self
.
frames
))
self
.
_darks
=
[
dark_frame
.
url
for
dark_frame
in
dark_frames
]
self
.
_darks
=
{}
for
dark_frame
in
dark_frames
:
self
.
_darks
[
dark_frame
.
index
]
=
dark_frame
.
url
return
self
.
_darks
@
property
@
docstring
(
TomoScanBase
.
flats
)
def
flats
(
self
)
->
typing
.
Union
[
lis
t
,
None
]:
def
flats
(
self
)
->
typing
.
Union
[
dic
t
,
None
]:
if
self
.
_flats
is
None
:
if
self
.
frames
:
flat_frames
=
tuple
(
filter
(
lambda
x
:
x
.
image_key
is
ImageKey
.
FLAT_FIELD
,
self
.
frames
))
self
.
_flats
=
[
flat_frame
.
url
for
flat_frame
in
flat_frames
]
self
.
_flats
=
{}
for
flat_frame
in
flat_frames
:
self
.
_flats
[
flat_frame
.
index
]
=
flat_frame
.
url
return
self
.
_flats
@
docstring
(
TomoScanBase
.
update
)
...
...
@@ -432,7 +438,7 @@ class HDF5TomoScan(TomoScanBase):
if
self
.
_dim_1
is
None
and
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
):
if
self
.
projections
is
not
None
:
if
len
(
self
.
projections
)
>
0
:
self
.
_dim_1
,
self
.
_dim_2
=
get_data
(
self
.
projections
[
0
]).
shape
self
.
_dim_1
,
self
.
_dim_2
=
get_data
(
list
(
self
.
projections
.
values
())
[
0
]).
shape
return
self
.
_dim_1
@
property
...
...
@@ -440,7 +446,7 @@ class HDF5TomoScan(TomoScanBase):
if
self
.
_dim_2
is
None
and
self
.
master_file
and
os
.
path
.
exists
(
self
.
master_file
):
if
self
.
projections
is
not
None
:
if
len
(
self
.
projections
)
>
0
:
self
.
_dim_1
,
self
.
_dim_2
=
get_data
(
self
.
projections
[
0
]).
shape
self
.
_dim_1
,
self
.
_dim_2
=
get_data
(
list
(
self
.
projections
.
values
())
[
0
]).
shape
return
self
.
_dim_2
@
property
...
...
tomoscan/esrf/test/test_edfscan.py
View file @
15f8b707
...
...
@@ -259,7 +259,9 @@ class TestProjections(unittest.TestCase):
self
.
assertEqual
(
len
(
scan
.
projections
),
3
)
scan
.
update
()
self
.
assertEqual
(
len
(
scan
.
projections
),
4
)
self
.
assertTrue
(
isinstance
(
scan
.
projections
[
0
],
silx
.
io
.
url
.
DataUrl
))
index_0
=
list
(
scan
.
projections
.
keys
())[
0
]
self
.
assertTrue
(
isinstance
(
scan
.
projections
[
index_0
],
silx
.
io
.
url
.
DataUrl
))
def
testProjectionWithExtraRadio
(
self
):
mock
=
MockEDF
(
scan_path
=
self
.
folder
,
n_radio
=
11
,
n_extra_radio
=
2
,
...
...
tomoscan/esrf/test/test_hdf5scan.py
View file @
15f8b707
...
...
@@ -150,7 +150,7 @@ class TestHDF5Scan(HDF5TestBaseClass):
"""Make sure projections are valid"""
projections
=
self
.
scan
.
projections
self
.
assertEqual
(
len
(
self
.
scan
.
projections
),
1500
)
url_0
=
projections
[
0
]
url_0
=
projections
[
list
(
projections
.
keys
())[
0
]
]
self
.
assertEqual
(
url_0
.
file_path
(),
os
.
path
.
join
(
self
.
scan
.
master_file
))
self
.
assertEqual
(
url_0
.
data_slice
(),
22
)
...
...
tomoscan/scanbase.py
View file @
15f8b707
...
...
@@ -117,7 +117,7 @@ class TomoScanBase:
self
.
_flats
=
flats
@
property
def
darks
(
self
)
->
Union
[
None
,
dict
]:
def
darks
(
self
)
->
Union
[
None
,
dict
]:
"""list of darks files"""
return
self
.
_darks
...
...
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