aggregation.denoise_raw_features_data
aggregation.denoise_raw_features_data(
agg_raw_ephys_features,
n_jobs=-1,
verbose=1,
fac=DEFAULT_FAC,
)Apply denoising to aggregated raw electrophysiological features for each probe ID (PID).
This function takes aggregated raw features and applies denoising algorithms to reduce noise and improve signal quality. The denoising is performed PID-by-PID in parallel using the denoise_dataframe function, which requires channel labels for each PID.
Args: agg_raw_ephys_features (pandas.DataFrame): DataFrame containing aggregated raw electrophysiological features, typically indexed by (‘pid’, ‘channel’). Must contain a ‘channel_labels’ column for each PID. n_jobs (int, optional): Number of parallel jobs to run. -1 means using all processors. Default is -1. verbose (int, optional): Verbosity level for joblib.Parallel. 0 means no messages, 1 means progress messages, >1 means more detailed messages. Default is 1. fac (float or dict, optional): TV denoising factor forwarded to denoise_dataframe. Either a single scalar applied to every feature group, or a dict mapping a subset of {‘raw_ap’, ‘raw_lf’, ‘raw_lf_csd’, ‘waveforms’} to their own factor. Default is DEFAULT_FAC (raw_ap=raw_lf=raw_lf_csd=0.1, waveforms=3).
Returns: pandas.DataFrame: A DataFrame with denoised feature values. The denoising process reduces noise while preserving the original column structure.
Example: >>> import pandas as pd >>> # Assuming agg_df is a DataFrame with aggregated raw features >>> denoised_df = denoise_raw_features_data(agg_df) >>> print(denoised_df.head())
Note: - The function processes each PID separately in parallel to apply PID-specific denoising. - Denoising requires channel labels, from the ‘channel_labels’ column. Without that column (e.g. LF-only data with no stored labels) a warning is logged and every channel is labelled good (0). - If output_dir is provided, the result is saved as ‘raw_ephys_features_denoised.pqt’.