alphapepttools.pp.detect_special_values#
- alphapepttools.pp.detect_special_values(data, verbosity=0)#
Detect special values such as NaN, zero, negative, and infinite values in the data.
This function checks for nonstandard values in the input data and returns a boolean mask indicating their position. Additionally, it provides a log summary for the number and kind of nonstandard values found. This function is useful for upfront checks of data integrity, e.g. prior to transformations or analyses like PCA or clustering.
Current nonstandard values include: - NaN values - Zero values - Negative values - Positive infinity - Negative infinity
If
warnis True, log warnings for found nonstandard values.- Parameters:
- Return type:
- Returns:
np.ndarray A boolean mask indicating the positions of nonstandard values in the data. True indicates a nonstandard value.
Examples
Detect special values in a data array:
import numpy as np from alphapepttools.pp.transform import detect_special_values # Create array with various special values data = np.array([[1.0, 0.0, -2.0], [np.nan, 5.0, np.inf], [3.0, -np.inf, 10.0]]) # Get mask of special values mask = detect_special_values(data, verbosity=0) # With verbosity to see counts mask = detect_special_values(data, verbosity=1) # Logs warnings about found special values