<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>convolve — Astropy v0.2.4</title> <link rel="stylesheet" href="../_static/bootstrap-astropy.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '0.2.4', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/sidebar.js"></script> <link rel="shortcut icon" href="../_static/astropy_logo.ico"/> <link rel="top" title="Astropy v0.2.4" href="../index.html" /> <link rel="up" title="N-dimensional datasets (astropy.nddata)" href="../nddata/index.html" /> <link rel="next" title="convolve_fft" href="astropy.nddata.convolution.convolve.convolve_fft.html" /> <link rel="prev" title="StdDevUncertainty" href="astropy.nddata.nduncertainty.StdDevUncertainty.html" /> </head> <body> <div class="topbar"> <a class="brand" title="Documentation Home" href="../index.html"></a> <ul> <li><a class="homelink" title="AstroPy Homepage" href="http://www.astropy.org"></a></li> <li><a title="General Index" href="../genindex.html">Index</a></li> <li><a title="Python Module Index" href="../py-modindex.html">Modules</a></li> <li> <form action="../search.html" method="get"> <input type="text" name="q" placeholder="Search" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </li> </ul> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right"> <a href="astropy.nddata.convolution.convolve.convolve_fft.html" title="convolve_fft"> next » </a> </li> <li class="right"> <a href="astropy.nddata.nduncertainty.StdDevUncertainty.html" title="StdDevUncertainty"> « previous </a> | </li> <li> <a href="../index.html">Astropy v0.2.4</a> » </li> <li><a href="../nddata/index.html" accesskey="U">N-dimensional datasets (<tt class="docutils literal"><span class="pre">astropy.nddata</span></tt>)</a> »</li> <li>convolve</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="convolve"> <h1>convolve<a class="headerlink" href="#convolve" title="Permalink to this headline">¶</a></h1> <dl class="function"> <dt id="astropy.nddata.convolution.convolve.convolve"> <tt class="descclassname">astropy.nddata.convolution.convolve.</tt><tt class="descname">convolve</tt><big>(</big><em>array</em>, <em>kernel</em>, <em>boundary=None</em>, <em>fill_value=0.0</em>, <em>normalize_kernel=False</em><big>)</big><a class="reference external" href="http://github.com/astropy/astropy/tree/v0.2.4/astropy/nddata/convolution/convolve.py#L8" title="Push the Edit button on the next page"><span class="edit-on-github viewcode-link"> [edit on github]</span></a><a class="reference internal" href="../_modules/astropy/nddata/convolution/convolve.html#convolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astropy.nddata.convolution.convolve.convolve" title="Permalink to this definition">¶</a></dt> <dd><p>Convolve an array with a kernel.</p> <p>This routine differs from <tt class="xref py py-obj docutils literal"><span class="pre">scipy.ndimage.filters.convolve</span></tt> because it includes a special treatment for <tt class="xref py py-obj docutils literal"><span class="pre">NaN</span></tt> values. Rather than including <tt class="xref py py-obj docutils literal"><span class="pre">NaNs</span></tt> in the convolution calculation, which causes large <tt class="xref py py-obj docutils literal"><span class="pre">NaN</span></tt> holes in the convolved image, <tt class="xref py py-obj docutils literal"><span class="pre">NaN</span></tt> values are replaced with interpolated values using the kernel as an interpolation function.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters :</th><td class="field-body"><p class="first"><strong>array</strong> : <tt class="xref py py-obj docutils literal"><span class="pre">numpy.ndarray</span></tt></p> <blockquote> <div><p>The array to convolve. This should be a 1, 2, or 3-dimensional array or a list or a set of nested lists representing a 1, 2, or 3-dimensional array.</p> </div></blockquote> <p><strong>kernel</strong> : <tt class="xref py py-obj docutils literal"><span class="pre">numpy.ndarray</span></tt></p> <blockquote> <div><p>The convolution kernel. The number of dimensions should match those for the array, and the dimensions should be odd in all directions.</p> </div></blockquote> <p><strong>boundary</strong> : str, optional</p> <blockquote> <div><dl class="docutils"> <dt>A flag indicating how to handle boundaries:</dt> <dd><ul class="first last"> <li><dl class="first docutils"> <dt><tt class="xref py py-obj docutils literal"><span class="pre">None</span></tt></dt> <dd><p class="first last">Set the <tt class="xref py py-obj docutils literal"><span class="pre">result</span></tt> values to zero where the kernel extends beyond the edge of the array (default).</p> </dd> </dl> </li> <li><dl class="first docutils"> <dt>‘fill’</dt> <dd><p class="first last">Set values outside the array boundary to <tt class="xref py py-obj docutils literal"><span class="pre">fill_value</span></tt>.</p> </dd> </dl> </li> <li><dl class="first docutils"> <dt>‘wrap’</dt> <dd><p class="first last">Periodic boundary that wrap to the other side of <tt class="xref py py-obj docutils literal"><span class="pre">array</span></tt>.</p> </dd> </dl> </li> <li><dl class="first docutils"> <dt>‘extend’</dt> <dd><p class="first last">Set values outside the array to the nearest <tt class="xref py py-obj docutils literal"><span class="pre">array</span></tt> value.</p> </dd> </dl> </li> </ul> </dd> </dl> </div></blockquote> <p><strong>fill_value</strong> : float, optional</p> <blockquote> <div><p>The value to use outside the array when using boundary=’fill’</p> </div></blockquote> <p><strong>normalize_kernel</strong> : bool, optional</p> <blockquote> <div><p>Whether to normalize the kernel prior to convolving</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>result</strong> : <tt class="xref py py-obj docutils literal"><span class="pre">numpy.ndarray</span></tt></p> <blockquote class="last"> <div><p>An array with the same dimensions and type as the input array, convolved with kernel.</p> </div></blockquote> </td> </tr> </tbody> </table> <p class="rubric">Notes</p> <p>Masked arrays are not supported at this time.</p> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"><h3>Page Contents</h3> <ul> <li><a class="reference internal" href="#">convolve</a></li> </ul> </div> </div> <div class="clearer"></div> </div> <footer class="footer"> <p class="pull-right"> <a href="../_sources/_generated/astropy.nddata.convolution.convolve.convolve.txt" rel="nofollow">Page Source</a> <a href="#">Back to Top</a></p> <p> © Copyright 2011-2013, The Astropy Developers.<br/> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. Last built 22 Oct 2013. <br/> </p> </footer> </body> </html>