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
86262449
Commit
86262449
authored
Jun 23, 2022
by
Pierre Paleo
Browse files
Merge branch 'option_near_tafforensis' into 'master'
Composite cor finder See merge request
!182
parents
bdade8fb
91565f40
Pipeline
#78334
passed with stages
in 7 minutes and 5 seconds
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
nabu/__init__.py
View file @
86262449
__version__
=
"2022.1.1
0
"
__version__
=
"2022.1.1
1
"
__nabu_modules__
=
[
"app"
,
"cuda"
,
...
...
nabu/pipeline/estimators.py
View file @
86262449
This diff is collapsed.
Click to expand it.
nabu/pipeline/tests/test_estimators.py
0 → 100644
View file @
86262449
import
pytest
import
numpy
as
np
from
nabu.testutils
import
utilstest
from
nabu.resources.dataset_analyzer
import
HDF5DatasetAnalyzer
from
nabu.pipeline.estimators
import
CompositeCOREstimator
@
pytest
.
fixture
(
scope
=
"class"
)
def
bootstrap
(
request
):
cls
=
request
.
cls
dataset_downloaded_path
=
utilstest
.
getfile
(
"test_composite_cor_finder_data.h5"
)
cls
.
theta_interval
=
4.5
*
1
# this is given. Radios in the middle of steps 4.5 degree long
# are set to zero for compression
# You can still change it to a multiple of 4.5
cls
.
cor_pix
=
1321.375
cls
.
abs_tol
=
0.0001
cls
.
dataset_info
=
HDF5DatasetAnalyzer
(
dataset_downloaded_path
)
cls
.
cor_options
=
"""side="near"; near_pos = 300.0; near_width = 20.0 """
@
pytest
.
mark
.
usefixtures
(
"bootstrap"
)
class
TestCompositeCorFinder
:
def
test
(
self
):
cor_finder
=
CompositeCOREstimator
(
self
.
dataset_info
,
theta_interval
=
self
.
theta_interval
,
cor_options
=
self
.
cor_options
)
cor_position
=
cor_finder
.
find_cor
()
message
=
"Computed CoR %f "
%
cor_position
+
" and real CoR %f do not coincide"
%
self
.
cor_pix
assert
np
.
isclose
(
self
.
cor_pix
,
cor_position
,
atol
=
self
.
abs_tol
),
message
nabu/resources/utils.py
View file @
86262449
...
...
@@ -111,6 +111,29 @@ def extract_parameters(params_str, sep=";"):
res
[
param_name
]
=
param_val
return
res
def
compact_parameters
(
params_dict
,
sep
=
";"
):
"""
Compact the parameters from a dict into a string.
This is the inverse of extract_parameters. It can be used for example in tomwer to convert
parameters into a string, for example for cor_options, prior to calling a nabu method which
is expecting an argument to be in the form of a string containing options.
Example
--------
The function can be used as follows:
>>> compact_parameters( {"side":"near", "near_pos":300 } )
... "side=near; nearpos= 300;"
"""
if
params_dict
in
({},
None
):
return
""
res
=
""
for
key
,
val
in
params_dict
.
items
():
res
=
res
+
"{key} = {val} "
+
sep
return
res
def
is_hdf5_extension
(
ext
,
errors
=
"ignore"
):
if
ext
.
lower
()
in
[
"h5"
,
"hdf5"
,
"nx"
]:
...
...
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