diff --git a/python/simulation.py b/python/simulation.py index 60538271d..3bf01a092 100644 --- a/python/simulation.py +++ b/python/simulation.py @@ -3,6 +3,7 @@ """ import functools +import inspect import math import numbers import os @@ -93,11 +94,12 @@ def fix_dft_args(args, i): def get_num_args(func): - return ( - 2 - if isinstance(func, Harminv) or isinstance(func, PadeDFT) - else func.__code__.co_argcount - ) + if isinstance(func, Harminv) or isinstance(func, PadeDFT): + return 2 + elif inspect.ismethod(func): + return func.__code__.co_argcount - 1 # remove 'self' from count + else: + return func.__code__.co_argcount def vec(*args):