Revision: 6397
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6397&view=rev
Author: ryanmay
Date: 2008-11-11 21:45:15 +0000 (Tue, 11 Nov 2008)
Log Message:
-----------
Update specgram() to use the new keyword arguments and clean up docstring.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-11-11 21:32:29 UTC (rev 6396)
+++ trunk/matplotlib/CHANGELOG 2008-11-11 21:45:15 UTC (rev 6397)
@@ -1,7 +1,8 @@
-2008-11-11 Update the psd(), csd(), and cohere() methods of Axes
- and the csd() and cohere() functions in mlab to be in
- sync with the changes to psd(). In fact, under the
- hood, mlab.psd() now calls mlab.csd(). - RM
+2008-11-11 Update the psd(), csd(), cohere(), and specgram() methods
+ of Axes and the csd() cohere(), and specgram() functions
+ in mlab to be in sync with the changes to psd().
+ In fact, under the hood, these all call the same core
+ to do computations. - RM
2008-11-11 Add 'pad_to' and 'sides' parameters to mlab.psd() to
allow controlling of zero padding and returning of
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-11-11 21:32:29 UTC (rev
6396)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-11-11 21:45:15 UTC (rev
6397)
@@ -6719,17 +6719,16 @@
return cxy, freqs
cohere.__doc__ = cbook.dedent(cohere.__doc__) % psd_doc_dict
- del psd_doc_dict #So that this does not become an Axes attribute
def specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=128,
- cmap = None, xextent=None):
+ cmap=None, xextent=None, pad_to=None, sides='default'):
"""
call signature::
specgram(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
- window = mlab.window_hanning, noverlap=128,
- cmap=None, xextent=None)
+ window=mlab.window_hanning, noverlap=128,
+ cmap=None, xextent=None, pad_to=None, sides='default')
Compute a spectrogram of data in *x*. Data are split into
*NFFT* length segments and the PSD of each section is
@@ -6737,16 +6736,22 @@
segment, and the amount of overlap of each segment is
specified with *noverlap*.
- Keyword arguments:
+ %(PSD)s
+ *Fc*: integer
+ The center frequency of *x* (defaults to 0), which offsets
+ the y extents of the plot to reflect the frequency range used
+ when a signal is acquired and then filtered and downsampled to
+ baseband.
+
*cmap*:
A :class:`matplotlib.cm.Colormap` instance; if *None* use
default determined by rc
*xextent*:
- 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
+ The image extent along the x-axis. xextent = (xmin,xmax)
+ The default is (0,max(bins)), where bins is the return
+ value from :func:`mlab.specgram`
Return value is (*Pxx*, *freqs*, *bins*, *im*):
@@ -6757,21 +6762,21 @@
Note: If *x* is real (i.e. non-complex), only the positive
spectrum is shown. If *x* is complex, both positive and
- negative parts of the spectrum are shown.
+ negative parts of the spectrum are shown. This can be
+ overridden using the *sides* keyword argument.
- .. seealso:
- :meth:`psd`
- For a description of the optional parameters.
+ **Example:**
+
+ .. plot:: mpl_examples/pylab_examples/specgram_demo.py
"""
if not self._hold: self.cla()
Pxx, freqs, bins = mlab.specgram(x, NFFT, Fs, detrend,
- window, noverlap)
+ window, noverlap, pad_to, sides)
+ Z = 10. * np.log10(Pxx)
+ Z = np.flipud(Z)
- Z = 10*np.log10(Pxx)
- Z = np.flipud(Z)
-
if xextent is None: xextent = 0, np.amax(bins)
xmin, xmax = xextent
freqs += Fc
@@ -6780,6 +6785,8 @@
self.axis('auto')
return Pxx, freqs, bins, im
+ specgram.__doc__ = cbook.dedent(specgram.__doc__) % psd_doc_dict
+ del psd_doc_dict #So that this does not become an Axes attribute
def spy(self, Z, precision=0, marker=None, markersize=None,
aspect='equal', **kwargs):
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins