11"""
2-
32Numerical python functions written for compatibility with MATLAB
43commands with the same names.
54
1514:func:`detrend`
1615 Remove the mean or best fit line from an array
1716
18- :func:`find`
19- Return the indices where some condition is true;
20- numpy.nonzero is similar but more general.
21-
22- :func:`griddata`
23- Interpolate irregularly distributed data to a
24- regular grid.
25-
26- :func:`prctile`
27- Find the percentiles of a sequence
28-
29- :func:`prepca`
30- Principal Component Analysis
31-
3217:func:`psd`
3318 Power spectral density using Welch's average periodogram
3419
35- :func:`rk4`
36- A 4th order runge kutta integrator for 1D or ND systems
37-
3820:func:`specgram`
3921 Spectrogram (spectrum over segments of time)
4022
4325
4426Functions that don't exist in MATLAB, but are useful anyway:
4527
46- :func:`cohere_pairs`
47- Coherence over all pairs. This is not a MATLAB function, but we
48- compute coherence a lot in my lab, and we compute it for a lot of
49- pairs. This function is optimized to do this efficiently by
50- caching the direct FFTs.
51-
52- :func:`rk4`
53- A 4th order Runge-Kutta ODE integrator in case you ever find
54- yourself stranded without scipy (and the far superior
55- scipy.integrate tools)
56-
57- :func:`contiguous_regions`
58- Return the indices of the regions spanned by some logical mask
59-
60- :func:`cross_from_below`
61- Return the indices where a 1D array crosses a threshold from below
62-
63- :func:`cross_from_above`
64- Return the indices where a 1D array crosses a threshold from above
65-
6628:func:`complex_spectrum`
6729 Return the complex-valued frequency spectrum of a signal
6830
7840:func:`detrend_mean`
7941 Remove the mean from a line.
8042
81- :func:`demean`
82- Remove the mean from a line. This function is the same as
83- :func:`detrend_mean` except for the default *axis*.
84-
8543:func:`detrend_linear`
8644 Remove the best fit line from a line.
8745
9654
9755:func:`apply_window`
9856 Apply a window along a given axis
99-
100-
101- record array helper functions
102- -----------------------------
103-
104- A collection of helper methods for numpyrecord arrays
105-
106- .. _htmlonly:
107-
108- See :ref:`misc-examples-index`
109-
110- :func:`rec2txt`
111- Pretty print a record array
112-
113- :func:`rec2csv`
114- Store record array in CSV file
115-
116- :func:`csv2rec`
117- Import record array from CSV file with type inspection
118-
119- :func:`rec_append_fields`
120- Adds field(s)/array(s) to record array
121-
122- :func:`rec_drop_fields`
123- Drop fields from record array
124-
125- :func:`rec_join`
126- Join two record arrays on sequence of fields
127-
128- :func:`recs_join`
129- A simple join of multiple recarrays using a single column as a key
130-
131- :func:`rec_groupby`
132- Summarize data by groups (similar to SQL GROUP BY)
133-
134- :func:`rec_summarize`
135- Helper code to filter rec array fields into new fields
136-
137- For the rec viewer functions(e rec2csv), there are a bunch of Format
138- objects you can pass into the functions that will do things like color
139- negative values red, set percent formatting and scaling, etc.
140-
141- Example usage::
142-
143- r = csv2rec('somefile.csv', checkrows=0)
144-
145- formatd = dict(
146- weight = FormatFloat(2),
147- change = FormatPercent(2),
148- cost = FormatThousands(2),
149- )
150-
151-
152- rec2excel(r, 'test.xls', formatd=formatd)
153- rec2csv(r, 'test.csv', formatd=formatd)
154-
15557"""
15658
15759import copy
@@ -320,6 +222,7 @@ def detrend(x, key=None, axis=None):
320222 return np .apply_along_axis (key , axis = axis , arr = x )
321223
322224
225+ @cbook .deprecated ("3.1" , alternative = "detrend_mean" )
323226def demean (x , axis = 0 ):
324227 '''
325228 Return x minus its mean along the specified axis.
@@ -336,11 +239,6 @@ def demean(x, axis=0):
336239
337240 See Also
338241 --------
339- :func:`delinear`
340-
341- :func:`denone`
342- :func:`delinear` and :func:`denone` are other detrend algorithms.
343-
344242 :func:`detrend_mean`
345243 This function is the same as :func:`detrend_mean` except for the
346244 default *axis*.
@@ -410,10 +308,6 @@ def detrend_none(x, axis=None):
410308
411309 See Also
412310 --------
413- :func:`denone`
414- This function is the same as :func:`denone` except for the default
415- *axis*, which has no effect.
416-
417311 :func:`detrend_mean`
418312
419313 :func:`detrend_linear`
@@ -441,10 +335,6 @@ def detrend_linear(y):
441335
442336 See Also
443337 --------
444- :func:`delinear`
445- This function is the same as :func:`delinear` except for the default
446- *axis*.
447-
448338 :func:`detrend_mean`
449339
450340 :func:`detrend_none`
0 commit comments