# Subtraction of PSD Topomaps

**URL:** <https://mne.discourse.group/t/subtraction-of-psd-topomaps/3535>\
**Category:** Support & Discussions\
**Tags:** time-frequency, eeg, visualization, epochs\
**Created:** [August 12, 2021, 8:02am UTC](https://mne.discourse.group/t/subtraction-of-psd-topomaps/3535 "2021-08-12T08:02:03Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![mmagnuski](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mmagnuski/32/153_2.png) [@mmagnuski](https://mne.discourse.group/u/mmagnuski)\
**Post date:** [August 12, 2021, 8:41am UTC](https://mne.discourse.group/t/subtraction-of-psd-topomaps/3535/5 "2021-08-12T08:41:15Z")

</div>

Oh, sorry, I didn’t see your reply, yes it is **almost** the same solution as mine below.  
Be sure to specify a range (i use it with `slice`) instead of just the two indices.

Sure, instead of one frequency index you could use a range, for example:

```python
freq_limits = [8, 12]
freq_idx = [np.argmin(np.abs(freq - frequency)) for frequency in freq_limits]
freq_range = slice(freq_idx[0], freq_idx[1] + 1)

# average the frequency range:
psd_avg = psd[:, freq_range].mean(axis=1)

# plot
mne.viz.plot_topomap(psd_avg, epochs.info)

```

(BTW - for gamma you may prefer to use multitapering with some frequency smoothing instead of welch)

---

_[View the full topic](https://mne.discourse.group/t/subtraction-of-psd-topomaps/3535)._
