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
tomoscan
Commits
eba42cce
Commit
eba42cce
authored
Nov 06, 2020
by
Pierre Paleo
Browse files
[hdf5scan] Add unit test for ignore_projections
parent
f6897c28
Changes
1
Hide whitespace changes
Inline
Side-by-side
tomoscan/esrf/test/test_hdf5scan.py
View file @
eba42cce
...
...
@@ -311,9 +311,46 @@ class TestGetSinogram(HDF5TestBaseClass):
self
.
scan
.
get_sinogram
(
line
=
25
,
subsampling
=
1
)
class
TestIgnoredProjections
(
HDF5TestBaseClass
):
"""Test the ignore_projections parameter"""
def
setUp
(
self
)
->
None
:
super
(
TestIgnoredProjections
,
self
).
setUp
()
self
.
dataset_file
=
self
.
get_dataset
(
"frm_edftomomill_oneentry.nx"
)
self
.
ignored_projs
=
[
387
,
388
,
389
,
390
,
391
,
392
,
393
,
394
,
395
,
396
]
self
.
ignored_projs_fname
=
os
.
path
.
join
(
self
.
test_dir
,
"ignored_projections.txt"
)
numpy
.
savetxt
(
self
.
ignored_projs_fname
,
self
.
ignored_projs
,
header
=
"Indices of ignored projections"
,
comments
=
"#"
,
)
def
testIgnoreProjections
(
self
):
self
.
scan
=
HDF5TomoScan
(
scan
=
self
.
dataset_file
,
ignore_projections
=
self
.
ignored_projs_fname
)
self
.
scan
.
_projections
=
None
self
.
assertTrue
(
numpy
.
allclose
(
self
.
scan
.
_ignored_projections
,
self
.
ignored_projs
)
)
for
idx
in
self
.
ignored_projs
:
self
.
assertFalse
(
idx
in
self
.
scan
.
projections
,
"Projection index %d is supposed to be ignored"
%
idx
,
)
def
suite
():
test_suite
=
unittest
.
TestSuite
()
for
ui
in
(
TestHDF5Scan
,
TestFlatFieldCorrection
,
TestGetSinogram
):
for
ui
in
(
TestHDF5Scan
,
TestFlatFieldCorrection
,
TestGetSinogram
,
TestIgnoredProjections
,
):
test_suite
.
addTest
(
unittest
.
defaultTestLoader
.
loadTestsFromTestCase
(
ui
))
return
test_suite
...
...
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