# Power Spectral Densities - Averaging over epochs and Parameter Considerations

**URL:** <https://mne.discourse.group/t/power-spectral-densities-averaging-over-epochs-and-parameter-considerations/7694>\
**Category:** Support & Discussions\
**Tags:** eeg, epochs\
**Created:** [October 18, 2023, 2:21pm UTC](https://mne.discourse.group/t/power-spectral-densities-averaging-over-epochs-and-parameter-considerations/7694 "2023-10-18T14:21:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![annina](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/annina/32/2901_2.png) [@annina](https://mne.discourse.group/u/annina)\
**Post date:** [October 18, 2023, 2:21pm UTC](https://mne.discourse.group/t/power-spectral-densities-averaging-over-epochs-and-parameter-considerations/7694/1 "2023-10-18T14:21:07Z")

</div>

Hi !  
I have multiple PSG recordings from all different patients and I want to compute the PSD per subject but also averaged over all the subjects.  
I’m able to extract the psd per subject with

```python
spectrum = epochs.compute_psd(method = 'welch',fmin=2.0, fmax=40.0, n_fft = int(2*epochs.info['sfreq']), n_overlap= int(epochs.info['sfreq']/2))`
psds, freqs = spectrum.get_data(return_freqs=True)

```

and then I would concatenate the psds of the subjects together and then take the mean of that concatenated np array such that I get an average psd for all my subjects.  
But what I still don’t understand is the following:

1. What is the unit of the Power Spectral Density? Moreover, I’ve seen that sometimes the logarithmic scale has been applied to the resulting psds - is there a standard way to handle and visualize the power spectrum?
2. When computing the PSD plot, e.g. for just one subject, I would do the following:  
`spectrum.plot( average=True)` which averages over the channels, but what about the epochs? Do I have to average over the epochs as well?
3. Do the chosen parameter values for `n_fft` and `n_overlap` seem reasonable to you?

Cheers,  
Annina

- MNE version: 1.5.1
- operating system: Windows 11
