unbroadcast

glue.utils.array.unbroadcast(array)[source]

Given an array, return a new array that is the smallest subset of the original array that can be re-broadcasted back to the original array.

See https://stackoverflow.com/questions/40845769/un-broadcasting-numpy-arrays for more details.

Parameters
array~numpy.ndarray

The array to use.

Returns
ndarray

The reshaped array.