Usage: 3dPeriodogram [options] dataset Computes the periodogram of each voxel time series. (Squared FFT = a crude estimate of the power spectrum)
- -prefix p = use string ‘p’ for the prefix of the
- output dataset [DEFAULT = ‘pgram’]
-taper = fraction of data to taper [DEFAULT = 0.1]
- -nfft L = set FFT length to ‘L’ points
- (longer than the data ==> zero padding) (shorter than the data ==> data pruning)
half the FFT length; sub-brick #0 = FFT bin #1, etc.
be 1/(nfft*TR) where nfft=FFT length, TR=dataset timestep.
‘3dcalc( -a dset+orig -b mask+orig -expr a*b )’
to apply a binary mask on the command line.
Data is not scaled exactly as in the AFNI Power plugin.
Each time series is linearly detrended prior to FFT-ization.
FFT length defaults to be the next legal length >= input dataset.
into a product of powers of 2, 3, and 5, and are even.
++ The largest power of 3 that is allowed is 3^3 = 27. ++ The largest power of 5 that is allowed is 5^3 = 125. ++ e.g., FFT of length 3*5*8=120 is possible. ++ e.g., FFT of length 4*31 =124 is not possible. ++ ‘-nfft’ with an illegal value will cause the program to fail.
(to reduce random fluctuations), you can use 3dPeriodogram in a script with “[...]” sub-brick selectors, then average the results with 3dMean.
in the frequency direction (e.g., with 3dTsmooth).
This is a really quick hack for DH and PB and SfN.
(i.e., the length of the input dataset)
= number of points to taper on each end
ktop = npts - ntaper phi = PI / ntaper
w(k) = 0.54 - 0.46 * cos(k*phi) 0 <= k < ntaper w(k) = 0.54 + 0.46 * cos((k-ktop+1)*phi) ktop <= k < npts w(k) = 1.0 otherwise
Also define P = sum{ w(k)*w(k) } from k=0..npts-1 (if ntaper = 0, then P = npts).
The result is the squared magnitude of the FFT of w(k)*data(k), divided by P. This division makes the result be the ‘power’, which is to say the data’s sum-of-squares (‘energy’) per unit time (in units of 1/TR, not 1/sec) ascribed to each FFT bin.
Normalizing by P also means that the values output for different amounts of tapering or different lengths of data are comparable.
To be as clear as I can: this program does NOT do any averaging across multiple windows of the data (such as Welch’s method does) to estimate the power spectrum. This program: ++ tapers the data, ++ zero-pads it to the FFT length, ++ FFTs it (in time), ++ squares it and divides by the P factor.
#1 = FFT bin #2 = frequency 2/(nfft*dt)
et cetera, et cetera, et cetera.
If you desire to implement Welch’s method for spectrum estimation using 3dPeriodogram, you will have to run the program multiple times, using different subsets of the input data, then average the results with 3dMean. ++ http://en.wikipedia.org/wiki/Welch’s_method
++ Compile date = Dec 16 2015