function [SNR, SNRconservative] = get_snr(data,goodtrials,t,baselinewin) % this function calculates two different estimates of SNR, a normal one % and a conservative one. % input: % - data (has to be NORMALIZED so the peak response is 1) % - boolean array of good trials, only good trials are included in std % calculation % - time axis in same unit as baseline window % - [start end] baseline window % % Rob Teeuwen 20190815 % first average the baseline window for each trial to get a single % baseline value per trial. then calculate the standard deviation % of all baseline values. divide 1 by this std (because we % normalized, so 1 is the peak response). bl = find(t>baselinewin(1) & t