OSCR

Global neural oscillations underlie performance variability and attentional state fluctuations in humans.

Code ↔ Paper

4 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

3 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 4 matches
  1. [1] § Methods › Aperiodic component analysis ↔ freq_lan.m, lines 1 to 136 · score 0.70 · cfg.tapsmofrq, multi taper, frequency smoothing, Hz · block oscr:b:RNZWH40EYZTQG-O · Report a mismatch
  2. [2] § Methods › Aperiodic component analysis ↔ fieltrip/freq_mtmconvol_lan.m, lines 1 to 61 · score 0.68 · cfg.tapsmofrq, multi taper, DPSS, Sequences, smoothing, spectral · block oscr:b:XPZ8XKFWM31DH-6 · Report a mismatch
  3. [3] § Methods › Aperiodic component analysis ↔ fieltrip/freq_mtmconvol_lan.m, lines 1 to 61 · score 0.58 · power spectra, oscillatory activity, freqanalysis, preprocessed · block oscr:b:XPZ8XKFWM31DH-6 · Report a mismatch
  4. [4] § Methods › Anatomical localization and classification of electrode contacts ↔ iEEG/lan_setref_micromed.m, lines 422 to 541 · score 0.53 · co registered, SPM, location, electrodes · block oscr:b:60W3BW7NPTGXW-Z · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 553 lines · 21 KB · no license · 2 matches

  1. function [freq] = freq_mtmconvol_lan(cfg, LAN, texto)
  2. % v.0.1.2
  3. % analysis multipater for LAN structur
  4. % adapted of filetrip scripts
  5. %
  6. %
  7. %
  8. %
  9. %
  10. % Original HELP por freqanalysis_mtmconvol.m
  11. %
  12. % FREQANALYSIS_MTMCONVOL performs time-frequency analysis on any time series trial data
  13. % using the 'multitaper method' (MTM) based on Slepian sequences as tapers. Alternatively,
  14. % you can use conventional tapers (e.g. Hanning).
  15. %
  16. % Use as
  17. % [freq] = freqanalysis(cfg, data)
  18. %
  19. % The data should be organised in a structure as obtained from
  20. % the PREPROCESSING function. The configuration should be according to
  21. % cfg.method = method used for frequency or time-frequency decomposition
  22. % see FREQANALYSIS for details
  23. % cfg.output = 'pow' return the power-spectra
  24. % 'powandcsd' return the power and the cross-spectra
  25. % 'fourier' return the complex Fourier-spectra
  26. % cfg.taper = 'dpss', 'hanning' or many others, see WINDOW (default = 'dpss')
  27. %
  28. % For cfg.output='powandcsd', you should specify the channel combinations
  29. % between which to compute the cross-spectra as cfg.channelcmb. Otherwise
  30. % you should specify only the channels in cfg.channel.
  31. %
  32. % cfg.channel = Nx1 cell-array with selection of channels (default = 'all'),
  33. % see CHANNELSELECTION for details
  34. % cfg.channelcmb = Mx2 cell-array with selection of channel pairs (default = {'all' 'all'}),
  35. % see CHANNELCOMBINATION for details
  36. % cfg.foi = vector 1 x numfoi, frequencies of interest
  37. % cfg.t_ftimwin = vector 1 x numfoi, length of time window (in seconds)
  38. % cfg.tapsmofrq = vector 1 x numfoi, the amount of spectral smoothing through
  39. % multi-tapering. Note that 4 Hz smoothing means
  40. % plus-minus 4 Hz, i.e. a 8 Hz smoothing box.
  41. % cfg.toi = vector 1 x numtoi, the times on which the analysis windows
  42. % should be centered (in seconds)
  43. % cfg.trials = 'all' or a selection given as a 1xN vector (default = 'all')
  44. % cfg.keeptrials = 'yes' or 'no', return individual trials or average (default = 'no')
  45. % cfg.keeptapers = 'yes' or 'no', return individual tapers or average (default = 'no')
  46. % cfg.pad = number or 'maxperlen', length in seconds to which the data can be padded out (default = 'maxperlen')
  47. %
  48. % The padding will determine your spectral resolution. If you want to
  49. % compare spectra from data pieces of different lengths, you should use
  50. % the same cfg.pad for both, in order to spectrally interpolate them to
  51. % the same spectral resolution. Note that this will run very slow if you
  52. % specify cfg.pad as maxperlen AND the number of samples turns out to have
  53. % a large prime factor sum. This is because the FFTs will then be computed
  54. % very inefficiently.
  55. %
  56. % An asymmetric taper usefull for TMS is used when cfg.taper='alpha' and corresponds to
  57. % W. Kyle Mitchell, Mark R. Baker & Stuart N. Baker. Muscle Responses to
  58. % Transcranial Stimulation Depend on Background Oscillatory Activity.
  59. % published online Jul 12, 2007 J. Physiol.
  60. %
  61. % See also FREQANALYSIS
  62. %fieldtripdefs
  63. if nargin < 3
  64. texto = plus_text();
  65. end
  66. texto = plus_text(texto, ' ');
  67. if isfield(LAN,'freq')
  68. freq = LAN.freq
  69. end
  70. %
  71. data.trial = LAN.data;
  72. time = LAN.time;
  73. % evaluar bien esto
  74. %data.offset = ones(1,length(LAN.data)) * -300;%time(:,1)' +
  75. %data.offset = round(time(1)*LAN.srate);
  76. %data.offset = LAN.time(:,2);
  77. LAN.time =[];
  78. for t = 1:length(LAN.data)
  79. LAN.time{t} = linspace(time(t,1) , time(t,2) , length(LAN.data{t}));
  80. data.offset(t) = round(LAN.time{t}(1)*LAN.srate);
  81. end
  82. data.fsample = LAN.srate;
  83. LAN.data = [];
  84. %
  85. for l = 1:LAN.nbchan%length( LAN.chanlocs )
  86. try
  87. data.label{l,1} = LAN.chanlocs(l).labels;
  88. catch
  89. data.label{l,1} = num2str(l);
  90. end
  91. end
  92. % temporal
  93. %cfg = []
  94. % set all the defaults
  95. if ~isfield(cfg, 'method'), cfg.method = 'mtmconvol'; end
  96. if ~isfield(cfg, 'keeptapers'), cfg.keeptapers = 'no'; end
  97. if ~isfield(cfg, 'keeptrials'), cfg.keeptrials = 'no'; end
  98. if ~isfield(cfg, 'calcdof'), cfg.calcdof = 'no'; end
  99. if ~isfield(cfg, 'output'), cfg.output = 'powandcsd'; end
  100. if ~isfield(cfg, 'pad'), cfg.pad = 'maxperlen'; end
  101. if ~isfield(cfg, 'taper'), cfg.taper = 'dpss'; end
  102. if ~isfield(cfg, 'channel'), cfg.channel = 'all'; end
  103. if strcmp(cfg.output, 'fourier'),
  104. cfg.keeptrials = 'yes';
  105. cfg.keeptapers = 'yes';
  106. end
  107. % setting a flag (csdflg) that determines whether this routine outputs
  108. % only power-spectra or power-spectra and cross-spectra?
  109. if strcmp(cfg.output,'pow')
  110. powflg = 1;
  111. csdflg = 0;
  112. fftflg = 0;
  113. elseif strcmp(cfg.output,'powandcsd')
  114. powflg = 1;
  115. csdflg = 1;
  116. fftflg = 0;
  117. elseif strcmp(cfg.output,'fourier')
  118. powflg = 0;
  119. csdflg = 0;
  120. fftflg = 1;
  121. else
  122. error('Unrecognized output required');
  123. end
  124. if ~isfield(cfg, 'channelcmb') && csdflg
  125. %set the default for the channelcombination
  126. cfg.channelcmb = {'all' 'all'};
  127. elseif isfield(cfg, 'channelcmb') && ~csdflg
  128. % no cross-spectrum needs to be computed, hence remove the combinations from cfg
  129. cfg = rmfield(cfg, 'channelcmb');
  130. end
  131. %data.label = zeros(length( LAN.chanlocs ),1);
  132. % ensure that channelselection and selection of channelcombinations is
  133. % perfomed consistently
  134. %cfg.channel = channelselection_lan(cfg.channel, data.label);
  135. if strcmp(cfg.channel,'all')
  136. for l = 1:length(data.label)
  137. a(l) = data.label(l) ;
  138. end
  139. cfg.channel = a;
  140. end
  141. if isfield(cfg, 'channelcmb')
  142. warning('Falta arreglar compatibilidad LAN-Fieltrid para esta funcion');
  143. cfg.channelcmb = channelcombination_lan(cfg.channelcmb, data.label);
  144. end
  145. % determine the corresponding indices of all channels
  146. %
  147. %
  148. sgnindx = match_str_lan(data.label, cfg.channel);
  149. numsgn = size(sgnindx,1);
  150. if csdflg
  151. % determine the corresponding indices of all channel combinations
  152. sgncmbindx = zeros(size(cfg.channelcmb));
  153. for k=1:size(cfg.channelcmb,1)
  154. sgncmbindx(k,1) = strmatch(cfg.channelcmb(k,1), data.label, 'exact');
  155. sgncmbindx(k,2) = strmatch(cfg.channelcmb(k,2), data.label, 'exact');
  156. end
  157. numsgncmb = size(sgncmbindx,1);
  158. sgnindx = unique([sgnindx(:); sgncmbindx(:)]);
  159. numsgn = length(sgnindx);
  160. cutdatindcmb = zeros(size(sgncmbindx));
  161. for sgnlop = 1:numsgn
  162. cutdatindcmb(find(sgncmbindx == sgnindx(sgnlop))) = sgnlop;
  163. end
  164. end
  165. % if rectan is 1 it means that trials are of equal lengths
  166. numper = numel(data.trial);
  167. %numper = numel(LAN.data);
  168. %
  169. numdatbnsarr = zeros(numper, 1);
  170. for perlop = 1:numper
  171. numdatbnsarr(perlop) = size(data.trial{perlop},2);
  172. end
  173. rectan = all(numdatbnsarr==numdatbnsarr(1));
  174. % if cfg.pad is 'maxperlen', this is realized here:
  175. % first establish where the first possible sample is
  176. min_smp = min(data.offset);
  177. % then establish where the last possible sample is
  178. max_smp = max(numdatbnsarr(:)+data.offset(:));
  179. if isequal(cfg.pad, 'maxperlen')
  180. % pad the data from the first possible to last possible sample
  181. cfg.pad = (max_smp-min_smp) ./ data.fsample;
  182. else
  183. % check that the specified padding is not too short
  184. if cfg.pad<((max_smp-min_smp)/data.fsample)
  185. error('the padding that you specified is shorter than the longest trial in the data');
  186. end
  187. end
  188. clear min_smp max_smp
  189. numsmp = round(cfg.pad .* data.fsample);
  190. % keeping trials and/or tapers?
  191. if strcmp(cfg.keeptrials,'no') && strcmp(cfg.keeptapers,'no')
  192. keep = 1;
  193. elseif strcmp(cfg.keeptrials,'yes') && strcmp(cfg.keeptapers,'no')
  194. keep = 2;
  195. elseif strcmp(cfg.keeptrials,'no') && strcmp(cfg.keeptapers,'yes')
  196. error('There is currently no support for keeping tapers WITHOUT KEEPING TRIALS.');
  197. elseif strcmp(cfg.keeptrials,'yes') && strcmp(cfg.keeptapers,'yes')
  198. keep = 4;
  199. end
  200. if strcmp(cfg.keeptrials,'yes') && strcmp(cfg.keeptapers,'yes')
  201. if ~strcmp(cfg.output, 'fourier'),
  202. error('Keeping trials AND tapers is only possible with fourier as the output.');
  203. elseif strcmp(cfg.taper, 'dpss') && ~(all(cfg.tapsmofrq==cfg.tapsmofrq(1)) && all(cfg.t_ftimwin==cfg.t_ftimwin(1))),
  204. error('Currently you can only keep trials AND tapers, when using the number of tapers per frequency is equal across frequency');
  205. end
  206. end
  207. if strcmp(cfg.taper, 'alpha') && ~all(cfg.t_ftimwin==cfg.t_ftimwin(1))
  208. error('you can only use alpha tapers with an cfg.t_ftimwin that is equal for all frequencies');
  209. end
  210. %
  211. minoffset = min(data.offset);
  212. %minoffset = min(LAN.time(:,2));
  213. %
  214. %
  215. timboi = round(cfg.toi .* data.fsample - minoffset);
  216. toi = round(cfg.toi .* data.fsample) ./ data.fsample;
  217. numtoi = length(cfg.toi);
  218. numfoi = length(cfg.foi);
  219. numtap = zeros(numfoi,1);
  220. % calculating degrees of freedom
  221. calcdof = strcmp(cfg.calcdof,'yes');
  222. if calcdof
  223. dof = zeros(numper,numfoi,numtoi);
  224. end;
  225. % compute the tapers and their fft
  226. knlspctrmstr = cell(numfoi,1);
  227. for foilop = 1:numfoi
  228. acttapnumsmp = round(cfg.t_ftimwin(foilop) .* data.fsample);
  229. if strcmp(cfg.taper, 'dpss')
  230. % create a sequence of DPSS (Slepian) tapers, ensure that the input arguments are double
  231. tap = double_dpss(acttapnumsmp, acttapnumsmp .* (cfg.tapsmofrq(foilop)./data.fsample));
  232. %
  233. elseif strcmp(cfg.taper, 'sine')
  234. tap = sine_taper(acttapnumsmp, acttapnumsmp .* (cfg.tapsmofrq(foilop)./data.fsample));
  235. elseif strcmp(cfg.taper, 'alpha')
  236. tap = alpha_taper(acttapnumsmp, cfg.foi(foilop)./data.fsample);
  237. tap = tap./norm(tap);
  238. % freqanalysis_mtmconvol always throws away the last taper of the Slepian sequence, so add a dummy taper
  239. tap(:,2) = nan;
  240. else
  241. % create a single taper according to the window specification as a replacement for the DPSS (Slepian) sequence
  242. tap = window(cfg.taper, acttapnumsmp);
  243. tap = tap./norm(tap);
  244. % freqanalysis_mtmconvol always throws away the last taper of the Slepian sequence, so add a dummy taper
  245. tap(:,2) = nan;
  246. end
  247. %%
  248. numtap(foilop) = size(tap,2)-1;
  249. if (numtap(foilop) < 1)
  250. error(sprintf('%.3f Hz : datalength to short for specified smoothing\ndatalength: %.3f s, smoothing: %.3f Hz, minimum smoothing: %.3f Hz', cfg.foi(foilop), acttapnumsmp/data.fsample, cfg.tapsmofrq(foilop), data.fsample/acttapnumsmp));
  251. elseif (numtap(foilop) < 2) && strcmp(cfg.taper, 'dpss')
  252. fprintf('%.3f Hz : WARNING - using only one taper for specified smoothing\n',cfg.foi(foilop));
  253. end
  254. ins = ceil(numsmp./2) - floor(acttapnumsmp./2);
  255. prezer = zeros(ins,1);
  256. pstzer = zeros(numsmp - ((ins-1) + acttapnumsmp)-1,1);
  257. ind = (0:acttapnumsmp-1)' .* ((2.*pi./data.fsample) .* cfg.foi(foilop));
  258. knlspctrmstr{foilop} = complex(zeros(numtap(foilop),numsmp));
  259. for taplop = 1:numtap(foilop)
  260. try
  261. % construct the complex wavelet
  262. coswav = vertcat(prezer,tap(:,taplop).*cos(ind),pstzer);
  263. sinwav = vertcat(prezer,tap(:,taplop).*sin(ind),pstzer);
  264. wavelet = complex(coswav, sinwav);
  265. % store the fft of the complex wavelet
  266. knlspctrmstr{foilop}(taplop,:) = fft(wavelet,[],1)';
  267. global fb
  268. if ~isempty(fb) && fb
  269. % plot the wavelet for debugging
  270. figure
  271. plot(tap(:,taplop).*cos(ind), 'r'); hold on
  272. plot(tap(:,taplop).*sin(ind), 'g');
  273. plot(tap(:,taplop) , 'b');
  274. title(sprintf('taper %d @ %g Hz', taplop, cfg.foi(foilop)));
  275. drawnow
  276. end
  277. end
  278. end
  279. end
  280. if keep == 1
  281. if powflg, powspctrm = zeros(numsgn,numfoi,numtoi); end
  282. if csdflg, crsspctrm = complex(zeros(numsgncmb,numfoi,numtoi)); end
  283. if fftflg, fourierspctrm = complex(zeros(numsgn,numfoi,numtoi)); end
  284. cntpertoi = zeros(numfoi,numtoi);
  285. dimord = 'chan_freq_time';
  286. elseif keep == 2
  287. if powflg, powspctrm = zeros(numper,numsgn,numfoi,numtoi); end
  288. if csdflg, crsspctrm = complex(zeros(numper,numsgncmb,numfoi,numtoi)); end
  289. if fftflg, fourierspctrm = complex(zeros(numper,numsgn,numfoi,numtoi)); end
  290. dimord = 'rpt_chan_freq_time';
  291. elseif keep == 4
  292. % FIXME this works only if all frequencies have the same number of tapers
  293. if powflg, powspctrm = zeros(numper*numtap(1),numsgn,numfoi,numtoi); end
  294. if csdflg, crsspctrm = complex(zeros(numper*numtap(1),numsgncmb,numfoi,numtoi)); end
  295. if fftflg, fourierspctrm = complex(zeros(numper*numtap(1),numsgn,numfoi,numtoi)); end
  296. cnt = 0;
  297. dimord = 'rpttap_chan_freq_time';
  298. end
  299. texto = plus_text(texto,' ' );
  300. for perlop = 1:numper
  301. % LAN
  302. if isempty(data.trial{perlop})
  303. no_t = no_t + 1; % rejected trials!!
  304. continue
  305. end
  306. %fprintf('processing trial %d: %d samples\n', perlop, numdatbnsarr(perlop,1));
  307. texto = last_text(texto, ['processing trial ' num2str(perlop) ' :' num2str(numdatbnsarr(perlop,1)) ]);
  308. %display(['processing trial ' num2str(perlop) ' :' num2str(numdatbnsarr(perlop,1)) ]);
  309. clc, disp_lan(texto);
  310. if keep == 2
  311. cnt = perlop;
  312. end
  313. numdatbns = numdatbnsarr(perlop,1);
  314. % prepad = zeros(1,data.offset(perlop) - minoffset);
  315. % pstpad = zeros(1,minoffset + numsmp - (data.offset(perlop) + numdatbns));
  316. % datspctra = complex(zeros(numsgn,numsmp));
  317. % for sgnlop = 1:numsgn
  318. % datspctra(sgnlop,:) = fft([prepad, data.trial{perlop}(sgnindx(sgnlop),:), ...
  319. % pstpad],[],2);
  320. % end
  321. prepad = zeros(numsgn,data.offset(perlop) - minoffset);
  322. pstpad = zeros(numsgn,minoffset + numsmp - (data.offset(perlop) + numdatbns));
  323. tmp = data.trial{perlop}(sgnindx,:);
  324. tmp = [prepad tmp pstpad];
  325. % avoid the use of a 3rd input argument to facilitate compatibility with star-P
  326. % use explicit transpose, to avoid complex conjugate transpose
  327. datspctra = transpose(fft(transpose(tmp)));
  328. for foilop = 1:numfoi
  329. %-------------------
  330. % clc;
  331. %disp_lan(texto);
  332. if perlop==1
  333. fprintf('processing frequency %d (%.2f Hz), %d tapers\n', foilop,cfg.foi(foilop),numtap(foilop));
  334. end
  335. %--------------------
  336. actfoinumsmp = cfg.t_ftimwin(foilop) .* data.fsample;
  337. acttimboiind = find(timboi >= (-minoffset + data.offset(perlop) + (actfoinumsmp ./ 2)) & timboi < (-minoffset + data.offset(perlop) + numdatbns - (actfoinumsmp ./2)));
  338. nonacttimboiind = find(timboi < (-minoffset + data.offset(perlop) + (actfoinumsmp ./ 2)) | timboi >= (-minoffset + data.offset(perlop) + numdatbns - (actfoinumsmp ./2)));
  339. acttimboi = timboi(acttimboiind);
  340. numacttimboi = length(acttimboi);
  341. if keep ==1
  342. cntpertoi(foilop,acttimboiind) = cntpertoi(foilop,acttimboiind) + 1;
  343. end
  344. for taplop = 1:numtap(foilop)
  345. if keep == 3
  346. cnt = taplop;
  347. elseif keep == 4
  348. % this once again assumes a fixed number of tapers per frequency
  349. cnt = (perlop-1)*numtap(1) + taplop;
  350. end
  351. autspctrmacttap = complex(zeros(numsgn,numacttimboi), zeros(numsgn,numacttimboi));
  352. if numacttimboi > 0
  353. for sgnlop = 1:numsgn
  354. dum = fftshift(ifft(datspctra(sgnlop,:) .* knlspctrmstr{foilop}(taplop,:),[],2));
  355. autspctrmacttap(sgnlop,:) = dum(acttimboi);
  356. end
  357. end
  358. if powflg
  359. powdum = 2.* abs(autspctrmacttap) .^ 2 ./ actfoinumsmp;
  360. if strcmp(cfg.taper, 'sine')
  361. powdum = powdum .* (1 - (((taplop - 1) ./ numtap(foilop)) .^ 2));
  362. end
  363. if keep == 1 && numacttimboi > 0
  364. powspctrm(:,foilop,acttimboiind) = powspctrm(:,foilop,acttimboiind) + reshape(powdum ./ numtap(foilop),[numsgn,1,numacttimboi]);
  365. elseif keep == 2 && numacttimboi > 0
  366. powspctrm(cnt,:,foilop,acttimboiind) = powspctrm(cnt,:,foilop,acttimboiind) + reshape(powdum ./ numtap(foilop),[1,numsgn,1,numacttimboi]);
  367. powspctrm(cnt,:,foilop,nonacttimboiind) = nan;
  368. elseif keep == 4 && numacttimboi > 0
  369. powspctrm(cnt,:,foilop,acttimboiind) = reshape(powdum,[1,numsgn,1,numacttimboi]);
  370. powspctrm(cnt,:,foilop,nonacttimboiind) = nan;
  371. elseif (keep == 4 || keep == 2) && numacttimboi == 0
  372. powspctrm(cnt,:,foilop,nonacttimboiind) = nan;
  373. end
  374. end
  375. if fftflg
  376. fourierdum = (autspctrmacttap) .* sqrt(2 ./ actfoinumsmp); %cf Numercial Receipes 13.4.9
  377. if keep == 1 && numacttimboi > 0
  378. fourierspctrm(:,foilop,acttimboiind) = fourierspctrm(:,foilop,acttimboiind) + reshape((fourierdum ./ numtap(foilop)),[numsgn,1,numacttimboi]);
  379. elseif keep == 2 && numacttimboi > 0
  380. fourierspctrm(cnt,:,foilop,acttimboiind) = fourierspctrm(cnt,:,foilop,acttimboiind) + reshape(fourierdum ./ numtap(foilop),[1,numsgn,1,numacttimboi]);
  381. fourierspctrm(cnt,:,foilop,nonacttimboiind) = nan;
  382. elseif keep == 4 && numacttimboi > 0
  383. fourierspctrm(cnt,:,foilop,acttimboiind) = reshape(fourierdum,[1,numsgn,1,numacttimboi]);
  384. fourierspctrm(cnt,:,foilop,nonacttimboiind) = nan;
  385. elseif (keep == 4 || keep == 2) && numacttimboi == 0
  386. fourierspctrm(cnt,:,foilop,nonacttimboiind) = nan;
  387. end
  388. end
  389. if csdflg
  390. csddum = 2.* (autspctrmacttap(cutdatindcmb(:,1),:) .* conj(autspctrmacttap(cutdatindcmb(:,2),:))) ./ actfoinumsmp;
  391. if keep == 1 && numacttimboi > 0
  392. crsspctrm(:,foilop,acttimboiind) = crsspctrm(:,foilop,acttimboiind) + reshape((csddum ./ numtap(foilop)),[numsgncmb,1,numacttimboi]);
  393. elseif keep == 2 && numacttimboi > 0
  394. crsspctrm(cnt,:,foilop,acttimboiind) = crsspctrm(cnt,:,foilop,acttimboiind) + reshape(csddum ./ numtap(foilop),[1,numsgncmb,1,numacttimboi]);
  395. crsspctrm(cnt,:,foilop,nonacttimboiind) = nan;
  396. elseif keep == 4 && numacttimboi > 0
  397. crsspctrm(cnt,:,foilop,acttimboiind) = reshape(csddum,[1,numsgncmb,1,numacttimboi]);
  398. crsspctrm(cnt,:,foilop,nonacttimboiind) = nan;
  399. elseif (keep == 4 || keep == 2) && numacttimboi == 0
  400. crsspctrm(cnt,:,foilop,nonacttimboiind) = nan;
  401. end
  402. end
  403. end % for taplop
  404. if calcdof
  405. dof(perlop,foilop,acttimboiind) = numtap(foilop);
  406. end
  407. end % for foilop
  408. end % for perlop
  409. if keep == 1
  410. warning off
  411. if powflg
  412. powspctrm(:,:,:) = powspctrm(:,:,:) ./ repmat(permute(cntpertoi,[3,1,2]),[numsgn,1,1]);
  413. end
  414. if fftflg
  415. fourierspctrm(:,:,:) = fourierspctrm(:,:,:) ./ repmat(permute(cntpertoi,[3,1,2]),[numsgn,1,1]);
  416. end
  417. if csdflg
  418. crsspctrm(:,:,:) = crsspctrm(:,:,:) ./ repmat(permute(cntpertoi,[3,1,2]),[numsgncmb,1,1]);
  419. end
  420. warning on
  421. end
  422. % collect the results
  423. freq.label = data.label(sgnindx);
  424. freq.dimord = dimord;
  425. freq.freq = cfg.foi;
  426. freq.time = toi;
  427. if powflg
  428. if keep ==2
  429. for tt = 1:size(powspctrm,1)
  430. if LAN.accept(tt) %LAN
  431. freq.powspctrm{tt} = single(permute(powspctrm(tt,:,:,:),[3,2,4,1]));
  432. else %LAN
  433. freq.powspctrm{tt} = [ ];
  434. end
  435. end
  436. % save in file
  437. % LAN !!!
  438. if strcmp(cfg.ktt,'file')
  439. paso = what ;
  440. filename = [LAN.name '_' LAN.cond '_' LAN.group '_' datestr(now,'HHMMSS_dd_mm_yy') '.ldt'];
  441. filename = strrep(filename, ' ' , '_');
  442. t_powspctrm = freq.powspctrm;
  443. m_powspctrm = mean(cat(4,freq.powspctrm{:}),4);
  444. save(filename,'t_powspctrm','m_powspctrm');
  445. clear t_powspctrm m_powspctrm
  446. freq.powspctrm = [];
  447. freq.powspctrm.filename = filename;
  448. freq.powspctrm.path = paso.path;
  449. freq.powspctrm.trials = 't_powspctrm';
  450. freq.powspctrm.mean = 'm_powspctrm';
  451. clear paso
  452. end
  453. else
  454. freq.powspctrm = permute(powspctrm,[2,1,3]);
  455. end
  456. %
  457. end
  458. if csdflg
  459. freq.labelcmb = cfg.channelcmb;
  460. freq.crsspctrm = crsspctrm;
  461. end
  462. if fftflg
  463. freq.fourierspctrm = fourierspctrm;
  464. end
  465. if calcdof
  466. freq.dof=2*dof;
  467. end;
  468. if keep == 2,
  469. freq.cumtapcnt = repmat(numtap(:)', [size(powspctrm,1) 1]);
  470. elseif keep == 4,
  471. %all(numtap(1)==numtap)
  472. freq.cumtapcnt = repmat(numtap(1), [size(fourierspctrm,1)./numtap(1) 1]);
  473. end
  474. try, freq.grad = data.grad; end % remember the gradiometer array
  475. try, freq.elec = data.elec; end % remember the electrode array
  476. % get the output cfg
  477. %cfg = checkconfig(cfg, 'trackconfig', 'off', 'checksize', 'yes');
  478. % add information about the version of this function to the configuration
  479. try
  480. % get the full name of the function
  481. cfg.version.name = mfilename('fullpath');
  482. catch
  483. % required for compatibility with Matlab versions prior to release 13 (6.5)
  484. [st, i1] = dbstack;
  485. cfg.version.name = st(i1);
  486. end
  487. cfg.version.id = '$Id: freqanalysis_mtmconvol.m,v 1.44 2009/03/11 10:39:37 roboos Exp $';
  488. % remember the configuration details of the input data
  489. try cfg.previous = data.cfg; end
  490. % remember the exact configuration details in the output
  491. freq.cfg = cfg;
  492. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  493. % SUBFUNCTION ensure that the first two input arguments are of double
  494. % precision this prevents an instability (bug) in the computation of the
  495. % tapers for Matlab 6.5 and 7.0
  496. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  497. function [tap] = double_dpss(a, b, varargin);
  498. tap = dpss(double(a), double(b), varargin{:});

freq_mtmconvol_lan.m at commit afb0611, no license · at the source

Overview

Authors: Joaquín Herrero1,2,3, Rodrigo Henríquez-Ch1,4,2,5,6, Alejandra Figueroa-Vargas7, Reinaldo Uribe-San Martin1,4,5, Christian Cantillano1,8,5, Pablo Fuentealba1,9,5,10, Patricio Mellado1,4,5, Jaime Godoy1,4,5, Pablo Billeke7, Francisco Aboitiz1,9,2,5,6
  1. Centro Interdisciplinario de Neurociencia, Facultad de Medicina, Pontificia Universidad Católica de Chile,Santiago, Chile
  2. Laboratorio LaNCE, Facultad de Medicina, Pontificia Universidad Católica de Chile,Santiago, Chile
  3. Escuela de Kinesiología, Facultad de Medicina y Salud, Universidad Finis Terrae,Santiago, Chile
  4. Departamento de Neurología, Facultad de Medicina, Pontificia Universidad Católica de Chile,Santiago, Chile
  5. Escuela de Medicina, Pontificia Universidad Católica de Chile,Santiago, Chile
  6. Centro ANID de Interés Nacional para Investigación e Innovación en Niñez, Adolescencia, Resiliencia y Adversidad, CIN 250068, IINARA,Santiago, Chile
  7. Centro de Investigación en Complejidad Social, Facultad de Gobierno, Universidad del Desarrollo,Santiago, Chile
  8. Departamento de Neurocirugía, Facultad de Medicina, Pontificia Universidad Católica de Chile,Santiago, Chile
  9. Departamento de Psiquiatría, Facultad de Medicina, Pontificia Universidad Católica de Chile,Santiago, Chile
  10. Laboratorio de Neuro Circuitos, Facultad de Medicina, Pontificia Universidad Católica de Chile,Santiago, Chile
Journal: Scientific reports, volume 16, issue 1, article 18885
Dates: received 3 July 2025; accepted 17 April 2026; published online 24 April 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41598-026-49900-6 · PMID 42031873 · PMCID PMC13276037 · OpenAlex W7155519086
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: intracranial EEG (iEEG / ECoG / SEEG) (modality), human (organism), cognitive (subfield)
Methods: Preprocessing, Statistics, Spectral & time-frequency, Connectivity, fMRI & imaging, Single-unit activity, calcium imaging
Keywords: Neuroscience, Psychology
MeSH: Attention*, Brain*, Adult, Electrocorticography, Female, Humans, Magnetic Resonance Imaging, Male, Theta Rhythm, Young Adult (* major topic)
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Beca Doctorado Nacional ANID (21191510); Fondo Nacional de Desarrollo Científico y Tecnológico (1251906, 1251073)
Citations: not cited yet (Europe PMC); 92 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 4 matches between paragraphs and lines of code.

neurocics/LAN_current

License: none: the authors keep all their rights
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: afb0611ca27ae004a976f898c29d6dfca12ece4e, 15 June 2026
Languages: MATLAB (783), R (19), C/C++ (4), Shell (4), C (1)
Size: 1,007 files, 811 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, environment (rt/R/littler/examples/install.r), tests, documentation
Not found: license file, CITATION.cff, continuous integration
Tools: FieldTrip (231 files), Statistics and Machine Learning Toolbox (29 files), EEGLAB (22 files), Signal Processing Toolbox (20 files), Image Processing Toolbox (16 files), Tools for NIfTI and ANALYZE image (MATLAB) (14 files), SPM (6 files), Brainstorm (5 files), FreeSurfer (5 files), GIfTI library for MATLAB (3 files), Chronux (2 files), CircStat (1 file), ERPLAB (1 file), lme4 (1 file), Wavelet Toolbox (1 file), nlme (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
812 files

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41598-026-49900-6.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 811 scripts, each with its path and the digest of its content;
  • 4 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Code and data availability statement

The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41598-026-49900-6.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 30 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 10 authors, 2 keywords, 10 MeSH terms, 2 funders, 92 references.

Cite

This paper

Herrero, J., Henríquez-Ch, R., Figueroa-Vargas, A., Uribe-San Martin, R., Cantillano, C., Fuentealba, P., Mellado, P., Godoy, J., Billeke, P., & Aboitiz, F. (2026). Global neural oscillations underlie performance variability and attentional state fluctuations in humans. Scientific reports, 16(1), 18885. https://doi.org/10.1038/s41598-026-49900-6

BibTeX

@article{herrero2026global,
author = {Herrero, Joaquín and Henríquez-Ch, Rodrigo and Figueroa-Vargas, Alejandra and Uribe-San Martin, Reinaldo and Cantillano, Christian and Fuentealba, Pablo and Mellado, Patricio and Godoy, Jaime and Billeke, Pablo and Aboitiz, Francisco},
title = {{Global neural oscillations underlie performance variability and attentional state fluctuations in humans}},
journal = {Scientific reports},
year = {2026},
month = apr,
volume = {16},
number = {1},
pages = {18885},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/s41598-026-49900-6},
url = {https://doi.org/10.1038/s41598-026-49900-6},
pmid = {42031873},
pmcid = {PMC13276037}
}

RIS

TY - JOUR
AU - Herrero, Joaquín
AU - Henríquez-Ch, Rodrigo
AU - Figueroa-Vargas, Alejandra
AU - Uribe-San Martin, Reinaldo
AU - Cantillano, Christian
AU - Fuentealba, Pablo
AU - Mellado, Patricio
AU - Godoy, Jaime
AU - Billeke, Pablo
AU - Aboitiz, Francisco
TI - Global neural oscillations underlie performance variability and attentional state fluctuations in humans
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/04/24
VL - 16
IS - 1
SP - 18885
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/s41598-026-49900-6
UR - https://doi.org/10.1038/s41598-026-49900-6
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41598-026-49900-6",
"type": "article-journal",
"title": "Global neural oscillations underlie performance variability and attentional state fluctuations in humans",
"container-title": "Scientific reports",
"author": [
{
"family": "Herrero",
"given": "Joaquín"
},
{
"family": "Henríquez-Ch",
"given": "Rodrigo"
},
{
"family": "Figueroa-Vargas",
"given": "Alejandra"
},
{
"family": "Uribe-San Martin",
"given": "Reinaldo"
},
{
"family": "Cantillano",
"given": "Christian"
},
{
"family": "Fuentealba",
"given": "Pablo"
},
{
"family": "Mellado",
"given": "Patricio"
},
{
"family": "Godoy",
"given": "Jaime"
},
{
"family": "Billeke",
"given": "Pablo"
},
{
"family": "Aboitiz",
"given": "Francisco"
}
],
"container-title-short": "Sci Rep",
"volume": "16",
"issue": "1",
"page": "18885",
"DOI": "10.1038/s41598-026-49900-6",
"PMID": "42031873",
"PMCID": "PMC13276037",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41598-026-49900-6",
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
24
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41467-024-54244-8 [code]
Lateral prefrontal theta oscillations causally drive a computational mechanism underlying conflict expectation and adaptation.
Journal: Nature communications
In common: ERPLAB, Brainstorm, Chronux, 13 other tools, 13 references, author Alejandra Figueroa-Vargas
[2] doi:10.1016/j.dib.2026.112535 [code]
A comprehensive multimodal MRI and EEG-TMS dataset on the impact of parietal cortex inhibition on decision-making under ambiguity.
Journal: Data in brief
In common: ERPLAB, Brainstorm, Chronux, 13 other tools, 6 references, author Alejandra Figueroa-Vargas
[3] doi:10.1038/s41598-025-33030-6 [code]
Coupling between neural oscillations and white matter integrity reveals cognitive computational profiles following COVID-19.
Journal: Scientific reports
In common: nlme, lme4, Statistics and Machine Learning Toolbox, 14 references, 2 authors
[4] doi:10.1038/s41598-025-01465-6 [code]
White matter volume and microstructural integrity are associated with fatigue in relapsing multiple sclerosis.
Journal: Scientific reports
In common: 11 references, 2 authors
[5] doi:10.1038/s41598-024-69772-y [code]
Patients recovering from COVID-19 who presented with anosmia during their acute episode have behavioral, functional, and structural brain alterations.
Journal: Scientific reports
In common: nlme, lme4, Statistics and Machine Learning Toolbox, cognitive, 5 references, 2 authors
[6] doi:10.1162/netn_a_00387 [code]
Individual variability in neural representations of mind-wandering.
Journal: Network neuroscience (Cambridge, Mass.)
In common: GIfTI library for MATLAB, Tools for NIfTI and ANALYZE image (MATLAB), FieldTrip, 4 other tools, 9 references
[7] doi:10.1038/s41467-024-52814-4 [code]
Striato-pallidal oscillatory connectivity correlates with symptom severity in dystonia patients.
Journal: Nature communications
In common: Brainstorm, Wavelet Toolbox, CircStat, 9 other tools
[8] doi:10.1038/s41538-024-00308-4 [code]
A randomised crossover trial of nitrate and breakfast on prefrontal cognitive and haemodynamic response functions.
Journal: NPJ science of food
In common: Brainstorm, Wavelet Toolbox, CircStat, 9 other tools
[9] doi:10.1186/s12889-024-19306-y [code]
Short, frequent physical activity breaks improve working memory while preserving cerebral blood flow in adolescents during prolonged sitting - AbbaH teen, a randomized crossover trial.
Journal: BMC public health
In common: Brainstorm, Wavelet Toolbox, CircStat, 9 other tools
[10] doi:10.1371/journal.pone.0285581 [code]
Acute effects of nitrate and breakfast on working memory, cerebral blood flow, arterial stiffness, and psychological factors in adolescents: Study protocol for a randomised crossover trial.
Journal: PloS one
In common: Brainstorm, Wavelet Toolbox, CircStat, 9 other tools

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1038/s41598-026-49900-6.svg)](https://openscicode.org/badge/doi/10.1038/s41598-026-49900-6)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41598-026-49900-6.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41598-026-49900-6
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41598-026-49900-6"><img src="https://openscicode.org/badge/doi/10.1038/s41598-026-49900-6.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.