<!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="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Gotchas — PyWavelets Documentation</title> <link rel="stylesheet" href="../_static/nature.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></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/language_data.js"></script> <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within PyWavelets Documentation" href="../_static/opensearch.xml"/> <link rel="shortcut icon" href="../_static/favicon.ico"/> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="Contributing" href="../contributing.html" /> <link rel="prev" title="2D Wavelet Packets" href="wp2d.html" /> <meta name="description" content="PyWavelets is a scientific Python module for Wavelet Transform calculations."/> <meta name="keywords" content="PyWavelets, wavelets, Python, wavelet transform, discrete wavelet transform, dwt, idwt, swt, wavelet packets, stationary wavelet transform, pywt"/> <meta name="author" content="Filip Wasilewski"/> <meta name="Distribution" content="Global"/> <meta name="Robots" content="INDEX,FOLLOW"/> <script type="text/javascript"> (function ($) { $(document).ready(function () { $("#toggle-edit-info").click(function (e) { e.preventDefault(); $("#edit-info").toggle(); }); }); })(jQuery); </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-3396395-3']); _gaq.push(['_trackPageview']); (function () { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../contributing.html" title="Contributing" accesskey="N">next</a> |</li> <li class="right" > <a href="wp2d.html" title="2D Wavelet Packets" accesskey="P">previous</a> |</li> <li><a href="../index.html">Home »</a></li> <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Usage examples</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="gotchas"> <span id="reg-gotchas"></span><h1>Gotchas<a class="headerlink" href="#gotchas" title="Permalink to this headline">¶</a></h1> <p>PyWavelets utilizes <code class="docutils literal notranslate"><span class="pre">NumPy</span></code> under the hood. That’s why handling the data containing <code class="docutils literal notranslate"><span class="pre">None</span></code> values can be surprising. <code class="docutils literal notranslate"><span class="pre">None</span></code> values are converted to ‘not a number’ (<code class="docutils literal notranslate"><span class="pre">numpy.NaN</span></code>) values:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span><span class="o">,</span> <span class="nn">pywt</span> <span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="p">[</span><span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">]</span> <span class="gp">>>> </span><span class="n">mode</span> <span class="o">=</span> <span class="s1">'symmetric'</span> <span class="gp">>>> </span><span class="n">wavelet</span> <span class="o">=</span> <span class="s1">'db1'</span> <span class="gp">>>> </span><span class="n">cA</span><span class="p">,</span> <span class="n">cD</span> <span class="o">=</span> <span class="n">pywt</span><span class="o">.</span><span class="n">dwt</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">wavelet</span><span class="p">,</span> <span class="n">mode</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">numpy</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">cA</span><span class="p">))</span> <span class="go">True</span> <span class="gp">>>> </span><span class="n">numpy</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">cD</span><span class="p">))</span> <span class="go">True</span> <span class="gp">>>> </span><span class="n">rec</span> <span class="o">=</span> <span class="n">pywt</span><span class="o">.</span><span class="n">idwt</span><span class="p">(</span><span class="n">cA</span><span class="p">,</span> <span class="n">cD</span><span class="p">,</span> <span class="n">wavelet</span><span class="p">,</span> <span class="n">mode</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">numpy</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">rec</span><span class="p">))</span> <span class="go">True</span> </pre></div> </div> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="wp2d.html" title="previous chapter">2D Wavelet Packets</a></p> <h4>Next topic</h4> <p class="topless"><a href="../contributing.html" title="next chapter">Contributing</a></p><div> <h3>Quick links</h3> <ul> <li><a href="https://github.com/PyWavelets/pywt"><img src="../_static/github.png" height="16" width="16" alt="" /> Fork on Github</a></li> <li><a href="http://groups.google.com/group/pywavelets"><img src="../_static/comments.png" height="16" width="16" alt="" /> Discussion Group</a></li> <li><a href="http://wavelets.pybytes.com/"><img src="../_static/wave.png" height="16" width="16" alt="" /> Explore Wavelets</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <script type="text/javascript">$('#searchbox').show(0);</script> <div id="edit-instructions"> <h3>Edit this document</h3> <p> <a href="#" id="toggle-edit-info"> <img src="../_static/page_edit.png" height="16" width="16" alt="" /> The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed. </a> </p> <ol id="edit-info" style="display: none;"> <li> Go to <i><a href="https://github.com/PyWavelets/pywt/blob/master/doc/source/regression/gotchas.rst" target="_blank"> Gotchas </a></i> on GitHub. </li> <li> Press <b>Edit this file</b> button. </li> <li> Edit file contents using GitHub's text editor in your web browser </li> <li> Fill in the <b>Commit message</b> text box at the end of the page telling <i>why</i> you did the changes. Press <b>Propose file change</b> button next to it when done. </li> <li> On <i>Send a pull request</i> page you don't need to fill in text anymore. Just press <b>Send pull request</b> button. </li> <li> Your changes are now queued for review under project's <a href="https://github.com/PyWavelets/pywt/pulls" target="_blank">Pull requests</a> tab on Github. </li> </ol> </div> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../contributing.html" title="Contributing" >next</a> |</li> <li class="right" > <a href="wp2d.html" title="2D Wavelet Packets" >previous</a> |</li> <li><a href="../index.html">Home »</a></li> <li class="nav-item nav-item-1"><a href="index.html" >Usage examples</a> »</li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2006-2019, The PyWavelets Developers. Last updated on Jan 12, 2019. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.3. </div> </body> </html>