decorators
check_bool_param(func)
Decorator to check if the first function parameter is a boolean
check_file(func)
Decorator to check if the first function parameter is a list-like (list, tuple or np.ndarray)
check_int_param(func)
check_list_param(func)
Decorator to check if the first function parameter is a list-like (list, tuple or np.ndarray)
check_non_negative(func)
Decorator to check if the first function parameter is non negative -> place after @check_number_param
check_number_param(func)
Decorator to check if the first function parameter is a number (int or float)
check_param_type(type_)
Decorator to check if the first function parameter falls within the range [min_val, max_val]
check_property(*attribute_names)
Decorator to check if property is not None
check_range_param(min_val, max_val)
Decorator to check if the first function parameter falls within the range [min_val, max_val]
check_string_param(func)
check_valid_key(values=None, capitalized=True)
Decorator to check if the first function parameter is a valid value in the values list
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:
- Convert 0D data to 1D by adding an extra axis
- Execute the function
- 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:
- Convert 1D data to 2D by adding an extra axis
- Execute the function
- 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.