# PSD and calculate RMS of PSD over EEG signal

**URL:** <https://mne.discourse.group/t/psd-and-calculate-rms-of-psd-over-eeg-signal/7076>\
**Category:** Support & Discussions\
**Tags:** eeg, feature-request\
**Created:** [June 13, 2023, 4:49pm UTC](https://mne.discourse.group/t/psd-and-calculate-rms-of-psd-over-eeg-signal/7076 "2023-06-13T16:49:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SoroushZrZ](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/soroushzrz/32/3429_2.png) [@SoroushZrZ](https://mne.discourse.group/u/SoroushZrZ)\
**Post date:** [June 13, 2023, 4:49pm UTC](https://mne.discourse.group/t/psd-and-calculate-rms-of-psd-over-eeg-signal/7076/1 "2023-06-13T16:49:14Z")

</div>

Hi everyone,  
I want to calculate the average of PSD in a determined epoch, here is the code:

```python
spectrum = epochs[62].compute_psd(method="welch",picks='C3_M2',fmin=12,fmax=30)
PSD, freqs = spectrum.get_data(return_freqs=True)
spectrum.plot()

```

The result would be like following:

 ![Capture](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/9/936ebff9b31e15c85b8a1fb8ccf2033ae64b1e17.png)  
As I want to take the average first I need to retrieve the Amplitude which is in (dB), like the first point which is about 123, but after I convert the PSD to dB, I have a weird data:

```python
10 * np.log10(PSD)

```

which I got

```python
array([[[ 3.13982779, -3.86176929, 6.85332206, 4.17123814,
          4.93127581, 7.4832183 , 1.12038761, 7.68291897,
          6.40367422, 6.24721421, 6.57093037, 6.4076177 ,
          5.45691297, -1.51206827, 6.76020133, 6.69414559,
          9.51026022, 9.10557663, 5.63438618, 3.24274636,
         -5.68817689, 2.77028109, 7.11039496, 8.68978814,
          9.45466904, 5.62792485, 4.2303355 , 4.14692724,
          3.25922632, 4.33403963, 5.39546468, 0.92007031,
          3.73590139, 5.64315007, 4.32840387, 4.41999972,
          0.74850308, 1.92540129, 5.95650245, 4.2219239 ,
          4.86983096, 7.17304789, 6.39538512, 5.62660172,
          3.48318393, 0.52069617]]])

```

But the element doesn’t match the figure which would be data around 116 and 128. What formulate should I use to get the y-axis values?  
Also could you please help me with how can I calculate the subsurface of the PSD plot, somewhere I read I should calculate the RMS of PSD? Is this correct, and how can I calculate that?

Thanks in advance
