Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined behaviour of spectrum monitor if methods different from 'welch' or 'median mean' are set. #8

Open
mikelovskij opened this issue Oct 23, 2015 · 0 comments
Assignees

Comments

@mikelovskij
Copy link
Contributor

It seems that in the init method (first chunk of code pasted) of spectrum.py and in the update data method where the averages are computed (third chunk of code pasted) , only the median mean and the welch method are implemented,
but in another part of the update_data method (second chunk of code pasted), other methods are also accepted (median, lal-...), but will be treated as if they were the welch method.

In init
weight = kwargs.pop('weight', 'linear')
if weight.startswith('exp') and self.method == 'median-mean':
    raise ValueError("Median-mean average PSD method is incompatible "
                     "with a non-linear weighting")
In update data (before the computation of the single ffts)
if (self.method in ['median-mean', 'median'] or
        self.method.startswith('lal-')):
    method = 'lal-welch'
else:
    method = 'welch'
In update data (at the end the averages are computed:)
if self.method == 'median-mean' and len(SPECTRA[channel]) == 1:
    spec = SPECTRA[channel][0].value
elif self.method == 'median-mean':
    odd = numpy.median(SPECTRA[channel][::2], axis=0)
    even = numpy.median(SPECTRA[channel][1::2], axis=0)
    spec = numpy.mean((odd, even), axis=0)
else:
    weights = self.weights[-len(SPECTRA[channel]):]
    weights /= weights.sum()
    spec = numpy.sum([s*w for (s, w) in
                      zip(SPECTRA[channel], weights)], axis=0)
@mikelovskij mikelovskij changed the title Undefined behaviour of spectrogram monitor if methods different from 'welch' or 'median mean' are set. Undefined behaviour of spectrum monitor if methods different from 'welch' or 'median mean' are set. Oct 23, 2015
@duncanmmacleod duncanmmacleod self-assigned this Oct 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants