6767 absolute , matrixmultiply , power , take , where , Float , Int , asum ,\
6868 dot , convolve , pi , Complex , ones , zeros , diagonal , Matrix , nonzero , \
6969 log , searchsorted , concatenate , sort , ArrayType , clip , size , indices ,\
70- conjugate
70+ conjugate , typecode , iscontiguous
7171
7272
7373from numerix .mlab import hanning , cov , diff , svd , rand , std
@@ -167,10 +167,10 @@ def psd(x, NFFT=256, Fs=2, detrend=detrend_none,
167167
168168
169169 # for real x, ignore the negative frequencies
170- if x . typecode ()== Complex : numFreqs = NFFT
170+ if typecode (x )== Complex : numFreqs = NFFT
171171 else : numFreqs = NFFT // 2 + 1
172172
173- windowVals = window (ones ((NFFT ,),x . typecode ()))
173+ windowVals = window (ones ((NFFT ,),typecode (x )))
174174 step = NFFT - noverlap
175175 ind = range (0 ,len (x )- NFFT + 1 ,step )
176176 n = len (ind )
@@ -230,10 +230,10 @@ def csd(x, y, NFFT=256, Fs=2, detrend=detrend_none,
230230 y [n :] = 0
231231
232232 # for real x, ignore the negative frequencies
233- if x . typecode ()== Complex : numFreqs = NFFT
233+ if typecode (x )== Complex : numFreqs = NFFT
234234 else : numFreqs = NFFT // 2 + 1
235235
236- windowVals = window (ones ((NFFT ,),x . typecode ()))
236+ windowVals = window (ones ((NFFT ,),typecode (x )))
237237 step = NFFT - noverlap
238238 ind = range (0 ,len (x )- NFFT + 1 ,step )
239239 n = len (ind )
@@ -412,7 +412,7 @@ def vander(x,N=None):
412412
413413 """
414414 if N is None : N = len (x )
415- X = ones ( (len (x ),N ), x . typecode ())
415+ X = ones ( (len (x ),N ), typecode (x ))
416416 for i in range (N - 1 ):
417417 X [:,i ] = x ** (N - i - 1 )
418418 return X
@@ -495,7 +495,7 @@ def cohere_pairs( X, ij, NFFT=256, Fs=2, detrend=detrend_none,
495495 # zero pad if X is too short
496496 if numRows < NFFT :
497497 tmp = X
498- X = zeros ( (NFFT , numCols ), X . typecode ())
498+ X = zeros ( (NFFT , numCols ), typecode (X ))
499499 X [:numRows ,:] = tmp
500500 del tmp
501501
@@ -510,13 +510,13 @@ def cohere_pairs( X, ij, NFFT=256, Fs=2, detrend=detrend_none,
510510 del seen
511511
512512 # for real X, ignore the negative frequencies
513- if X . typecode ()== Complex : numFreqs = NFFT
513+ if typecode (X )== Complex : numFreqs = NFFT
514514 else : numFreqs = NFFT // 2 + 1
515515
516516 # cache the FFT of every windowed, detrended NFFT length segement
517517 # of every channel. If preferSpeedOverMemory, cache the conjugate
518518 # as well
519- windowVals = window (ones ((NFFT ,), X . typecode ()))
519+ windowVals = window (ones ((NFFT ,), typecode (X )))
520520 ind = range (0 , numRows - NFFT + 1 , NFFT - noverlap )
521521 numSlices = len (ind )
522522 FFTSlices = {}
@@ -692,7 +692,7 @@ def longest_contiguous_ones(x):
692692 if len (ind )== 0 : return arange (len (x ))
693693 if len (ind )== len (x ): return array ([])
694694
695- y = zeros ( (len (x )+ 2 ,), x . typecode ())
695+ y = zeros ( (len (x )+ 2 ,), typecode (x ))
696696 y [1 :- 1 ] = x
697697 dif = diff (y )
698698 up = find (dif == 1 );
@@ -1117,10 +1117,10 @@ def specgram(x, NFFT=256, Fs=2, detrend=detrend_none,
11171117
11181118
11191119 # for real x, ignore the negative frequencies
1120- if x . typecode ()== Complex : numFreqs = NFFT
1120+ if typecode (x )== Complex : numFreqs = NFFT
11211121 else : numFreqs = NFFT // 2 + 1
11221122
1123- windowVals = window (ones ((NFFT ,),x . typecode ()))
1123+ windowVals = window (ones ((NFFT ,),typecode (x )))
11241124 step = NFFT - noverlap
11251125 ind = arange (0 ,len (x )- NFFT + 1 ,step )
11261126 n = len (ind )
@@ -1432,14 +1432,14 @@ def amap(fn,*args):
14321432def zeros_like (a ):
14331433 """Return an array of zeros of the shape and typecode of a."""
14341434
1435- return zeros (a .shape ,a . typecode ())
1435+ return zeros (a .shape ,typecode (a ))
14361436
14371437def sum_flat (a ):
14381438 """Return the sum of all the elements of a, flattened out.
14391439
14401440 It uses a.flat, and if a is not contiguous, a call to ravel(a) is made."""
14411441
1442- if a . iscontiguous ():
1442+ if iscontiguous (a ):
14431443 return asum (a .flat )
14441444 else :
14451445 return asum (ravel (a ))
0 commit comments