def convert_args(test_fcn, *test_args):
    """
    Decorator to be using in formulas to convert ``test_args`` depending on
    the ``test_fcn``.

    :param test_fcn: A test function that converts arguments.
    :type test_fcn: function
    :param test_args: Names of args to convert using ``test_fcn``.
    :type test_args: str

    The following test functions are available.
    * :func:`dimensionless_to_index`

    Example: Convert ``dawn_idx`` and ``eve_idx`` to indices::

        @convert_args(dimensionless_to_index, 'dawn_idx', 'eve_idx')
        def f_max_T(Tcell24, dawn_idx, eve_idx):
            idx = dawn_idx + np.argmax(Tcell24[dawn_idx:eve_idx])
            return Tcell24[idx], idx
    """
    def wrapper(origfcn):
        @functools.wraps(origfcn)
        def newfcn(*args, **kwargs):
            argspec = getargspec(origfcn)  # use ``inspect`` to get arg names
            kwargs.update(zip(argspec.args, args))  # convert args to kw
            # loop over test args
            for a in test_args:
                # convert a if it's in args
                if a in argspec.args:
                    kwargs[a] = test_fcn(kwargs[a])  # update kwargs
            # call original function with converted args
            return origfcn(**kwargs)
        # return wrapped function
        return newfcn
    # return the wrapper function that consumes the original function
    return wrapper
Decorator to be using in formulas to convert ``test_args`` depending on
    the ``test_fcn``.

    :param test_fcn: A test function that converts arguments.
    :type test_fcn: function
    :param test_args: Names of args to convert using ``test_fcn``.
    :type test_args: str

    The following test functions are available.
    * :func:`dimensionless_to_index`

    Example: Convert ``dawn_idx`` and ``eve_idx`` to indices::

        @convert_args(dimensionless_to_index, 'dawn_idx', 'eve_idx')
        def f_max_T(Tcell24, dawn_idx, eve_idx):
            idx = dawn_idx + np.argmax(Tcell24[dawn_idx:eve_idx])
            return Tcell24[idx], idx