===== Signal to Noise Ratio (SNR) ===== Changes in the E/I balance directly affect the signal-to-noise ratio (SNR) of local circuity, where increases in the E/I balance support the suppression of spontaneous, asynchronous, activity, in favor of evoked, synchronous firing and thus increasing SNR. The [[tools:auditorysteadystate|Auditory Steady State Response]] has been suggested to be generated and maintained by GABAA receptors, with auditory response neuronal synchronization transmitted through neuronal networks mediated by GABAA receptors cycling through inhibition and rebound excitation. \\ Please refer to the [[https://github.com/LabNeuroCogDevel/7T_EEG/tree/main/Functions/SNR_processing| LNCD Github Repository]] * Epochs of -200 to 800ms were defined around the stimulus onset to extract the 40, 30, and/or 30Hz stimuli conditions. * Prestimulus values (-200 to 0ms) were used for baseline correction. * The ASSR was analyzed for every electrode. * The Fast Fourier Transform (FFT) was applied to single-trial epochs resulting in single-trial power spectra that then averaged to calculate total power. * Evoked power was then derived from averaging the single trial epochs in the time domain and calculating the resulting power spectra using FFT * Spontaneous power was derived by subtracting the evoked power from the total power * SNR was then calculated as evoked power divided by spontaneous power * A threshold of 2 standard deviations from the mean was used to exclude statistical outliers for each electrode for c = 1:64 chanData = squeeze(EEG.data(c,evokedIdx,:)); avgData = mean(chanData,2); %avg all the epochs in the time domain then take fft to find evoked % Perform FFT N = 2^nextpow2(length(avgData)); % Next power of 2 from signal length for FFT fft_result = fft(avgData, N)/length(avgData); evokedPower(:,c) = (abs(fft_result(1:N/2+1)).^2); % Square the magnitude, turn to db frequencies = 512/2*linspace(0,1,N/2+1); findx = find(frequencies >= minf & frequencies <= maxf); newfreqs = frequencies(:, findx); % to find power on each individual trial for t = 1:size(chanData, 2) trialData = chanData(:,t); % Perform FFT N = 2^nextpow2(length(trialData)); % Next power of 2 from signal length for FFT fft_result = fft(trialData, N)/length(trialData); trialPower_spectrum(:,t) = (abs(fft_result(1:N/2+1)).^2); % Square the magnitude, frequencies = 512/2*linspace(0,1,N/2+1); end totalPower(:,c) = mean(trialPower_spectrum,2); inducedPower(:,c) = totalPower(:,c) - evokedPower(:,c); end T = table('Size', [0, 6], 'VariableTypes', {'string', 'double', 'double','double','double','double'}); T.Properties.VariableNames = {'Subject', 'Channel', 'freqs','Total','Induced', 'Evoked'}; for c = 1:64 chanT = table('Size', [0, 6], 'VariableTypes', {'string', 'double', 'double','double','double','double'}); chanT.Properties.VariableNames = {'Subject', 'Channel', 'freqs','Total','Induced', 'Evoked'}; for l = 1:length(totalPower) chanT.Subject(l) = idvalues{i}; chanT.Channel(l) = c; chanT.freqs(l) = frequencies(1,l); chanT.Total(l) = totalPower(l,c); chanT.Induced(l) = inducedPower(l,c); chanT.Evoked(l) = evokedPower(l,c); end T = [T ; chanT]; end