API Documentation#

Here we list the Application Programming Interface (API) for pyprep.

The NoisyChannels class#

Initialize PyPREP.

NoisyChannels(raw[, do_detrend, ...])

Detect bad channels in an EEG recording using a range of methods.

The Reference class#

Reference(raw, params[, ransac, ...])

Estimate the 'true' reference with all the bad channels interpolated.

The PrepPipeline class#

PrepPipeline(raw, prep_params, montage[, ...])

Early stage preprocessing (PREP) of EEG data.

The ransac module#

RANSAC bad channel identification.

find_bad_by_ransac(data, sample_rate, ...[, ...])

Detect channels that are not predicted well by other channels.

Logging#

pyprep logs through the standard logging module, on a logger named pyprep, and — like any well-behaved library — configures nothing on import. It is quiet, but not silent: with no configuration at all, warnings and errors still reach sys.stderr, because Python falls back to logging.lastResort when no handler is found. "INFO" records, which is where the pipeline reports what it decided, are hidden until you ask for them.

There are two ways to ask. Interactively, setup_logging() attaches a handler to the pyprep logger and stops those records from propagating any further, so they are not printed twice:

import pyprep

pyprep.setup_logging("info")

In an application that already routes logging somewhere of its own — a file, a JSON aggregator, a Rich console — do not call it at all. The records reach your handlers by propagation, and set_log_level() raises pyprep’s verbosity without touching the handler, the stream, the format, or the propagation you chose:

pyprep.set_log_level("info")

The root logger is never configured either way. MNE has its own mne logger, controlled separately with mne.set_log_level(); note also that the progress bar drawn during window-wise RANSAC is an mne.utils.ProgressBar, which writes to its own stream rather than through either logger, so neither function silences it.

setup_logging([level, stream, fmt])

Send pyprep's log records to a stream, at the given level.

set_log_level(level[, return_old_level])

Change the level of the pyprep logger, leaving its handlers alone.