-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
specgram(x) should warn if x.size < 256 #6064
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
Comments
Are the results wrong or just misleading? Warnings tend to not be read by users who should read them and just annoy users who read them, but know what they are doing. I would prefer to either raise if the length of the data is less than |
Well with the default parameters and a small array the spectrogram is wrong since it shows a static distribution of power. I don't know if there's ever a case when it's useful to have an |
Thinking about this a bit more, the result is 'correct', in that there is only one window and it gives you back time point sample, just not terribly useful. |
Looking at this problem, I agree with @tacaswell : the result is what the user asked the specgram function to produce. Because when asking for So the point is not that the spectrogram is wrong, rather that the default value for NFFT (which is 256) is not adapted to a case where you only have 200 points in the input signal, I would say. Hope this clarifies the issue a bit. Best, Florian |
@flothesof: well I guess "wrong" in the sense that the default I think a simple check and a warning would be good in this case so it doesn't bite anyone with a misleading representation of their signal. |
Looks like this is fixed and good to be closed! |
Awesome! |
The default
NFFT
size of 256 gives misleading results ifx.size
<< 256, for example this chirp:Gives this. Passing
NFFT=32, noverlap=16
tospecgram()
gives this more reasonable result.Simplest fix is probably just to warn users when their data is too small.
The text was updated successfully, but these errors were encountered: