Synthetic-aperture magnetometry (SAM) is a method for analysis of data obtained from magnetoencephalography (MEG) and electroencephalography (EEG). SAM is a nonlinear beamforming approach which can be thought of as a spatial filter.