Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e5c556b

Browse files
committed
added glen's Fc specteal patch
svn path=/trunk/matplotlib/; revision=4275
1 parent e78aecb commit e5c556b

15 files changed

Lines changed: 49 additions & 53 deletions

File tree

lib/matplotlib/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ def enumerate(seq):
118118

119119

120120
def is_string_like(obj):
121-
if hasattr(obj, 'shape'): return 0 # this is a workaround
122-
# for a bug in numeric<23.1
123121
try: obj + ''
124122
except (TypeError, ValueError): return 0
125123
return 1

lib/matplotlib/axes.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4338,7 +4338,7 @@ def imshow(self, X,
43384338
alpha=1.0, vmin=None, vmax=None, origin=None, extent=None)
43394339
43404340
IMSHOW(X) - plot image X to current axes, resampling to scale to axes
4341-
size (X may be numarray/Numeric array or PIL image)
4341+
size (X may be numpy array or PIL image)
43424342
43434343
IMSHOW(X, **kwargs) - Use keyword args to control image scaling,
43444344
colormapping etc. See below for details
@@ -4888,10 +4888,10 @@ def hist(self, x, bins=10, normed=0, bottom=None,
48884888
return n, bins, cbook.silent_list('Patch', patches)
48894889
hist.__doc__ = cbook.dedent(hist.__doc__) % martist.kwdocd
48904890

4891-
def psd(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
4891+
def psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
48924892
window=mlab.window_hanning, noverlap=0, **kwargs):
48934893
"""
4894-
PSD(x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
4894+
PSD(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
48954895
window=mlab.window_hanning, noverlap=0, **kwargs)
48964896
48974897
The power spectral density by Welches average periodogram method. The
@@ -4902,22 +4902,27 @@ def psd(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
49024902
with a scaling to correct for power loss due to windowing. Fs is the
49034903
sampling frequency.
49044904
4905-
NFFT is the length of the fft segment; must be a power of 2
4905+
* NFFT is the length of the fft segment; must be a power of 2
49064906
4907-
Fs is the sampling frequency.
4907+
* Fs is the sampling frequency.
49084908
4909-
detrend - the function applied to each segment before fft-ing,
4909+
* Fc is the center frequency of x (defaults to 0), which offsets
4910+
the yextents of the image to reflect the frequency range used
4911+
when a signal is acquired and then filtered and downsampled to
4912+
baseband.
4913+
4914+
* detrend - the function applied to each segment before fft-ing,
49104915
designed to remove the mean or linear trend. Unlike in matlab,
49114916
where the detrend parameter is a vector, in matplotlib is it a
49124917
function. The mlab module defines detrend_none, detrend_mean,
49134918
detrend_linear, but you can use a custom function as well.
49144919
4915-
window - the function used to window the segments. window is a
4920+
* window - the function used to window the segments. window is a
49164921
function, unlike in matlab(TM) where it is a vector. mlab defines
49174922
window_none, window_hanning, but you can use a custom function
49184923
as well.
49194924
4920-
noverlap gives the length of the overlap between segments.
4925+
* noverlap gives the length of the overlap between segments.
49214926
49224927
Returns the tuple Pxx, freqs
49234928
@@ -4935,6 +4940,7 @@ def psd(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
49354940
if not self._hold: self.cla()
49364941
pxx, freqs = mlab.psd(x, NFFT, Fs, detrend, window, noverlap)
49374942
pxx.shape = len(freqs),
4943+
freqs += Fc
49384944

49394945
self.plot(freqs, 10*npy.log10(pxx), **kwargs)
49404946
self.set_xlabel('Frequency')
@@ -4952,10 +4958,10 @@ def psd(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
49524958
return pxx, freqs
49534959
psd.__doc__ = cbook.dedent(psd.__doc__) % martist.kwdocd
49544960

4955-
def csd(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none,
4961+
def csd(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
49564962
window=mlab.window_hanning, noverlap=0, **kwargs):
49574963
"""
4958-
CSD(x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none,
4964+
CSD(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
49594965
window=window_hanning, noverlap=0, **kwargs)
49604966
49614967
The cross spectral density Pxy by Welches average periodogram method.
@@ -4981,6 +4987,7 @@ def csd(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none,
49814987
pxy, freqs = mlab.csd(x, y, NFFT, Fs, detrend, window, noverlap)
49824988
pxy.shape = len(freqs),
49834989
# pxy is complex
4990+
freqs += Fc
49844991

49854992
self.plot(freqs, 10*npy.log10(npy.absolute(pxy)), **kwargs)
49864993
self.set_xlabel('Frequency')
@@ -4997,11 +5004,10 @@ def csd(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none,
49975004
return pxy, freqs
49985005
csd.__doc__ = cbook.dedent(csd.__doc__) % martist.kwdocd
49995006

5000-
def cohere(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none,
5007+
def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
50015008
window=mlab.window_hanning, noverlap=0, **kwargs):
50025009
"""
5003-
COHERE(x, y, NFFT=256, Fs=2,
5004-
detrend = mlab.detrend_none,
5010+
COHERE(x, y, NFFT=256, Fs=2, Fc=0, detrend = mlab.detrend_none,
50055011
window = mlab.window_hanning, noverlap=0, **kwargs)
50065012
50075013
cohere the coherence between x and y. Coherence is the normalized
@@ -5026,6 +5032,7 @@ def cohere(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none,
50265032
"""
50275033
if not self._hold: self.cla()
50285034
cxy, freqs = mlab.cohere(x, y, NFFT, Fs, detrend, window, noverlap)
5035+
freqs += Fc
50295036

50305037
self.plot(freqs, cxy, **kwargs)
50315038
self.set_xlabel('Frequency')
@@ -5035,11 +5042,11 @@ def cohere(self, x, y, NFFT=256, Fs=2, detrend=mlab.detrend_none,
50355042
return cxy, freqs
50365043
cohere.__doc__ = cbook.dedent(cohere.__doc__) % martist.kwdocd
50375044

5038-
def specgram(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
5045+
def specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
50395046
window=mlab.window_hanning, noverlap=128,
50405047
cmap = None, xextent=None):
50415048
"""
5042-
SPECGRAM(x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
5049+
SPECGRAM(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
50435050
window = mlab.window_hanning, noverlap=128,
50445051
cmap=None, xextent=None)
50455052
@@ -5081,7 +5088,8 @@ def specgram(self, x, NFFT=256, Fs=2, detrend=mlab.detrend_none,
50815088

50825089
if xextent is None: xextent = 0, npy.amax(bins)
50835090
xmin, xmax = xextent
5084-
extent = xmin, xmax, npy.amin(freqs), npy.amax(freqs)
5091+
freqs += Fc
5092+
extent = xmin, xmax, freqs[0], freqs[-1]
50855093
im = self.imshow(Z, cmap, extent=extent)
50865094
self.axis('auto')
50875095

lib/matplotlib/backends/backend_agg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
2727
REQUIREMENTs
2828
29-
python2.2+
30-
Numeric 22+
29+
python2.3+
30+
numpy 1.0 +
31+
3132
agg2 (see below)
3233
freetype 2
3334
libpng

lib/matplotlib/cbook.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,12 @@ def iterable(obj):
208208

209209

210210
def is_string_like(obj):
211-
if hasattr(obj, 'shape'): return 0 # this is a workaround
212-
# for a bug in numeric<23.1
213211
try: obj + ''
214212
except (TypeError, ValueError): return 0
215213
return 1
216214

217215

218216
def is_file_like(obj):
219-
if hasattr(obj, 'shape'): return 0 # this is a workaround
220-
# for a bug in numeric<23.1
221217
try: obj + ''
222218
except (TypeError, ValueError): return 0
223219
return 1

lib/matplotlib/cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def to_rgba(self, x, alpha=1.0):
5656
return x
5757

5858
def set_array(self, A):
59-
'Set the image array from numeric/numarray A'
59+
'Set the image array from numpy array A'
6060
self._A = A
6161

6262
def get_array(self):

lib/matplotlib/collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ class QuadMesh(PatchCollection):
299299
thus (meshWidth * meshHeight) quadrilaterals in the mesh.
300300
The mesh need not be regular and the polygons need not be convex.
301301
A quadrilateral mesh is represented by a
302-
(2 x ((meshWidth + 1) * (meshHeight + 1))) Numeric array
302+
(2 x ((meshWidth + 1) * (meshHeight + 1))) numpy array
303303
'coordinates' where each row is the X and Y coordinates of one
304304
of the vertices.
305305
To define the function that maps from a data point to

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def _locate(self, x):
509509
N = len(b)
510510
ii = npy.minimum(npy.searchsorted(b, xn), N-1)
511511
i0 = npy.maximum(ii - 1, 0)
512-
#db = b[ii] - b[i0] (does not work with Numeric)
512+
#db = b[ii] - b[i0]
513513
db = npy.take(b, ii) - npy.take(b, i0)
514514
db = npy.where(i0==ii, 1.0, db)
515515
#dy = y[ii] - y[i0]

lib/matplotlib/config/matplotlib.conf.default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# MPLConfig - plaintext (in .conf format)
22

33
# This is a sample matplotlib configuration file. It should be placed
4-
# in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and
4+
# in HOME/.matplotlib (unix/linux like systems) and
55
# C:\Documents and Settings\yourname\.matplotlib (win32 systems)
66
#
77
# By default, the installer will overwrite the existing file in the install

lib/matplotlib/config/mplconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class MPLConfig(TConfig):
2424
"""
2525
This is a sample matplotlib configuration file. It should be placed
26-
in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and
26+
in HOME/.matplotlib (unix/linux like systems) and
2727
C:\Documents and Settings\yourname\.matplotlib (win32 systems)
2828
2929
By default, the installer will overwrite the existing file in the install

lib/matplotlib/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def set_array(self, A):
230230
"""
231231
retained for backwards compatibility - use set_data instead
232232
233-
ACCEPTS: numeric/numarray/PIL Image A"""
233+
ACCEPTS: numpy array A or PIL Image"""
234234
# This also needs to be here to override the inherited
235235
# cm.ScalarMappable.set_array method so it is not invoked
236236
# by mistake.

0 commit comments

Comments
 (0)