cogpy.preprocess.interpolate
Spatial interpolation for bad / missing channels.
Two families of functions are provided:
Grid-based (
interpolate_bads,extrapolate_bads) — assumes a regular 2D(AP, ML)grid. Fast and simple when electrodes sit on a uniform lattice.Coordinate-based (
interpolate_bads_coords,interpolate_bads_xarray) — takes explicit(x, y)electrode coordinates in physical units. Handles non-uniform layouts such as graphene ECoG arrays with hemispheric gaps, checkerboard 32×16 patterns, and depth probes. The geometry lives in the data (BIDS_electrodes.tsvcoordinates), not in the code.
Functions
|
Converts bad channel indicators in a 2D boolean array to NaN values in a corresponding 3D data array. |
|
Extrapolates to fill in NaN values based on the spatial neighborhood of each bad channel in a grid. |
|
Creates a mask indicating the positions of NaN values in the input array. |
|
Interpolates and optionally extrapolates to fill in bad or missing data in a 3D array based on a 2D mask of bad channels. |
|
Interpolate bad channels on a linear (1D) probe. |
|
Interpolate bad channels using explicit electrode coordinates. |
|
Interpolate bad channels in an xarray DataArray using stored coordinates. |