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
<divid="unreleased-message"> You are reading an old version of the documentation (v1.4.1). For the latest version see <ahref="https://matplotlib.org/stable/api/mlab_api.html">https://matplotlib.org/stable/api/mlab_api.html</a></div>
<emclass="property">class </em><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FIFOBuffer</code><spanclass="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><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>
<codeclass="xref py py-attr docutils literal"><spanclass="pre">matplotlib.Axes.dataLim</span></code>), 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><spanclass="versionmodified">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">
<codeclass="descname">add</code><spanclass="sig-paren">(</span><em>x</em>, <em>y</em><spanclass="sig-paren">)</span><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">
<codeclass="descname">asarrays</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><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">
<codeclass="descname">last</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><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">
<codeclass="descname">register</code><spanclass="sig-paren">(</span><em>func</em>, <em>N</em><spanclass="sig-paren">)</span><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 <codeclass="docutils literal"><spanclass="pre">func(fifo)</span></code>.</p>
<codeclass="descname">update_datalim_to_current</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><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><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatBool</code><aclass="headerlink" href="#matplotlib.mlab.FormatBool" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">fromstr</code><spanclass="sig-paren">(</span><em>s</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatBool.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatBool.toval">
<codeclass="descname">toval</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><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><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatDate</code><spanclass="sig-paren">(</span><em>fmt</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatDate" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">fromstr</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatDate.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatDate.toval">
<codeclass="descname">toval</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><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><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatDatetime</code><spanclass="sig-paren">(</span><em>fmt=u'%Y-%m-%d %H:%M:%S'</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatDatetime" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">fromstr</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><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><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatFloat</code><spanclass="sig-paren">(</span><em>precision=4</em>, <em>scale=1.0</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatFloat" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">fromstr</code><spanclass="sig-paren">(</span><em>s</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatFloat.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatFloat.toval">
<codeclass="descname">toval</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><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><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatFormatStr</code><spanclass="sig-paren">(</span><em>fmt</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatFormatStr" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">tostr</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><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><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatInt</code><aclass="headerlink" href="#matplotlib.mlab.FormatInt" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">fromstr</code><spanclass="sig-paren">(</span><em>s</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatInt.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatInt.tostr">
<codeclass="descname">tostr</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatInt.tostr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatInt.toval">
<codeclass="descname">toval</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><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><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatMillions</code><spanclass="sig-paren">(</span><em>precision=4</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatMillions" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatObj</code><aclass="headerlink" href="#matplotlib.mlab.FormatObj" title="Permalink to this definition">¶</a></dt>
<dd><dlclass="method">
<dtid="matplotlib.mlab.FormatObj.fromstr">
<codeclass="descname">fromstr</code><spanclass="sig-paren">(</span><em>s</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatObj.fromstr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatObj.tostr">
<codeclass="descname">tostr</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatObj.tostr" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.FormatObj.toval">
<codeclass="descname">toval</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><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><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatPercent</code><spanclass="sig-paren">(</span><em>precision=4</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatPercent" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatString</code><aclass="headerlink" href="#matplotlib.mlab.FormatString" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">tostr</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><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><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">FormatThousands</code><spanclass="sig-paren">(</span><em>precision=4</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.FormatThousands" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">GaussianKDE</code><spanclass="sig-paren">(</span><em>dataset</em>, <em>bw_method=None</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.GaussianKDE" title="Permalink to this definition">¶</a></dt>
<div><p>Datapoints to estimate from. In case of univariate data this is a 1-D
array, otherwise a 2-D array with shape (# of dims, # of data).</p>
</div></blockquote>
<p><strong>bw_method</strong> : str, scalar or callable, optional</p>
<blockquoteclass="last">
<div><p>The method used to calculate the estimator bandwidth. This can be
‘scott’, ‘silverman’, a scalar constant or a callable. If a
scalar, this will be used directly as <codeclass="xref py py-obj docutils literal"><spanclass="pre">kde.factor</span></code>. If a
callable, it should take a <aclass="reference internal" href="#matplotlib.mlab.GaussianKDE" title="matplotlib.mlab.GaussianKDE"><codeclass="xref py py-obj docutils literal"><spanclass="pre">GaussianKDE</span></code></a> instance as only
parameter and return a scalar. If None (default), ‘scott’ is used.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<pclass="rubric">Attributes</p>
<tableborder="1" class="docutils">
<colgroup>
<colwidth="11%" />
<colwidth="8%" />
<colwidth="81%" />
</colgroup>
<tbodyvalign="top">
<trclass="row-odd"><td>dataset</td>
<td>ndarray</td>
<td>The dataset with which <codeclass="xref py py-obj docutils literal"><spanclass="pre">gaussian_kde</span></code> was initialized.</td>
</tr>
<trclass="row-even"><td>dim</td>
<td>int</td>
<td>Number of dimensions.</td>
</tr>
<trclass="row-odd"><td>num_dp</td>
<td>int</td>
<td>Number of datapoints.</td>
</tr>
<trclass="row-even"><td>factor</td>
<td>float</td>
<td>The bandwidth factor, obtained from <codeclass="xref py py-obj docutils literal"><spanclass="pre">kde.covariance_factor</span></code>, with which
the covariance matrix is multiplied.</td>
</tr>
<trclass="row-odd"><td>covariance</td>
<td>ndarray</td>
<td>The covariance matrix of <codeclass="xref py py-obj docutils literal"><spanclass="pre">dataset</span></code>, scaled by the calculated bandwidth
<codeclass="descname">covariance_factor</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.GaussianKDE.covariance_factor" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.GaussianKDE.evaluate">
<codeclass="descname">evaluate</code><spanclass="sig-paren">(</span><em>points</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.GaussianKDE.evaluate" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluate the estimated pdf on a set of points.</p>
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><pclass="first"><strong>points</strong> : (# of dimensions, # of points)-array</p>
<blockquote>
<div><p>Alternatively, a (# of dimensions,) vector can be passed in and
treated as a single point.</p>
</div></blockquote>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><pclass="first"><strong>values</strong> : (# of points,)-array</p>
<blockquote>
<div><p>The values at each point.</p>
</div></blockquote>
</td>
</tr>
<trclass="field-odd field"><thclass="field-name">Raises:</th><tdclass="field-body"><pclass="first"><strong>ValueError</strong> : if the dimensionality of the input points is different</p>
<codeclass="descname">scotts_factor</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.GaussianKDE.scotts_factor" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">silverman_factor</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.GaussianKDE.silverman_factor" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="matplotlib.mlab.PCA">
<emclass="property">class </em><codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">PCA</code><spanclass="sig-paren">(</span><em>a</em>, <em>standardize=True</em><spanclass="sig-paren">)</span><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
<em>standardize</em>: True if input data are to be standardized. If False, only centering will be
carried out.</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. This is the vector that points to the
origin of PCA space.</p>
<p><em>sigma</em> : a numdims array of standard deviation of a</p>
<p><em>fracs</em> : the proportion of variance of each of the principal components</p>
<p><em>s</em> : the actual eigenvalues of the decomposition</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].
This row is also the 1st eigenvector.</p>
<dlclass="method">
<dtid="matplotlib.mlab.PCA.center">
<codeclass="descname">center</code><spanclass="sig-paren">(</span><em>x</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.PCA.center" title="Permalink to this definition">¶</a></dt>
<dd><p>center and optionally standardize the data using the mean and sigma from training set a</p>
</dd></dl>
<dlclass="method">
<dtid="matplotlib.mlab.PCA.project">
<codeclass="descname">project</code><spanclass="sig-paren">(</span><em>x</em>, <em>minfrac=0.0</em><spanclass="sig-paren">)</span><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">
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">amap</code><spanclass="sig-paren">(</span><em>function</em>, <em>sequence</em><spanclass="optional">[</span>, <em>sequence</em>, <em>...</em><spanclass="optional">]</span><spanclass="sig-paren">)</span> → array.<aclass="headerlink" href="#matplotlib.mlab.amap" title="Permalink to this definition">¶</a></dt>
<dd><p>Works like <codeclass="xref py py-func docutils literal"><spanclass="pre">map()</span></code>, but it returns an array. This is just a
convenient shorthand for <codeclass="docutils literal"><spanclass="pre">numpy.array(map(...))</span></code>.</p>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.angle_spectrum">
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">angle_spectrum</code><spanclass="sig-paren">(</span><em>x</em>, <em>Fs=None</em>, <em>window=None</em>, <em>pad_to=None</em>, <em>sides=None</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.angle_spectrum" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the angle of the frequency spectrum (wrapped phase spectrum) of
<em>x</em>. Data is padded to a length of <em>pad_to</em> and the windowing function
<em>window</em> is applied to the signal.</p>
<blockquote>
<div><dlclass="docutils">
<dt><em>x</em>: 1-D array or sequence</dt>
<dd>Array or sequence containing the data</dd>
</dl>
</div></blockquote>
<p>Keyword arguments:</p>
<blockquote>
<div><dlclass="docutils">
<dt><em>Fs</em>: scalar</dt>
<dd>The sampling frequency (samples per time unit). It is used
to calculate the Fourier frequencies, freqs, in cycles per time
unit. The default value is 2.</dd>
<dt><em>window</em>: callable or ndarray</dt>
<dd>A function or a vector of length <em>NFFT</em>. To create window
<codeclass="xref py py-func docutils literal"><spanclass="pre">scipy.signal.get_window()</span></code>, etc. The default is
<aclass="reference internal" href="#matplotlib.mlab.window_hanning" title="matplotlib.mlab.window_hanning"><codeclass="xref py py-func docutils literal"><spanclass="pre">window_hanning()</span></code></a>. If a function is passed as the
argument, it must take a data segment as an argument and
<dd><aclass="reference internal" href="#matplotlib.mlab.angle_spectrum" title="matplotlib.mlab.angle_spectrum"><codeclass="xref py py-func docutils literal"><spanclass="pre">angle_spectrum()</span></code></a> returns the magnitudes of the
<dd><aclass="reference internal" href="#matplotlib.mlab.phase_spectrum" title="matplotlib.mlab.phase_spectrum"><codeclass="xref py py-func docutils literal"><spanclass="pre">phase_spectrum()</span></code></a> returns the unwrapped version of this
<dd><aclass="reference internal" href="#matplotlib.mlab.specgram" title="matplotlib.mlab.specgram"><codeclass="xref py py-func docutils literal"><spanclass="pre">specgram()</span></code></a> can return the angle spectrum of segments
within the signal.</dd>
</dl>
</div>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.apply_window">
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">apply_window</code><spanclass="sig-paren">(</span><em>x</em>, <em>window</em>, <em>axis=0</em>, <em>return_window=None</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.apply_window" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply the given window to the given 1D or 2D array along the given axis.</p>
Either a function to generate a window or an array with length
*x*.shape[*axis*]
*axis*: integer
The axis over which to do the repetition.
Must be 0 or 1. The default is 0
*return_window*: bool
If true, also return the 1D values of the window that was applied
</pre></div>
</div>
</dd></dl>
<dlclass="function">
<dtid="matplotlib.mlab.base_repr">
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">base_repr</code><spanclass="sig-paren">(</span><em>number</em>, <em>base=2</em>, <em>padding=0</em><spanclass="sig-paren">)</span><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">
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">binary_repr</code><spanclass="sig-paren">(</span><em>number</em>, <em>max_length=1025</em><spanclass="sig-paren">)</span><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"><codeclass="xref py py-func docutils literal"><spanclass="pre">base_repr()</span></code></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">
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">bivariate_normal</code><spanclass="sig-paren">(</span><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><spanclass="sig-paren">)</span><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>
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">center_matrix</code><spanclass="sig-paren">(</span><em>M</em>, <em>dim=0</em><spanclass="sig-paren">)</span><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">
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">cohere</code><spanclass="sig-paren">(</span><em>x</em>, <em>y</em>, <em>NFFT=256</em>, <em>Fs=2</em>, <em>detrend=<function detrend_none at 0x7fd543b15c08></em>, <em>window=<function window_hanning at 0x7fd543b15938></em>, <em>noverlap=0</em>, <em>pad_to=None</em>, <em>sides=u'default'</em>, <em>scale_by_freq=None</em><spanclass="sig-paren">)</span><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
<codeclass="xref py py-func docutils literal"><spanclass="pre">scipy.signal.get_window()</span></code>, etc. The default is
<aclass="reference internal" href="#matplotlib.mlab.window_hanning" title="matplotlib.mlab.window_hanning"><codeclass="xref py py-func docutils literal"><spanclass="pre">window_hanning()</span></code></a>. If a function is passed as the
argument, it must take a data segment as an argument and
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">cohere_pairs</code><spanclass="sig-paren">(</span><em>X</em>, <em>ij</em>, <em>NFFT=256</em>, <em>Fs=2</em>, <em>detrend=<function detrend_none at 0x7fd543b15c08></em>, <em>window=<function window_hanning at 0x7fd543b15938></em>, <em>noverlap=0</em>, <em>preferSpeedOverMemory=True</em>, <em>progressCallback=<function donothing_callback at 0x7fd543ab4488></em>, <em>returnPxx=False</em><spanclass="sig-paren">)</span><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"><codeclass="xref py py-func docutils literal"><spanclass="pre">cohere_pairs()</span></code></a>
will still give significant performace gains over calling
<aclass="reference internal" href="#matplotlib.mlab.cohere" title="matplotlib.mlab.cohere"><codeclass="xref py py-func docutils literal"><spanclass="pre">cohere()</span></code></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., <codeclass="docutils literal"><spanclass="pre">Cxy[(i,j)</span><spanclass="pre">=</span><spanclass="pre">cohere(X[:,i],</span><spanclass="pre">X[:,j])</span></code>.
Number of dictionary keys is <codeclass="docutils literal"><spanclass="pre">len(ij)</span></code>.</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"><codeclass="xref py py-func docutils literal"><spanclass="pre">cohere_pairs()</span></code></a> can be much more
efficient than just calling <aclass="reference internal" href="#matplotlib.mlab.cohere" title="matplotlib.mlab.cohere"><codeclass="xref py py-func docutils literal"><spanclass="pre">cohere()</span></code></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 <codeclass="file docutils literal"><spanclass="pre">test/cohere_pairs_test.py</span></code> 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"><codeclass="xref py py-func docutils literal"><spanclass="pre">cohere_pairs()</span></code></a> and
<aclass="reference internal" href="#matplotlib.mlab.cohere" title="matplotlib.mlab.cohere"><codeclass="xref py py-func docutils literal"><spanclass="pre">cohere()</span></code></a> give the same results for a given pair.</p>
<codeclass="descclassname">matplotlib.mlab.</code><codeclass="descname">complex_spectrum</code><spanclass="sig-paren">(</span><em>x</em>, <em>Fs=None</em>, <em>window=None</em>, <em>pad_to=None</em>, <em>sides=None</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.mlab.complex_spectrum" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the complex-valued frequency spectrum of <em>x</em>. Data is padded to a
length of <em>pad_to</em> and the windowing function <em>window</em> is applied to the
signal.</p>
<blockquote>
<div><dlclass="docutils">
<dt><em>x</em>: 1-D array or sequence</dt>
<dd>Array or sequence containing the data</dd>
</dl>
</div></blockquote>
<p>Keyword arguments:</p>
<blockquote>
<div><dlclass="docutils">
<dt><em>Fs</em>: scalar</dt>
<dd>The sampling frequency (samples per time unit). It is used
to calculate the Fourier frequencies, freqs, in cycles per time
unit. The default value is 2.</dd>
<dt><em>window</em>: callable or ndarray</dt>
<dd>A function or a vector of length <em>NFFT</em>. To create window
<codeclass="xref py py-func docutils literal"><spanclass="pre">scipy.signal.get_window()</span></code>, etc. The default is
<aclass="reference internal" href="#matplotlib.mlab.window_hanning" title="matplotlib.mlab.window_hanning"><codeclass="xref py py-func docutils literal"><spanclass="pre">window_hanning()</span></code></a>. If a function is passed as the
argument, it must take a data segment as an argument and