wrap_function_keep_dimensions function

(Shortest import: from brian2.units.fundamentalunits import wrap_function_keep_dimensions)

brian2.units.fundamentalunits.wrap_function_keep_dimensions(func)[source]

Returns a new function that wraps the given function func so that it keeps the dimensions of its input. Quantities are transformed to unitless numpy arrays before calling func, the output is a quantity with the original dimensions re-attached.

These transformations apply only to the very first argument, all other arguments are ignored/untouched, allowing to work functions like sum to work as expected with additional axis etc. arguments.