You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
clean_channels: raise on degenerate channel locations instead of returning a meaningless result #539
Expected: a ValueError (or at least a warning) when the unit-normalised locations do not span three dimensions
(numerical rank below 3), as the existing errors for missing locations and for more than 75 percent removed channels do.
One more case for the same request: positions that are nearly, but not exactly, degenerate.
A rank test with NumPy's default tolerance (the largest singular value times the larger dimension times machine epsilon) accepts a montage that is flat to a picometer, and clean_channels still returns a degraded answer for it.
With the 19 positions and the data of the first post (eegprep 0.5.0), the true geometry removes 0 channels.
Putting every position on the plane Z = 0 and adding a normal jitter of 1e-9 mm, 1e-6 mm, 1e-3 mm or 0.1 mm to the three coordinates leaves np.linalg.matrix_rank of the unit position vectors at 3, and clean_channels removes 2 of the 19 channels every time.
So a check that raises on degenerate geometry has to define its own tolerance (for example a floor on the ratio of the smallest to the largest singular value of the unit vectors), because the default of matrix_rank is far below anything a real head has.
Activity
neuromechanist commentedon Nov 6, 2026
One more case for the same request: positions that are nearly, but not exactly, degenerate.
A rank test with NumPy's default tolerance (the largest singular value times the larger dimension times machine epsilon) accepts a montage that is flat to a picometer, and
clean_channelsstill returns a degraded answer for it.With the 19 positions and the data of the first post (eegprep 0.5.0), the true geometry removes 0 channels.
Putting every position on the plane
Z = 0and adding a normal jitter of 1e-9 mm, 1e-6 mm, 1e-3 mm or 0.1 mm to the three coordinates leavesnp.linalg.matrix_rankof the unit position vectors at 3, andclean_channelsremoves 2 of the 19 channels every time.So a check that raises on degenerate geometry has to define its own tolerance (for example a floor on the ratio of the smallest to the largest singular value of the unit vectors), because the default of
matrix_rankis far below anything a real head has.