Skip to content

dimension_handler

handle_array_sequence(func)

This function handles sequences (lists, arrays, etc.) containing numpy arrays. The sequence will be converted to a 2D array, instead of having a 1D array with dtype np.ndarray.

This problem can come up when, for example, you are converting a pandas sequence with arrays als elements to numpy.

io_at_least_1d(func)

Handles the dimension of functions that can have both 0D and 1D data as an input or output. The data will be converted in the following way:

  1. Convert 0D data to 1D by adding an extra axis
  2. Execute the function
  3. Convert 1D output data back to 0D by removing an axis

io_at_least_2d(func)

Handles the dimension of functions that can have both 1D and 2D data as an input or output. The data will be converted in the following way:

  1. Convert 1D data to 2D by adding an extra axis
  2. Execute the function
  3. Convert 2D output data back to 1D by removing an axis

list_dimension_handler(func)

Handles input dimension for functions that can take an integer or a list.