cogwheel.utils.handle_scalars

cogwheel.utils.handle_scalars(function)

Return a function that outputs a scalar instead of 0-d array.

Decorator to change the behavior of functions that always return numpy arrays even if the input is scalar (e.g. scipy.interpolate.InterpolatedUnivariateSpline). The decorated function will return a scalar for scalar input and array for array input like usual numpy ufuncs.