Hello,
This is fairly minor, but I'd wonder if you'd consider including it.
It adds an optional Fc parameter to the specgram method of the Axes
class, and makes the calculation of the extent a bit more efficient.
Also, a quick fix for mlab.py.
Thank you,
Glen Mabey
*** zipsrc/matplotlib-20071113_svn/lib/matplotlib/axes.py 2007-11-13 13:13:03.000000000 -0600
--- /usr/local/tmp/axes.py 2007-11-13 16:08:13.000000000 -0600
***************
*** 5035,5045 ****
return cxy, freqs
cohere.__doc__ = cbook.dedent(cohere.__doc__) % martist.kwdocd
! def specgram(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=128,
cmap = None, xextent=None):
"""
! SPECGRAM(x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
window = mlab.window_hanning, noverlap=128,
cmap=None, xextent=None)
--- 5035,5045 ----
return cxy, freqs
cohere.__doc__ = cbook.dedent(cohere.__doc__) % martist.kwdocd
! def specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=128,
cmap = None, xextent=None):
"""
! SPECGRAM(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window = mlab.window_hanning, noverlap=128,
cmap=None, xextent=None)
***************
*** 5050,5055 ****
--- 5050,5060 ----
* cmap is a colormap; if None use default determined by rc
+ * Fc is the center frequency of x (defaults to 0), which offsets
+ the yextents of the image to reflect the frequency range used
+ when a signal is acquired and then filtered and downsampled to
+ baseband.
+
* xextent is the image extent in the xaxes xextent=xmin, xmax -
default 0, max(bins), 0, max(freqs) where bins is the return
value from mlab.specgram
***************
*** 5081,5087 ****
if xextent is None: xextent = 0, npy.amax(bins)
xmin, xmax = xextent
! extent = xmin, xmax, npy.amin(freqs), npy.amax(freqs)
im = self.imshow(Z, cmap, extent=extent)
self.axis('auto')
--- 5086,5093 ----
if xextent is None: xextent = 0, npy.amax(bins)
xmin, xmax = xextent
! freqs += Fc
! extent = xmin, xmax, freqs[0], freqs[-1]
im = self.imshow(Z, cmap, extent=extent)
self.axis('auto')
*** zipsrc/matplotlib-20071113_svn/lib/matplotlib/mlab.py 2007-11-13 16:14:22.000000000 -0600
--- /usr/local/stow/matplotlib-20071113_svn-py2.5/lib/python2.5/site-packages/matplotlib/mlab.py 2007-11-13 16:17:41.000000000 -0600
***************
*** 353,359 ****
# zero pad x up to NFFT if it is shorter than NFFT
if len(x)<NFFT:
n = len(x)
! x = resize(x, (NFFT,))
x[n:] = 0
--- 353,359 ----
# zero pad x up to NFFT if it is shorter than NFFT
if len(x)<NFFT:
n = len(x)
! x = npy.resize(x, (NFFT,))
x[n:] = 0
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel