Commit ebb28308 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

[scanbase] Add ignore_projections paramater

parent b44a4210
......@@ -70,7 +70,12 @@ class TomoScanBase:
_SCHEME = None
"""scheme to read data url for this type of acquisition"""
def __init__(self, scan: Union[None, str], type_: str):
def __init__(
self,
scan: Union[None, str],
type_: str,
ignore_projections: Union[None, str] = None,
):
self.path = scan
self._type = type_
self._normed_flats = None
......@@ -87,6 +92,7 @@ class TomoScanBase:
self._flats_weights = None
"""list flats indexes to use for flat field correction and associate
weights"""
self._get_ignored_projections(ignore_projections)
def clear_caches(self):
"""clear caches. Might be call if some data changed after
......@@ -628,3 +634,15 @@ class TomoScanBase:
for proj_index in self.projections:
res[proj_index] = get_weights(proj_index=proj_index)
return res
def _get_ignored_projections(self, ignore_projections):
self.ignore_projections = ignore_projections
self._ignored_projections = None
if ignore_projections is not None:
self._ignored_projections = numpy.loadtxt(ignore_projections, comments="#")
if self._ignored_projections.ndim > 1:
raise ValueError(
"Expected exactly one row or one column in file %s"
% ignore_projections
)
self._ignored_projections = self._ignored_projections.astype(numpy.uint32)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment