diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-08-16 14:26:11 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-08-16 14:26:11 +0200 |
commit | 98330afce6f6b7173f89005f8c6e574c7821175d (patch) | |
tree | 4b015b3cec75bd017c053877c58e90216b3834bb /lib/dfatool.py | |
parent | d3904f66981cf9bdd8962e8e32fcc11497cd2628 (diff) |
documentation
Diffstat (limited to 'lib/dfatool.py')
-rwxr-xr-x | lib/dfatool.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/dfatool.py b/lib/dfatool.py index 95e76e7..abf8c10 100755 --- a/lib/dfatool.py +++ b/lib/dfatool.py @@ -21,11 +21,10 @@ arg_support_enabled = True def running_mean(x: np.ndarray, N: int) -> np.ndarray: """ - Compute running average. + Compute `N` elements wide running average over `x`. - arguments: - x -- NumPy array - N -- how many items to average + :param x: 1-Dimensional NumPy array + :param N: how many items to average """ cumsum = np.cumsum(np.insert(x, 0, 0)) return (cumsum[N:] - cumsum[:-N]) / N @@ -71,16 +70,17 @@ def gplearn_to_function(function_str: str): print(eval_str) return eval(eval_str, eval_globals) -def _arg_name(arg_index: int) -> str: - return '~arg{:02}'.format(arg_index) - def append_if_set(aggregate: dict, data: dict, key: str): """Append data[key] to aggregate if key in data.""" if key in data: aggregate.append(data[key]) def mean_or_none(arr): - """Compute mean of NumPy array arr, return -1 if empty.""" + """ + Compute mean of NumPy array `arr`, return -1 if empty. + + :param arr: 1-Dimensional NumPy array + """ if len(arr): return np.mean(arr) return -1 |