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
1d107543
Commit
1d107543
authored
Oct 10, 2019
by
payno
Browse files
fix projections
parent
2a78dc35
Changes
2
Hide whitespace changes
Inline
Side-by-side
tomoscan/esrf/mock.py
View file @
1d107543
...
...
@@ -50,7 +50,9 @@ class _ScanMock:
:param scan_path:
:param n_radio:
:param n_ini_radio:
:param n_ini_radio: number of radio existing at t time. If None,
will create all the radio and consider the
acquisition as finished
:param n_extra_radio:
:param scan_range:
:param n_recons:
...
...
@@ -74,6 +76,12 @@ class _ScanMock:
self
.
write_metadata
(
n_radio
=
n_radio
,
scan_range
=
scan_range
,
ref_n
=
ref_n
,
dark_n
=
dark_n
)
if
n_ini_radio
is
None
:
n_ini_radio
=
n_radio
+
n_extra_radio
call_acqui_end
=
True
else
:
call_acqui_end
=
False
for
i_radio
in
range
(
n_ini_radio
):
self
.
add_radio
(
i_radio
)
for
i_extra_radio
in
range
(
n_extra_radio
):
...
...
@@ -85,6 +93,9 @@ class _ScanMock:
if
recons_vol
is
True
:
self
.
add_recons_vol
()
if
call_acqui_end
is
True
:
self
.
end_acquisition
()
def
add_radio
(
self
,
index
=
None
):
raise
NotImplementedError
(
'Base class'
)
...
...
tomoscan/esrf/test/test_edfscan.py
View file @
1d107543
...
...
@@ -77,7 +77,7 @@ class TestScanFactory(unittest.TestCase):
self
.
assertTrue
(
isinstance
(
scan
,
EDFTomoScan
))
class
FTSerieReconstructionTest
(
unittest
.
TestCase
):
class
TestDarksFlats
(
unittest
.
TestCase
):
"""unit test for the FTSerieReconstruction functions"""
def
setUp
(
self
):
def
saveData
(
data
,
_file
,
folder
):
...
...
@@ -145,6 +145,36 @@ class FTSerieReconstructionTest(unittest.TestCase):
self
.
assertTrue
(
12
not
in
self
.
acquiTwoFlats
.
flats
)
class
TestProjections
(
unittest
.
TestCase
):
"""Test that the """
def
setUp
(
self
)
->
None
:
self
.
folder
=
tempfile
.
mkdtemp
()
def
tearDown
(
self
)
->
None
:
shutil
.
rmtree
(
self
.
folder
)
def
testProjectionNoExtra
(
self
):
mock
=
MockEDF
(
scan_path
=
self
.
folder
,
n_radio
=
10
,
n_extra_radio
=
0
)
mock
.
end_acquisition
()
scan
=
EDFTomoScan
(
scan
=
self
.
folder
)
self
.
assertEqual
(
len
(
scan
.
projections
),
10
)
def
testProjectionUpdate
(
self
):
mock
=
MockEDF
(
scan_path
=
self
.
folder
,
n_radio
=
10
,
n_ini_radio
=
3
)
scan
=
EDFTomoScan
(
scan
=
self
.
folder
)
self
.
assertEqual
(
len
(
scan
.
projections
),
3
)
mock
.
add_radio
()
self
.
assertEqual
(
len
(
scan
.
projections
),
3
)
scan
.
update
()
self
.
assertEqual
(
len
(
scan
.
projections
),
4
)
def
testProjectionWithExtraRadio
(
self
):
mock
=
MockEDF
(
scan_path
=
self
.
folder
,
n_radio
=
10
,
n_extra_radio
=
3
)
mock
.
end_acquisition
()
scan
=
EDFTomoScan
(
scan
=
self
.
folder
)
self
.
assertEqual
(
len
(
scan
.
projections
),
10
)
class
TestScanValidatorFindFiles
(
unittest
.
TestCase
):
"""Function testing the getReconstructionsPaths function is correctly
functioning"""
...
...
@@ -338,8 +368,8 @@ class TestScanBaseJSON(unittest.TestCase):
def
suite
():
test_suite
=
unittest
.
TestSuite
()
for
ui
in
(
TestScanFactory
,
FTSerieReconstructionTest
,
TestScanValidatorFindFiles
,
TestRadioPath
,
for
ui
in
(
TestScanFactory
,
TestDarksFlats
,
TestScanValidatorFindFiles
,
TestRadioPath
,
TestProjections
,
TestTomoBaseHashable
):
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