Commit 596e5039 authored by Pierre Paleo's avatar Pierre Paleo Committed by Pierre Paleo
Browse files

Update validator for auto-CoR

parent 7f5957db
......@@ -134,3 +134,17 @@ sino_normalizations = {
"": None,
"chebyshev": "chebyshev",
}
class CorMethods(Enum):
AUTO = "centered"
CENTERED = "centered"
GLOBAL = "global"
cor_methods = {
"auto": "centered",
"centered": "centered",
"global": "global",
}
......@@ -217,16 +217,18 @@ def optional_float_validator(val):
@validator
def cor_validator(val):
if isinstance(val, float):
return val
elif len(val.strip()) >= 1:
if val.lower() in ["auto", "global", "centered"]:
return val.lower()
val_float, error = convert_to_float(val)
assert error is None, "Invalid number"
val_float, error = convert_to_float(val)
if error is None:
return val_float
else:
if len(val.strip()) == 0:
return None
val = name_range_checker(
val.lower(),
CorMethods.values(),
"center of rotation estimation method",
replacements=cor_methods
)
return val
@validator
......
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