= Deriving LFP signals from raw signals = ''Author: Konstantinos Nasiotis'' <> {{attachment:deriveLFPIntro.gif}} == Convert Raw to LFP == The toolbox features a convenient signal converter that produces local field potential (LFP) time-series from raw signals. The converter jointly processes the recorded raw data and the events generated by the spike sorter. The fast-sampled raw signals are downsampled to a new user selected sampling rate (e.g. 1000 Hz), with an anti-aliasing bandpass filter (e.g., [0.5, 150] Hz) applied. LFP time series and spiking/acquisition events are automatically featured in the Brainstorm database as new data files. Everything needed for the electrophysiology analysis will be incorporated into a single .bst file (Brainstorm binary file format), located in the brainstorm_db folder (to get the folder location, type: ''bst_get('BrainstormDbDir')''). In order to get the LFP from the raw file after spike sorting, users need to drag and drop the link to raw file into the processing box, and then click Run->Electrophysiology->Convert Raw to LFP. '''Note: Following the spike sorting steps is not needed in order to Derive the LFP from the RAW signal. Users can go straight to this step if needed.''' Once the conversion function is selected, a new window appears with the following options: 1. Despike LFP: Apply Bayesian Spike Removal (See next section). This process requires the Optimization Toolbox. 1. Sampling rate of the LFP: Sampling rate of the downsampled LFP signals. 1. LFP filter: The filter to be used for getting the LFP (typical range [0.5, 150] Hz) 1. Notch filter: Selection of the frequencies for Notch filter while converting to LFP. 1. Parallel Processing: Activate the parallel toolbox and run processes in parallel. Greatly improves the speed of the process (requires Matlab’s parallel toolbox). 1. Memory to use for demultiplexing: There is a demultiplexing process that separates the electrodes into separate files in the background. '''The larger the RAM selected is, the faster this process will be performed. Make sure a high portion of the Computer’s RAM is selected. '''Demultiplexing should have already been performed on the spike-sorting step. In case the temp folder emptied (Brainstorm restarted), or users went straight to LFP conversion, only then demultiplexing would be performed again. {{attachment:deriveLFPWindow.gif}} Once the conversion is complete, a single .bst file will be created that contains all the acquisition events, the spiking events and the LFP signals (saved in the dataset’s folder in brainstorm_db). This file will automatically be imported in the database with the suffix _''LFP'', as shown on the next figure. The channels file will be copied to the new entry. Users can now just use this file for the entire analysis. This makes it very practical for exchange reasons with other researchers since a e.g. 30KHz raw file would be converted to a 30 times smaller LFP file. {{attachment:convertedLFPOutput_2022.png}} == Without Bayesian Spike Removal == If the Bayesian spike removal box is not selected, the conventional LFP conversion will be applied. LFPs provide direct measures of the summed post-synaptic electrical activity originating cell assemblies in the vicinity of each recording electrode and the frequencies that contain physiological reponses are much lower than the sampling frequency. Therefore, the signals are filtered to e.g. [0.5-150] Hz, and then sequentially downsampled to e.g. 1000Hz. == With Bayesian Spike Removal == Although traditionally the spike waveforms are considered to contain spectral power on the higher frequencies, it has been shown (Zanos et al. 2011) that there are low frequency components that could affect the computations in functions that rely on spiking activity. This function applies a prior on the activity on the entire electrode, for removing the spiking spectral features on the lower frequencies, following a Bayesian framework. This process requires the Optimization Toolbox. {{{#!wiki important If spiking analysis (spike field coherence, spike triggered average etc.) is required in the study, it is highly recommended that users enable this option. However, Bayesian spike removal can significantly increase the processing time, especially for longer recordings. }}} A demonstration of the algorithm's effectiveness is shown on the following figure, extracted from the Brainstorm process. The detected spiking activity is shown with the green asterisks. The blue signal shows the signal after a notch filter is applied; this is the input to the algorithm. The red signal shows the output, after the Bayesian spike removal has been applied. {{attachment:proofItWorks.png}} Readers should notice that the spurious correlations are removed only around where spikes have been detected/assigned from the previous spike-sorting step. '''References''' * Zanos TP, Mineault PJ, Pack C C<
>[[https://journals.physiology.org/doi/full/10.1152/jn.00642.2010|Removal of spurious correlations between spikes and local field potentials]]<
>Journal of Neurophysiology, 2011 <> <>