-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Corrected default values of xextent in specgram(). Fixes Bug #7666. #7692
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
Conversation
Should these be padded out to be the left and right edges of the first and last segments so that the mid points of the pixels are the midpoint of the time bins? |
@tacaswell, I'm not quite sure, if I understand what you mean by padding: The length in of the spectrogram is always shorter then the signal (by |
The |
Current coverage is 62.07% (diff: 100%)@@ master #7692 diff @@
==========================================
Files 174 174
Lines 56021 56022 +1
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 34773 34776 +3
+ Misses 21248 21246 -2
Partials 0 0
|
Thanks, LGTM to me! This is another case where we would have asked you to squash and re-base (to only have one set of the regenerated images in the repository history), but in general you do not have to squash down to a single commit. |
@@ -7228,7 +7229,9 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None, | |||
Z = np.flipud(Z) | |||
|
|||
if xextent is None: | |||
xextent = 0, np.max(t) | |||
# padding is needed for first and last segment: | |||
pad_xextnt = (NFFT-noverlap) / Fs / 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pad_xextent
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Thanks @vollbier 🎉 I think this is your first contribution to mpl, hopefully there will be many more! |
I hope so too. |
#7666 says 2.0.1? |
Bumped the issue to 2.1, I think this change is too big to put into 2.0 (at least on top of the rc). I am very open to be convinced otherwise. |
@tacaswell I have no idea, how such changes disturb matplotlib's release cycles. From the user's point of view, I would tend to include it: I stumbled upon this issue while comparing spectrograms to Wigner-Ville distributions for certain signals. It lead me at first to the wrong conclusion, that spectrograms give biased estimates, which can be a quite serious roadblock for further investigations. |
Corrected default values of xextent in specgram(). Fixes Bug #7666. Conflicts: lib/matplotlib/axes/_axes.py kept backported version, overlapping changes do to other cleanups
Let's the time axis start from the midpoint of the first segment instead at 0. Details are in the bug report #7666.
Todo: