src.toolbox.utils.processing_utils#

Functions#

find_nans(data)

Handles generation of masks and location indices of nans.

interpolate_nans(data, coords)

Fills nan values in y using interpolation over x.

remove_outliers(data)

Removes outliers (including NaNs) from data. Exclusion is based on

Module Contents#

src.toolbox.utils.processing_utils.find_nans(data: numpy.ndarray)[source]#

Handles generation of masks and location indices of nans. Intended for 1D arrays.

Parameters:

data (np.ndarray) – numpy array with nans

Returns:

  • nan_mask (np.ndarray) – mask where incices with nans are True

  • nan_indices (np.ndarray) – indices of locations where there are nans

  • non_nan_indices (np.ndarray) – indices of locations where there are values

src.toolbox.utils.processing_utils.interpolate_nans(data, coords)[source]#

Fills nan values in y using interpolation over x. x and y must have the same dimensions.

Parameters:
  • data (np.ndarray) – 1D array of size N to interpolate

  • coords (np.ndarray) – 1D array of size N which the data will be interpolated over

Returns:

filled_data – data with nans filled using linear interpolation

Return type:

np.ndarray

src.toolbox.utils.processing_utils.remove_outliers(data)[source]#

Removes outliers (including NaNs) from data. Exclusion is based on inter-quartile range.

Parameters:

data (np.ndarray | list) – 1D array of size N to interpolate

Returns:

filtered_data – data with outliers removed

Return type:

np.ndarray