You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FIFOBuffer</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FIFOBuffer" title="Permalink to this definition">¶</a></dt>
<dd><p>A FIFO queue to hold incoming <em>x</em>, <em>y</em> data in a rotating buffer
using numpy arrays under the hood. It is assumed that you will
call asarrays much less frequently than you add data to the queue
– otherwise another data structure will be faster.</p>
<p>This can be used to support plots where data is added from a real
time feed and the plot object wants to grab data from the buffer
and plot it to screen less freqeuently than the incoming.</p>
<ttclass="xref py py-attr docutils literal"><spanclass="pre">matplotlib.Axes.dataLim</span></tt>), the <em>dataLim</em> will be updated as
new data come in.</p>
<p>TODO: add a grow method that will extend nmax</p>
<divclass="admonition note">
<pclass="first admonition-title">Note</p>
<pclass="last">mlab seems like the wrong place for this class.</p>
</div>
<divclass="deprecated">
<p><span>Deprecated since version 1.3: </span>The FIFOBuffer class was deprecated in version 1.3.</p>
</div>
<p>Buffer up to <em>nmax</em> points.</p>
<dlclass="method">
<dtid="matplotlib.mlab.FIFOBuffer.add">
<ttclass="descname">add</tt><big>(</big><em>x</em>, <em>y</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FIFOBuffer.add" title="Permalink to this definition">¶</a></dt>
<dd><p>Add scalar <em>x</em> and <em>y</em> to the queue.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FIFOBuffer.asarrays">
<ttclass="descname">asarrays</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FIFOBuffer.asarrays" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <em>x</em> and <em>y</em> as arrays; their length will be the len of
data added or <em>nmax</em>.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FIFOBuffer.last">
<ttclass="descname">last</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FIFOBuffer.last" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the last <em>x</em>, <em>y</em> or <em>None</em>. <em>None</em> if no data set.</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FIFOBuffer.register">
<ttclass="descname">register</tt><big>(</big><em>func</em>, <em>N</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FIFOBuffer.register" title="Permalink to this definition">¶</a></dt>
<dd><p>Call <em>func</em> every time <em>N</em> events are passed; <em>func</em> signature
is <ttclass="docutils literal"><spanclass="pre">func(fifo)</span></tt>.</p>
<ttclass="descname">update_datalim_to_current</tt><big>(</big><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FIFOBuffer.update_datalim_to_current" title="Permalink to this definition">¶</a></dt>
<dd><p>Update the <em>datalim</em> in the current data in the fifo.</p>
</dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.FormatBool">
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatBool</tt><aclass="headerlink" href="#matplotlib.mlab.FormatBool" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">fromstr</tt><big>(</big><em>s</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatBool.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatBool.toval">
<ttclass="descname">toval</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatBool.toval" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.FormatDate">
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatDate</tt><big>(</big><em>fmt</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatDate" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">fromstr</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatDate.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatDate.toval">
<ttclass="descname">toval</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatDate.toval" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.FormatDatetime">
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatDatetime</tt><big>(</big><em>fmt='%Y-%m-%d %H:%M:%S'</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatDatetime" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">fromstr</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatDatetime.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.FormatFloat">
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatFloat</tt><big>(</big><em>precision=4</em>, <em>scale=1.0</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatFloat" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">fromstr</tt><big>(</big><em>s</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatFloat.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatFloat.toval">
<ttclass="descname">toval</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatFloat.toval" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.FormatFormatStr">
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatFormatStr</tt><big>(</big><em>fmt</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatFormatStr" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">tostr</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatFormatStr.tostr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.FormatInt">
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatInt</tt><aclass="headerlink" href="#matplotlib.mlab.FormatInt" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">fromstr</tt><big>(</big><em>s</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatInt.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatInt.tostr">
<ttclass="descname">tostr</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatInt.tostr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatInt.toval">
<ttclass="descname">toval</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatInt.toval" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.FormatMillions">
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatMillions</tt><big>(</big><em>precision=4</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatMillions" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatObj</tt><aclass="headerlink" href="#matplotlib.mlab.FormatObj" title="Permalink to this definition">¶</a></dt>
<dd><dlclass="method">
<dtid="matplotlib.mlab.FormatObj.fromstr">
<ttclass="descname">fromstr</tt><big>(</big><em>s</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatObj.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatObj.tostr">
<ttclass="descname">tostr</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatObj.tostr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatObj.toval">
<ttclass="descname">toval</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatObj.toval" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.FormatPercent">
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatPercent</tt><big>(</big><em>precision=4</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatPercent" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatString</tt><aclass="headerlink" href="#matplotlib.mlab.FormatString" title="Permalink to this definition">¶</a></dt>
<ttclass="descname">tostr</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatString.tostr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.FormatThousands">
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">FormatThousands</tt><big>(</big><em>precision=4</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.FormatThousands" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">PCA</tt><big>(</big><em>a</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.PCA" title="Permalink to this definition">¶</a></dt>
<dd><p>compute the SVD of a and store data for PCA. Use project to
project the data onto a reduced set of dimensions</p>
<p>Inputs:</p>
<blockquote>
<div><em>a</em>: a numobservations x numdims array</div></blockquote>
<p>Attrs:</p>
<blockquote>
<div><p><em>a</em> a centered unit sigma version of input a</p>
<p><em>numrows</em>, <em>numcols</em>: the dimensions of a</p>
<p><em>mu</em> : a numdims array of means of a</p>
<p><em>sigma</em> : a numdims array of atandard deviation of a</p>
<p><em>fracs</em> : the proportion of variance of each of the principal components</p>
<p><em>Wt</em> : the weight vector for projecting a numdims point or array into PCA space</p>
<p><em>Y</em> : a projected into PCA space</p>
</div></blockquote>
<p>The factor loadings are in the Wt factor, ie the factor
loadings for the 1st principal component are given by Wt[0]</p>
<dlclass="method">
<dtid="matplotlib.mlab.PCA.center">
<ttclass="descname">center</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.PCA.center" title="Permalink to this definition">¶</a></dt>
<dd><p>center the data using the mean and sigma from training set a</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.PCA.project">
<ttclass="descname">project</tt><big>(</big><em>x</em>, <em>minfrac=0.0</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.PCA.project" title="Permalink to this definition">¶</a></dt>
<dd><p>project x onto the principle axes, dropping any axes where fraction of variance<minfrac</p>
</dd></dl>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.amap">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">amap</tt><big>(</big><em>function</em>, <em>sequence</em><spanclass="optional">[</span>, <em>sequence</em>, <em>...</em><spanclass="optional">]</span><big>)</big> → array.<aclass="headerlink" href="#matplotlib.mlab.amap" title="Permalink to this definition">¶</a></dt>
<dd><p>Works like <ttclass="xref py py-func docutils literal"><spanclass="pre">map()</span></tt>, but it returns an array. This is just a
convenient shorthand for <ttclass="docutils literal"><spanclass="pre">numpy.array(map(...))</span></tt>.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.base_repr">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">base_repr</tt><big>(</big><em>number</em>, <em>base=2</em>, <em>padding=0</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.base_repr" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the representation of a <em>number</em> in any given <em>base</em>.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.binary_repr">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">binary_repr</tt><big>(</big><em>number</em>, <em>max_length=1025</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.binary_repr" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the binary representation of the input <em>number</em> as a
string.</p>
<p>This is more efficient than using <aclass="reference internal" href="#matplotlib.mlab.base_repr" title="matplotlib.mlab.base_repr"><ttclass="xref py py-func docutils literal"><spanclass="pre">base_repr()</span></tt></a> with base 2.</p>
<p>Increase the value of max_length for very large numbers. Note that
on 32-bit machines, 2**1023 is the largest integer power of 2
which can be converted to a Python float.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.bivariate_normal">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">bivariate_normal</tt><big>(</big><em>X</em>, <em>Y</em>, <em>sigmax=1.0</em>, <em>sigmay=1.0</em>, <em>mux=0.0</em>, <em>muy=0.0</em>, <em>sigmaxy=0.0</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.bivariate_normal" title="Permalink to this definition">¶</a></dt>
<dd><p>Bivariate Gaussian distribution for equal shape <em>X</em>, <em>Y</em>.</p>
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">center_matrix</tt><big>(</big><em>M</em>, <em>dim=0</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.center_matrix" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the matrix <em>M</em> with each row having zero mean and unit std.</p>
<p>If <em>dim</em> = 1 operate on columns instead of rows. (<em>dim</em> is
opposite to the numpy axis kwarg.)</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.cohere">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">cohere</tt><big>(</big><em>x</em>, <em>y</em>, <em>NFFT=256</em>, <em>Fs=2</em>, <em>detrend=<function detrend_none at 0x2635de8></em>, <em>window=<function window_hanning at 0x2635b90></em>, <em>noverlap=0</em>, <em>pad_to=None</em>, <em>sides='default'</em>, <em>scale_by_freq=None</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.cohere" title="Permalink to this definition">¶</a></dt>
<dd><p>The coherence between <em>x</em> and <em>y</em>. Coherence is the normalized
<ttclass="xref py py-func docutils literal"><spanclass="pre">scipy.signal.get_window()</span></tt>, etc. The default is
<aclass="reference internal" href="#matplotlib.mlab.window_hanning" title="matplotlib.mlab.window_hanning"><ttclass="xref py py-func docutils literal"><spanclass="pre">window_hanning()</span></tt></a>. If a function is passed as the
argument, it must take a data segment as an argument and
return the windowed version of the segment.</dd>
<dt><em>pad_to</em>: integer</dt>
<dd>The number of points to which the data segment is padded when
performing the FFT. This can be different from <em>NFFT</em>, which
specifies the number of data points used. While not increasing
the actual resolution of the psd (the minimum distance between
resolvable peaks), this can give more points in the plot,
allowing for more detail. This corresponds to the <em>n</em> parameter
in the call to fft(). The default is None, which sets <em>pad_to</em>
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">cohere_pairs</tt><big>(</big><em>X</em>, <em>ij</em>, <em>NFFT=256</em>, <em>Fs=2</em>, <em>detrend=<function detrend_none at 0x2635de8></em>, <em>window=<function window_hanning at 0x2635b90></em>, <em>noverlap=0</em>, <em>preferSpeedOverMemory=True</em>, <em>progressCallback=<function donothing_callback at 0x263b398></em>, <em>returnPxx=False</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.cohere_pairs" title="Permalink to this definition">¶</a></dt>
<p><em>preferSpeedOverMemory</em> is an optional bool. Defaults to true. If
False, limits the caching by only making one, rather than two,
complex cache arrays. This is useful if memory becomes critical.
Even when <em>preferSpeedOverMemory</em> is False, <aclass="reference internal" href="#matplotlib.mlab.cohere_pairs" title="matplotlib.mlab.cohere_pairs"><ttclass="xref py py-func docutils literal"><spanclass="pre">cohere_pairs()</span></tt></a>
will still give significant performace gains over calling
<aclass="reference internal" href="#matplotlib.mlab.cohere" title="matplotlib.mlab.cohere"><ttclass="xref py py-func docutils literal"><spanclass="pre">cohere()</span></tt></a> for each pair, and will use subtantially less
memory than if <em>preferSpeedOverMemory</em> is True. In my tests with
a 43000,64 array over all nonredundant pairs,
<em>preferSpeedOverMemory</em> = True delivered a 33% performance boost
on a 1.7GHZ Athlon with 512MB RAM compared with
<em>preferSpeedOverMemory</em> = False. But both solutions were more
than 10x faster than naively crunching all possible pairs through
<li><pclass="first"><em>Cxy</em>: dictionary of (<em>i</em>, <em>j</em>) tuples -> coherence vector for
that pair. I.e., <ttclass="docutils literal"><spanclass="pre">Cxy[(i,j)</span><spanclass="pre">=</span><spanclass="pre">cohere(X[:,i],</span><spanclass="pre">X[:,j])</span></tt>.
Number of dictionary keys is <ttclass="docutils literal"><spanclass="pre">len(ij)</span></tt>.</p>
</li>
<li><pclass="first"><em>Phase</em>: dictionary of phases of the cross spectral density at
each frequency for each pair. Keys are (<em>i</em>, <em>j</em>).</p>
</li>
<li><dlclass="first docutils">
<dt><em>freqs</em>: vector of frequencies, equal in length to either the</dt>
<dd><pclass="first last">coherence or phase vectors for any (<em>i</em>, <em>j</em>) key.</p>
<p>For a large number of pairs, <aclass="reference internal" href="#matplotlib.mlab.cohere_pairs" title="matplotlib.mlab.cohere_pairs"><ttclass="xref py py-func docutils literal"><spanclass="pre">cohere_pairs()</span></tt></a> can be much more
efficient than just calling <aclass="reference internal" href="#matplotlib.mlab.cohere" title="matplotlib.mlab.cohere"><ttclass="xref py py-func docutils literal"><spanclass="pre">cohere()</span></tt></a> for each pair, because
it caches most of the intensive computations. If <imgsrc="../_images/mathmpl/math-1922d1ceaa.png" style="position: relative; bottom: -3px"/> is the
number of pairs, this function is <imgsrc="../_images/mathmpl/math-98c8089378.png" style="position: relative; bottom: -8px"/> for most of the
heavy lifting, whereas calling cohere for each pair is
<imgsrc="../_images/mathmpl/math-83ff203e39.png" style="position: relative; bottom: -8px"/>. However, because of the caching, it is also more
memory intensive, making 2 additional complex arrays with
approximately the same number of elements as <em>X</em>.</p>
<p>See <ttclass="file docutils literal"><spanclass="pre">test/cohere_pairs_test.py</span></tt> in the src tree for an
example script that shows that this <aclass="reference internal" href="#matplotlib.mlab.cohere_pairs" title="matplotlib.mlab.cohere_pairs"><ttclass="xref py py-func docutils literal"><spanclass="pre">cohere_pairs()</span></tt></a> and
<aclass="reference internal" href="#matplotlib.mlab.cohere" title="matplotlib.mlab.cohere"><ttclass="xref py py-func docutils literal"><spanclass="pre">cohere()</span></tt></a> give the same results for a given pair.</p>
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">contiguous_regions</tt><big>(</big><em>mask</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.contiguous_regions" title="Permalink to this definition">¶</a></dt>
<dd><p>return a list of (ind0, ind1) such that mask[ind0:ind1].all() is
True and we cover all such regions</p>
<p>TODO: this is a pure python implementation which probably has a much faster numpy impl</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.cross_from_above">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">cross_from_above</tt><big>(</big><em>x</em>, <em>threshold</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.cross_from_above" title="Permalink to this definition">¶</a></dt>
<dd><p>return the indices into <em>x</em> where <em>x</em> crosses some threshold from
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">cross_from_below</tt><big>(</big><em>x</em>, <em>threshold</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.cross_from_below" title="Permalink to this definition">¶</a></dt>
<dd><p>return the indices into <em>x</em> where <em>x</em> crosses some threshold from
<ttclass="xref py py-func docutils literal"><spanclass="pre">scipy.signal.get_window()</span></tt>, etc. The default is
<aclass="reference internal" href="#matplotlib.mlab.window_hanning" title="matplotlib.mlab.window_hanning"><ttclass="xref py py-func docutils literal"><spanclass="pre">window_hanning()</span></tt></a>. If a function is passed as the
argument, it must take a data segment as an argument and
return the windowed version of the segment.</dd>
<dt><em>pad_to</em>: integer</dt>
<dd>The number of points to which the data segment is padded when
performing the FFT. This can be different from <em>NFFT</em>, which
specifies the number of data points used. While not increasing
the actual resolution of the psd (the minimum distance between
resolvable peaks), this can give more points in the plot,
allowing for more detail. This corresponds to the <em>n</em> parameter
in the call to fft(). The default is None, which sets <em>pad_to</em>
<dd>Specifies which sides of the PSD to return. Default gives the
default behavior, which returns one-sided for real data and both
for complex data. ‘onesided’ forces the return of a one-sided PSD,
while ‘twosided’ forces two-sided.</dd>
<dt><em>scale_by_freq</em>: boolean</dt>
<dd>Specifies whether the resulting density values should be scaled
by the scaling frequency, which gives density in units of Hz^-1.
This allows for integration over the returned frequency values.
The default is True for MATLAB compatibility.</dd>
<dt><em>noverlap</em>: integer</dt>
<dd>The number of points of overlap between blocks. The default value
is 0 (no overlap).</dd>
</dl>
</div></blockquote>
<p>Returns the tuple (<em>Pxy</em>, <em>freqs</em>).</p>
<dlclass="docutils">
<dt>Refs:</dt>
<dd>Bendat & Piersol – Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.csv2rec">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">csv2rec</tt><big>(</big><em>fname</em>, <em>comments='#'</em>, <em>skiprows=0</em>, <em>checkrows=0</em>, <em>delimiter='</em>, <em>'</em>, <em>converterd=None</em>, <em>names=None</em>, <em>missing=''</em>, <em>missingd=None</em>, <em>use_mrecords=False</em>, <em>dayfirst=False</em>, <em>yearfirst=False</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.csv2rec" title="Permalink to this definition">¶</a></dt>
<dd><p>Load data from comma/space/tab delimited file in <em>fname</em> into a
numpy record array and return the record array.</p>
<p>If <em>names</em> is <em>None</em>, a header row is required to automatically
assign the recarray names. The headers will be lower cased,
spaces will be converted to underscores, and illegal attribute
name characters removed. If <em>names</em> is not <em>None</em>, it is a
sequence of names to use for the column names. In this case, it
is assumed there is no header row.</p>
<ul>
<li><pclass="first"><em>fname</em>: can be a filename or a file handle. Support for gzipped
files is automatic, if the filename ends in ‘.gz’</p>
</li>
<li><pclass="first"><em>comments</em>: the character used to indicate the start of a comment
in the file, or <em>None</em> to switch off the removal of comments</p>
</li>
<li><pclass="first"><em>skiprows</em>: is the number of rows from the top to skip</p>
</li>
<li><pclass="first"><em>checkrows</em>: is the number of rows to check to validate the column
data type. When set to zero all rows are validated.</p>
</li>
<li><pclass="first"><em>converterd</em>: if not <em>None</em>, is a dictionary mapping column number or
munged column name to a converter function.</p>
</li>
<li><pclass="first"><em>names</em>: if not None, is a list of header names. In this case, no
header will be read from the file</p>
</li>
<li><pclass="first"><em>missingd</em> is a dictionary mapping munged column names to field values
which signify that the field does not contain actual data and should
be masked, e.g., ‘0000-00-00’ or ‘unused’</p>
</li>
<li><pclass="first"><em>missing</em>: a string whose value signals a missing field regardless of
the column it appears in</p>
</li>
<li><pclass="first"><em>use_mrecords</em>: if True, return an mrecords.fromrecords record array if any of the data are missing</p>
</li>
<li><pclass="first"><em>dayfirst</em>: default is False so that MM-DD-YY has precedence over
DD-MM-YY. See <aclass="reference external" href="http://labix.org/python-dateutil#head-b95ce2094d189a89f80f5ae52a05b4ab7b41af47">http://labix.org/python-dateutil#head-b95ce2094d189a89f80f5ae52a05b4ab7b41af47</a>
for further information.</p>
</li>
<li><pclass="first"><em>yearfirst</em>: default is False so that MM-DD-YY has precedence over
YY-MM-DD. See <aclass="reference external" href="http://labix.org/python-dateutil#head-b95ce2094d189a89f80f5ae52a05b4ab7b41af47">http://labix.org/python-dateutil#head-b95ce2094d189a89f80f5ae52a05b4ab7b41af47</a>
for further information.</p>
<p>If no rows are found, <em>None</em> is returned – see <ttclass="file docutils literal"><spanclass="pre">examples/loadrec.py</span></tt></p>
</li>
</ul>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.csvformat_factory">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">csvformat_factory</tt><big>(</big><em>format</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.csvformat_factory" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.demean">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">demean</tt><big>(</big><em>x</em>, <em>axis=0</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.demean" title="Permalink to this definition">¶</a></dt>
<dd><p>Return x minus its mean along the specified axis</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.detrend">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">detrend</tt><big>(</big><em>x</em>, <em>key=None</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.detrend" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.detrend_linear">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">detrend_linear</tt><big>(</big><em>y</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.detrend_linear" title="Permalink to this definition">¶</a></dt>
<dd><p>Return y minus best fit line; ‘linear’ detrending</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.detrend_mean">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">detrend_mean</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.detrend_mean" title="Permalink to this definition">¶</a></dt>
<dd><p>Return x minus the mean(x)</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.detrend_none">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">detrend_none</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.detrend_none" title="Permalink to this definition">¶</a></dt>
<dd><p>Return x: no detrending</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.dist">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">dist</tt><big>(</big><em>x</em>, <em>y</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.dist" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the distance between two points.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.dist_point_to_segment">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">dist_point_to_segment</tt><big>(</big><em>p</em>, <em>s0</em>, <em>s1</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.dist_point_to_segment" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the distance of a point to a segment.</p>
<blockquote>
<div><em>p</em>, <em>s0</em>, <em>s1</em> are <em>xy</em> sequences</div></blockquote>
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">distances_along_curve</tt><big>(</big><em>X</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.distances_along_curve" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes the distance between a set of successive points in <em>N</em> dimensions.</p>
<p>Where <em>X</em> is an <em>M</em> x <em>N</em> array or matrix. The distances between
successive rows is computed. Distance is the standard Euclidean
distance.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.donothing_callback">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">donothing_callback</tt><big>(</big><em>*args</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.donothing_callback" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.entropy">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">entropy</tt><big>(</big><em>y</em>, <em>bins</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.entropy" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the entropy of the data in <em>y</em>.</p>
<imgsrc="../_images/mathmpl/math-5c77f15b40.png" class="center" /><p>where <imgsrc="../_images/mathmpl/math-6700e99fd3.png" style="position: relative; bottom: -7px"/> is the probability of observing <em>y</em> in the
<imgsrc="../_images/mathmpl/math-fce1799ac3.png" style="position: relative; bottom: -3px"/> bin of <em>bins</em>. <em>bins</em> can be a number of bins or a
range of bins; see <ttclass="xref py py-func docutils literal"><spanclass="pre">numpy.histogram()</span></tt>.</p>
<p>Compare <em>S</em> with analytic calculation for a Gaussian:</p>
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">exp_safe</tt><big>(</big><em>x</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.exp_safe" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute exponentials which safely underflow to zero.</p>
<p>Slow, but convenient to use. Note that numpy provides proper
floating point exception handling with access to the underlying
hardware.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.fftsurr">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">fftsurr</tt><big>(</big><em>x</em>, <em>detrend=<function detrend_none at 0x2635de8></em>, <em>window=<function window_none at 0x2635c08></em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.fftsurr" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute an FFT phase randomized surrogate of <em>x</em>.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.find">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">find</tt><big>(</big><em>condition</em><big>)</big><aclass="headerlink" href="#matplotlib.mlab.find" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the indices where ravel(condition) is true</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.frange">
<ttclass="descclassname">matplotlib.mlab.</tt><ttclass="descname">frange</tt><big>(</big><spanclass="optional">[</span><em>start</em><spanclass="optional">]</span>, <em>stop</em><spanclass="optional">[</span>, <em>step</em>, <em>keywords</em><spanclass="optional">]</span><big>)</big> → array of floats<aclass="headerlink" href="#matplotlib.mlab.frange" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a numpy ndarray containing a progression of floats. Similar to
<ttclass="xref py py-func docutils literal"><spanclass="pre">numpy.arange()</span></tt>, but defaults to a closed interval.</p>
defaults to 0, and the endpoint <em>is included</em>. This behavior is
different from that of <ttclass="xref py py-func docutils literal"><spanclass="pre">range()</span></tt> and
<ttclass="xref py py-func docutils literal"><spanclass="pre">numpy.arange()</span></tt>. This is deliberate, since <aclass="reference internal" href="#matplotlib.mlab.frange" title="matplotlib.mlab.frange"><ttclass="xref py py-func docutils literal"><spanclass="pre">frange()</span></tt></a>
will probably be more useful for generating lists of points for
function evaluation, and endpoints are often desired in this
use. The usual behavior of <ttclass="xref py py-func docutils literal"><spanclass="pre">range()</span></tt> can be obtained by
setting the keyword <em>closed</em> = 0, in this case, <aclass="reference internal" href="#matplotlib.mlab.frange" title="matplotlib.mlab.frange"><ttclass="xref py py-func docutils literal"><spanclass="pre">frange()</span></tt></a>
basically becomes :func:numpy.arange`.</p>
<p>When <em>step</em> is given, it specifies the increment (or
decrement). All arguments can be floating point numbers.</p>
<p><ttclass="docutils literal"><spanclass="pre">frange(x0,x1,d)</span></tt> returns <ttclass="docutils literal"><spanclass="pre">[x0,x0+d,x0+2d,...,xfin]</span></tt> where
<em>xfin</em> <= <em>x1</em>.</p>
<p><aclass="reference internal" href="#matplotlib.mlab.frange" title="matplotlib.mlab.frange"><ttclass="xref py py-func docutils literal"><spanclass="pre">frange()</span></tt></a> can also be called with the keyword <em>npts</em>. This
sets the number of points the list should contain (and overrides
the value <em>step</em> might have been given). <ttclass="xref py py-func docutils literal"><spanclass="pre">numpy.arange()</span></tt>