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
Nabu
Commits
a12a65c9
Commit
a12a65c9
authored
Jan 06, 2022
by
Pierre Paleo
Browse files
Add unit test for sino normalization with array subtraction
parent
3b85c0c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
nabu/reconstruction/tests/test_sino_normalization.py
View file @
a12a65c9
...
...
@@ -28,7 +28,7 @@ class TestSinoNormalization:
@
pytest
.
mark
.
skipif
(
not
(
__has_pycuda__
),
reason
=
"Need pycuda for sinogram normalization with cuda backend"
)
def
test_
dff
_cuda
(
self
):
def
test_
sino_normalization
_cuda
(
self
):
sino_proc
=
SinoNormalization
(
kind
=
"chebyshev"
,
sinos_shape
=
self
.
sino
.
shape
)
...
...
@@ -44,3 +44,23 @@ class TestSinoNormalization:
assert
np
.
max
(
np
.
abs
(
res
-
ref
))
<
self
.
tol
def
test_sino_array_subtraction
(
self
):
with
pytest
.
raises
(
ValueError
):
SinoNormalization
(
kind
=
"subtract_array"
,
sinos_shape
=
self
.
sino
.
shape
)
array_1D
=
np
.
arange
(
self
.
sino
.
shape
[
-
1
])
array_2D
=
np
.
arange
(
self
.
sino
.
size
).
reshape
(
self
.
sino
.
shape
)
def
compare_normalizations
(
normalization_arr
):
sino_normalization
=
SinoNormalization
(
kind
=
"subtract_array"
,
sinos_shape
=
self
.
sino
.
shape
,
normalization_array
=
normalization_arr
)
sino
=
self
.
sino
.
copy
()
sino_normalization
.
normalize
(
sino
)
ref
=
self
.
sino
-
normalization_arr
assert
np
.
allclose
(
sino
,
ref
)
compare_normalizations
(
array_1D
)
compare_normalizations
(
array_2D
)
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