Calculate the mean CSD in the given frequency range(s). Parameters ---------- fmin : float | list of float | None Lower bound of the frequency range in Hertz. Defaults to the lowest frequency available. When a list of frequencies is given, these are
(self, fmin=None, fmax=None)
| 273 | return csd_out |
| 274 | |
| 275 | def mean(self, fmin=None, fmax=None): |
| 276 | """Calculate the mean CSD in the given frequency range(s). |
| 277 | |
| 278 | Parameters |
| 279 | ---------- |
| 280 | fmin : float | list of float | None |
| 281 | Lower bound of the frequency range in Hertz. Defaults to the lowest |
| 282 | frequency available. When a list of frequencies is given, these are |
| 283 | used as the lower bounds (inclusive) of frequency bins and the mean |
| 284 | is taken for each bin. |
| 285 | fmax : float | list of float | None |
| 286 | Upper bound of the frequency range in Hertz. Defaults to the |
| 287 | highest frequency available. When a list of frequencies is given, |
| 288 | these are used as the upper bounds (inclusive) of frequency bins |
| 289 | and the mean is taken for each bin. |
| 290 | |
| 291 | Returns |
| 292 | ------- |
| 293 | csd : instance of CrossSpectralDensity |
| 294 | The CSD matrix, averaged across the given frequency range(s). |
| 295 | """ |
| 296 | csd = self.sum(fmin, fmax) |
| 297 | for i, f in enumerate(csd.frequencies): |
| 298 | csd._data[:, i] /= len(f) |
| 299 | return csd |
| 300 | |
| 301 | def _get_frequency_index(self, freq): |
| 302 | """Find the index of the given frequency in ``self.frequencies``. |