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
894c67d4
Commit
894c67d4
authored
Nov 06, 2020
by
Pierre Paleo
Browse files
[edfscan] add unit test for ignored_projections
parent
f818fa79
Pipeline
#36686
passed with stages
in 10 minutes and 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tomoscan/esrf/test/test_edfscan.py
View file @
894c67d4
...
...
@@ -601,6 +601,40 @@ class TestScanBaseJSON(unittest.TestCase):
scan_to_update
.
load_from_dict
(
outfile
)
class
TestIgnoredProjections
(
unittest
.
TestCase
):
"""Test that the """
def
setUp
(
self
)
->
None
:
self
.
folder
=
tempfile
.
mkdtemp
()
self
.
ignored_projs
=
[
5
,
6
,
7
]
self
.
ignored_projs_fname
=
os
.
path
.
join
(
self
.
folder
,
"ignored_projections.txt"
)
numpy
.
savetxt
(
self
.
ignored_projs_fname
,
self
.
ignored_projs
,
header
=
"Indices of ignored projections"
,
comments
=
"#"
,
)
def
tearDown
(
self
)
->
None
:
shutil
.
rmtree
(
self
.
folder
)
def
testProjectionNoExtra
(
self
):
mock
=
MockEDF
(
scan_path
=
self
.
folder
,
n_radio
=
15
,
n_ini_radio
=
10
,
n_extra_radio
=
0
,
dim
=
10
)
mock
.
end_acquisition
()
scan
=
EDFTomoScan
(
scan
=
self
.
folder
,
ignore_projections
=
self
.
ignored_projs_fname
)
print
(
scan
.
projections
)
self
.
assertTrue
(
numpy
.
allclose
(
scan
.
_ignored_projections
,
self
.
ignored_projs
))
for
idx
in
self
.
ignored_projs
:
self
.
assertFalse
(
idx
in
scan
.
projections
,
"Projection index %d is supposed to be ignored"
%
idx
,
)
def
suite
():
test_suite
=
unittest
.
TestSuite
()
for
ui
in
(
...
...
@@ -613,6 +647,7 @@ def suite():
TestOriDarksFlats
,
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
.
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