ffrprep.analysis.corr_stim_to_resp¶
- ffrprep.analysis.corr_stim_to_resp(stim, resp, sfreq)[source]¶
Compute the correlation between stimulus and brain response.
The function compares a stimulus waveform and a response across various time lags and returns the strongest correlation and lag pair where the strongest correlation is.
- Parameters:
stim (array-like) – Stimulus signal file, should represent a single time-series
resp (array-like) – Brain response signal, should represent a single time-series
sfreq (float) – Sampling frequency, used to convert lag values to milliseconds
- Returns:
peak_corr (float) – The highest correlation value between the stimulus and the response
peak_lag (float) – The lag at which the maximum correlation occurs.