AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
May 31, 2022 05:41PM
Hi, Philipp-

To do bandpassing within a ceratin range of Hz, indeed you need to convert the "digital" frequencies to those of physical units (Hz), and indeed this depends on the sampling rate, TR, and number of time points, N. Let's stick with even N for the moment.

The upper frequency (Nyquist) is determined just by TR:
Fmax = Fnyquist = 1/(2*TR).
The spacing of the frequency spectrum samples depends on this and the number of time points:
df = Fnyquist/(N/2) = 1/(N*TR).
Sometimes, if people want different frequency sampling, they zeropad (or "meanpad") their time series, but that doesn't add information, just might interpolate the frequency spectrum; also, from Fnyquist's definition, doing that padding doesn't change the max frequency one can model.

So, each frequency in your (half)spectrum is k*df, for k=0...N/2; k=0 is the special case of the "baseline" or mean value. The maximum frequency would occur at k=kmax=N/2, and note that:
kmax*df = (N/2)*1/(N*TR) = 1/(2*TR) = Fnyquist,
which is consistent with the earlier information. NB: these are talking about the *frequencies* themselves (the "x-axis" in frequency space), not the power values associated with each.

So, in your case of wanting a bandpass interval [A, B] ~ [0.01, 0.25], you want to find:
+ the maximum integer A such that A*df <= 0.01,
+ the minimum integer B such that B*df >= 0.25.
So, I think you want:
+ A = floor(0.01*df) = floor(0.01/N*TR)
+ B = ceil(0.25*df) = ceil(0.25/N*TR)
And yes, you can then use index selectors with the A and B values to select out data you want.

You mention having "5xx sampling points"---does that mean you upsampled by a factor of 5? I don't know what "5xx" means. Again, upsampling won't add information nor energy to the signal (assuming you are meanpadding, and not including the k=0 frequency in your power evaluations.

Note that the resting state signal in general will not be a "flat" spectrum---the named noise distributions in signal processing are, like "white noise" (which has slope=0), purple noise, pink noise, brown noise, ... etc; see:
https://en.wikipedia.org/wiki/Colors_of_noise
It will be big in the lower side of frequencies---in the typical ALFF range---end then mostly drop off at higher frequencies. I am not sure that a line will ever be a good fit, in either the power-frequency space, or log(power)-log(frequency) space. I think the plots you are showing have the shape I would roughly expect.

As to the differences between the two---well, I am not sure. Up above, we discussed that for no tapering, linear detrending for each, etc., they 3dPeriodogram and scipy.signal.periodogram() yielded the exact same results. Doing the same range of bandpassing on each shouldn't change that. I guess I would check that your interpolation is being done in the same way, if it must be done (and must it? I don't see why).

--pt
Subject Author Posted

3dPeriodogram and 1dFFT - How exactly is the power computed? Attachments

Philipp May 27, 2022 10:36AM

Re: 3dPeriodogram and 1dFFT - How exactly is the power computed?

ptaylor May 27, 2022 03:28PM

Re: 3dPeriodogram and 1dFFT - How exactly is the power computed?

Philipp May 27, 2022 03:58PM

Re: 3dPeriodogram and 1dFFT - How exactly is the power computed?

ptaylor May 27, 2022 08:52PM

Re: 3dPeriodogram and 1dFFT - How exactly is the power computed?

Philipp May 28, 2022 03:36AM

Re: 3dPeriodogram and 1dFFT - How exactly is the power computed?

ptaylor May 28, 2022 07:11AM

Re: 3dPeriodogram and 1dFFT - How exactly is the power computed? Attachments

Philipp May 28, 2022 11:03AM

Re: 3dPeriodogram and 1dFFT - How exactly is the power computed?

ptaylor May 31, 2022 05:41PM

Re: 3dPeriodogram and 1dFFT - How exactly is the power computed?

Philipp June 01, 2022 12:24AM