Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

mtfftpb.m 1.4 KB

123456789101112131415161718192021222324252627282930
  1. function [J,Msp,Nsp]=mtfftpb(data,tapers,nfft)
  2. % Multi-taper fourier transform - binned point process data
  3. %
  4. % Usage:
  5. %
  6. % [J,Msp,Nsp]=mtfftpb(data,tapers,nfft) - all arguments required
  7. % Input:
  8. % data (in form samples x channels/trials or single vector)
  9. % tapers (precalculated tapers from dpss)
  10. % nfft (length of padded data)
  11. % Output:
  12. % J (fft in form frequency index x taper index x channels/trials)
  13. % Msp (number of spikes per sample in each channel)
  14. % Nsp (number of spikes in each channel)
  15. if nargin < 3; error('Need all input arguments'); end;
  16. data=change_row_to_column(data); % changes data stored as a row vector to a column vector
  17. [N,C]=size(data); % size of data
  18. K=size(tapers,2); % size of tapers
  19. tapers=tapers(:,:,ones(1,C)); % add channel indices to tapers
  20. H=fft(tapers,nfft,1); % fourier transform of the tapers
  21. Nsp=sum(data,1); % number of spikes in each channel
  22. Msp=Nsp'./N; % mean rate for each channel
  23. meansp=Msp(:,ones(1,K),ones(1,size(H,1))); % add taper and frequency indices to meansp
  24. meansp=permute(meansp,[3,2,1]); % permute to get meansp with the same dimensions as H
  25. data=data(:,:,ones(1,K));% add taper indices to the data
  26. data=permute(data,[1 3 2]); % permute data to be of the same dimensions as H
  27. data_proj=data.*tapers; % multiply data by the tapers
  28. J=fft(data_proj,nfft,1); % fft of projected data
  29. J=J-H.*meansp; % subtract the dc