From: <jd...@us...> - 2007-11-14 16:40:40
|
Revision: 4275 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4275&view=rev Author: jdh2358 Date: 2007-11-14 08:39:47 -0800 (Wed, 14 Nov 2007) Log Message: ----------- added glen's Fc specteal patch Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/cbook.py trunk/matplotlib/lib/matplotlib/cm.py trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/colorbar.py trunk/matplotlib/lib/matplotlib/config/matplotlib.conf.default trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/lib/matplotlib/image.py trunk/matplotlib/lib/matplotlib/lines.py trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/lib/matplotlib/numerix/__init__.py trunk/matplotlib/lib/matplotlib/pylab.py trunk/matplotlib/setup.py Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -118,8 +118,6 @@ def is_string_like(obj): - if hasattr(obj, 'shape'): return 0 # this is a workaround - # for a bug in numeric<23.1 try: obj + '' except (TypeError, ValueError): return 0 return 1 Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -4338,7 +4338,7 @@ alpha=1.0, vmin=None, vmax=None, origin=None, extent=None) IMSHOW(X) - plot image X to current axes, resampling to scale to axes - size (X may be numarray/Numeric array or PIL image) + size (X may be numpy array or PIL image) IMSHOW(X, **kwargs) - Use keyword args to control image scaling, colormapping etc. See below for details @@ -4888,10 +4888,10 @@ return n, bins, cbook.silent_list('Patch', patches) hist.__doc__ = cbook.dedent(hist.__doc__) % martist.kwdocd - def psd(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none, + def psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=0, **kwargs): """ - PSD(x, NFFT=256, Fs=2, detrend=mlab.detrend_none, + PSD(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=0, **kwargs) The power spectral density by Welches average periodogram method. The @@ -4902,22 +4902,27 @@ with a scaling to correct for power loss due to windowing. Fs is the sampling frequency. - NFFT is the length of the fft segment; must be a power of 2 + * NFFT is the length of the fft segment; must be a power of 2 - Fs is the sampling frequency. + * Fs is the sampling frequency. - detrend - the function applied to each segment before fft-ing, + * 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. + + * detrend - the function applied to each segment before fft-ing, designed to remove the mean or linear trend. Unlike in matlab, where the detrend parameter is a vector, in matplotlib is it a function. The mlab module defines detrend_none, detrend_mean, detrend_linear, but you can use a custom function as well. - window - the function used to window the segments. window is a + * window - the function used to window the segments. window is a function, unlike in matlab(TM) where it is a vector. mlab defines window_none, window_hanning, but you can use a custom function as well. - noverlap gives the length of the overlap between segments. + * noverlap gives the length of the overlap between segments. Returns the tuple Pxx, freqs @@ -4935,6 +4940,7 @@ if not self._hold: self.cla() pxx, freqs = mlab.psd(x, NFFT, Fs, detrend, window, noverlap) pxx.shape = len(freqs), + freqs += Fc self.plot(freqs, 10*npy.log10(pxx), **kwargs) self.set_xlabel('Frequency') @@ -4952,10 +4958,10 @@ return pxx, freqs psd.__doc__ = cbook.dedent(psd.__doc__) % martist.kwdocd - def csd(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none, + def csd(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=0, **kwargs): """ - CSD(x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none, + CSD(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=window_hanning, noverlap=0, **kwargs) The cross spectral density Pxy by Welches average periodogram method. @@ -4981,6 +4987,7 @@ pxy, freqs = mlab.csd(x, y, NFFT, Fs, detrend, window, noverlap) pxy.shape = len(freqs), # pxy is complex + freqs += Fc self.plot(freqs, 10*npy.log10(npy.absolute(pxy)), **kwargs) self.set_xlabel('Frequency') @@ -4997,11 +5004,10 @@ return pxy, freqs csd.__doc__ = cbook.dedent(csd.__doc__) % martist.kwdocd - def cohere(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none, + def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=0, **kwargs): """ - COHERE(x, y, NFFT=256, Fs=2, - detrend = mlab.detrend_none, + COHERE(x, y, NFFT=256, Fs=2, Fc=0, detrend = mlab.detrend_none, window = mlab.window_hanning, noverlap=0, **kwargs) cohere the coherence between x and y. Coherence is the normalized @@ -5026,6 +5032,7 @@ """ if not self._hold: self.cla() cxy, freqs = mlab.cohere(x, y, NFFT, Fs, detrend, window, noverlap) + freqs += Fc self.plot(freqs, cxy, **kwargs) self.set_xlabel('Frequency') @@ -5035,11 +5042,11 @@ return cxy, freqs cohere.__doc__ = cbook.dedent(cohere.__doc__) % martist.kwdocd - def specgram(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none, + 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, detrend=mlab.detrend_none, + SPECGRAM(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window = mlab.window_hanning, noverlap=128, cmap=None, xextent=None) @@ -5081,7 +5088,8 @@ if xextent is None: xextent = 0, npy.amax(bins) xmin, xmax = xextent - extent = xmin, xmax, npy.amin(freqs), npy.amax(freqs) + freqs += Fc + extent = xmin, xmax, freqs[0], freqs[-1] im = self.imshow(Z, cmap, extent=extent) self.axis('auto') Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -26,8 +26,9 @@ REQUIREMENTs - python2.2+ - Numeric 22+ + python2.3+ + numpy 1.0 + + agg2 (see below) freetype 2 libpng Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -208,16 +208,12 @@ def is_string_like(obj): - if hasattr(obj, 'shape'): return 0 # this is a workaround - # for a bug in numeric<23.1 try: obj + '' except (TypeError, ValueError): return 0 return 1 def is_file_like(obj): - if hasattr(obj, 'shape'): return 0 # this is a workaround - # for a bug in numeric<23.1 try: obj + '' except (TypeError, ValueError): return 0 return 1 Modified: trunk/matplotlib/lib/matplotlib/cm.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cm.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/cm.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -56,7 +56,7 @@ return x def set_array(self, A): - 'Set the image array from numeric/numarray A' + 'Set the image array from numpy array A' self._A = A def get_array(self): Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/collections.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -299,7 +299,7 @@ thus (meshWidth * meshHeight) quadrilaterals in the mesh. The mesh need not be regular and the polygons need not be convex. A quadrilateral mesh is represented by a - (2 x ((meshWidth + 1) * (meshHeight + 1))) Numeric array + (2 x ((meshWidth + 1) * (meshHeight + 1))) numpy array 'coordinates' where each row is the X and Y coordinates of one of the vertices. To define the function that maps from a data point to Modified: trunk/matplotlib/lib/matplotlib/colorbar.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colorbar.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/colorbar.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -509,7 +509,7 @@ N = len(b) ii = npy.minimum(npy.searchsorted(b, xn), N-1) i0 = npy.maximum(ii - 1, 0) - #db = b[ii] - b[i0] (does not work with Numeric) + #db = b[ii] - b[i0] db = npy.take(b, ii) - npy.take(b, i0) db = npy.where(i0==ii, 1.0, db) #dy = y[ii] - y[i0] Modified: trunk/matplotlib/lib/matplotlib/config/matplotlib.conf.default =================================================================== --- trunk/matplotlib/lib/matplotlib/config/matplotlib.conf.default 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/config/matplotlib.conf.default 2007-11-14 16:39:47 UTC (rev 4275) @@ -1,7 +1,7 @@ # MPLConfig - plaintext (in .conf format) # This is a sample matplotlib configuration file. It should be placed -# in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and +# in HOME/.matplotlib (unix/linux like systems) and # C:\Documents and Settings\yourname\.matplotlib (win32 systems) # # By default, the installer will overwrite the existing file in the install Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -23,7 +23,7 @@ class MPLConfig(TConfig): """ This is a sample matplotlib configuration file. It should be placed - in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and + in HOME/.matplotlib (unix/linux like systems) and C:\Documents and Settings\yourname\.matplotlib (win32 systems) By default, the installer will overwrite the existing file in the install Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/image.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -230,7 +230,7 @@ """ retained for backwards compatibility - use set_data instead - ACCEPTS: numeric/numarray/PIL Image A""" + ACCEPTS: numpy array A or PIL Image""" # This also needs to be here to override the inherited # cm.ScalarMappable.set_array method so it is not invoked # by mistake. Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/lines.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -227,7 +227,7 @@ """ Artist.__init__(self) - #convert sequences to numeric arrays + #convert sequences to numpy arrays if not iterable(xdata): raise RuntimeError('xdata must be a sequence') if not iterable(ydata): Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -533,7 +533,7 @@ Cxy, Phase, freqs = cohere_pairs( X, ij, ...) Compute the coherence for all pairs in ij. X is a - numSamples,numCols Numeric array. ij is a list of tuples (i,j). + numSamples,numCols numpy array. ij is a list of tuples (i,j). Each tuple is a pair of indexes into the columns of X for which you want to compute coherence. For example, if X has 64 columns, and you want to compute all nonredundant pairs, define ij as @@ -894,7 +894,7 @@ Example 1 : ## 2D system - # Numeric solution + def derivs6(x,t): d1 = x[0] + 2*x[1] d2 = -3*x[0] + 4*x[1] @@ -1480,8 +1480,7 @@ """ A set of convenient utilities for numerical work. -Most of this module requires Numerical Python or is meant to be used with it. -See http://www.pfdubois.com/numpy for details. +Most of this module requires numpy or is meant to be used with it. Copyright (c) 2001-2004, Fernando Perez. <Fer...@co...> All rights reserved. @@ -1754,7 +1753,7 @@ #from numpy import fromfunction as fromfunction_kw def fromfunction_kw(function, dimensions, **kwargs): - """Drop-in replacement for fromfunction() from Numerical Python. + """Drop-in replacement for fromfunction() from numpy Allows passing keyword arguments to the desired function. @@ -1938,12 +1937,8 @@ ### end mlab2 functions -#Classes for manipulating and viewing numpy record arrays +#helpers for loading, saving, manipulating and viewing numpy record arrays - - - - def safe_isnan(x): 'isnan for arbitrary types' try: b = npy.isnan(x) @@ -2236,10 +2231,10 @@ # a series of classes for describing the format intentions of various rec views class FormatObj: def tostr(self, x): - return str(self.toval(x)) + return self.toval(x) def toval(self, x): - return x + return str(x) class FormatString(FormatObj): Modified: trunk/matplotlib/lib/matplotlib/numerix/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -35,8 +35,10 @@ use_maskedarray = True if a == "--ma": use_maskedarray = False -del a +try: del a +except NameError: pass + if which[0] is None: try: # In theory, rcParams always has *some* value for numerix. which = rcParams['numerix'], "rc" Modified: trunk/matplotlib/lib/matplotlib/pylab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/lib/matplotlib/pylab.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -191,11 +191,6 @@ __end -Credits: The plotting commands were provided by -John D. Hunter <jdh...@ac...> - -Most of the other commands are from Numeric, MLab and FFT, with the -exception of those in mlab.py provided by matplotlib. """ import sys, warnings Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-14 16:29:24 UTC (rev 4274) +++ trunk/matplotlib/setup.py 2007-11-14 16:39:47 UTC (rev 4275) @@ -263,15 +263,16 @@ distrib = setup(name="matplotlib", version= __version__, - description = "Matlab(TM) style python plotting package", + description = "Python plotting package", author = "John D. Hunter", author_email="jd...@gm...", url = "http://matplotlib.sourceforge.net", long_description = """ matplotlib strives to produce publication quality 2D graphics - using matlab plotting for inspiration. Although the main lib is - object oriented, there is a functional interface "pylab" - for people coming from Matlab. + for interactive graphing, scientific publishing, user interface + development and web application servers targeting multiple user + interfaces and hardcopy output formats. There is a 'pylab' mode + which emulates matlab graphics """, packages = packages, platforms='any', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |