# compute PSD of a frequency of interest

**URL:** <https://mne.discourse.group/t/compute-psd-of-a-frequency-of-interest/5497>\
**Category:** Support & Discussions\
**Created:** [August 30, 2022, 10:52am UTC](https://mne.discourse.group/t/compute-psd-of-a-frequency-of-interest/5497 "2022-08-30T10:52:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oconnell\_E](https://avatars.discourse-cdn.com/v4/letter/o/9e8a1a/32.png) [@oconnell\_E](https://mne.discourse.group/u/oconnell_E)\
**Post date:** [August 30, 2022, 10:52am UTC](https://mne.discourse.group/t/compute-psd-of-a-frequency-of-interest/5497/1 "2022-08-30T10:52:39Z")

</div>

Hi everyone,

- MNE version: 1.0.3
- operating system: macOS 11.1

I would like to know whether it is possible to compute the power spectral density of one specific frequency of interest, not in a range.

According to the manual ([mne.time\_frequency.psd\_multitaper — MNE 1.2.dev0 documentation](https://mne.tools/dev/generated/mne.time_frequency.psd_multitaper.html)), we should input the lower- and upper-bound on frequencies of interest as one parameter, but for example, let’s say when I want to compute the PSD of exactly 5Hz, is there any way to do that?  
Thank you!

---

<div class="post-metadata">

**Author:** ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)\
**Post date:** [August 31, 2022, 7:12pm UTC](https://mne.discourse.group/t/compute-psd-of-a-frequency-of-interest/5497/2 "2022-08-31T19:12:12Z")

</div>

There is _sort of_ a way to do that: set it up so that one of your frequency bins lands at exactly 5 Hz, ignore all the other bins, and accept the fact that each bin will _always_ have some non-zero bandwidth.

In general the number of frequency bins is determined by the window length: `n_bins = n//2 + 1` where `n` is the window length (in samples). The values of the frequency bin centers are determined by that and by the sample spacing (inverse of sampling frequency). So for example, say your sampling frequency is 500 Hz. The highest estimable frequency (Nyquist) is 250 Hz. Say you want bin spacing of 1 Hz (then your 5 Hz component would represent power between 4.5 and 5.5 Hz), so 251 bins, so your window length `n` should be 500. If you want finer resolution (smaller bandwidth for each bin) then the window length needs to be proportionally longer.

_nitpick:_ if you’re looking at a single frequency, then it’s not _density_ anymore, it’s just _power_. But as mentioned above, with sampled (not time-continuous) signals there will always be an implicit bandwidth to the individual frequency power estimates, so in practice it is still “density” (even when we might wish it weren’t).
