diff --git a/extraction/core/functions/loaders.py b/extraction/core/functions/loaders.py index 24eb62c12c5f4c65949bbe819a4c97cf0c04fd3f..bc8889d688f67f56cfccb4d2510a925f32b1c558 100644 --- a/extraction/core/functions/loaders.py +++ b/extraction/core/functions/loaders.py @@ -1,11 +1,11 @@ -from inspect import getargspec, getmembers, isfunction +from inspect import getmembers, isfunction, getfullargspec import numpy as np from extraction.core.functions import cell, trap from extraction.core.functions.custom import localisation from extraction.core.functions.distributors import trap_apply -from extraction.core.functions.math import div0 +from extraction.core.functions.math_utils import div0 def load_cellfuns_core(): @@ -30,9 +30,11 @@ def load_custom_args(): and f[1].__module__.startswith("extraction.core.functions") } args = { - k: getargspec(v).args[2:] + k: getfullargspec(v).args[2:] for k, v in funs.items() - if set(["cell_mask", "trap_image"]).intersection(getargspec(v).args) + if set(["cell_mask", "trap_image"]).intersection( + getfullargspec(v).args + ) } return ( @@ -55,7 +57,11 @@ def load_cellfuns(): if isfunction(f): def tmp(f): - return lambda m, img: trap_apply(f, m, img) + args = getfullargspec(f).args + if len(args) == 1: + return lambda m, _: trap_apply(f, m) + else: + return lambda m, img: trap_apply(f, m, img) CELLFUNS[k] = tmp(f) return CELLFUNS diff --git a/extraction/core/functions/math.py b/extraction/core/functions/math_utils.py similarity index 100% rename from extraction/core/functions/math.py rename to extraction/core/functions/math_utils.py