swectral.make_array_func#
- swectral.make_array_func(func, name_suffix='x_only', *fixed_args, **fixed_kwargs)[source]#
Create a function from the given function that accepts an array-like only, fixing other parameters.
- Parameters:
- func
callable() Original function with signature
func(array-like, *args, **kwargs).- name_suffix
str,optional The name suffix for the output function, default is ‘x_only’.
- ``*fixed_args``
Positional arguments to fix.
- ``**fixed_kwargs``
Keyword arguments to fix.
- func
- Returns:
callable()A function that accepts array-like data only.
- Return type:
Examples
Suppose the original function is used as follows:
>>> result = array_processing_function(array, param1=1, param2=2)
A version that only requires the array argument is created as follows:
>>> func_accept_arr = make_array_func(array_processing_function, param1=1, param2=2)
Usage of the modified function:
>>> result = func_accept_arr(array)