Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 82fd441cd3f2a8bc33fc3ed41403eced > files > 1333

python-astropy-0.2.4-4.mga4.x86_64.rpm


<!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>sigma_clip &mdash; 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="Astrostatistics Tools (astropy.stats)" href="../stats/index.html" />
    <link rel="next" title="Configuration system (astropy.config)" href="../configs/index.html" />
    <link rel="prev" title="sigma_clip" href="" /> 
  </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="../configs/index.html" title="Configuration system (astropy.config)">
	  next &raquo;
	</a>
      </li>
      <li class="right">
	<a href="" title="sigma_clip">
	  &laquo; previous
	</a>
	 |
      </li>
      <li>
	<a href="../index.html">Astropy v0.2.4</a>
	 &raquo;
      </li>
      <li><a href="../stats/index.html" accesskey="U">Astrostatistics Tools (<tt class="docutils literal"><span class="pre">astropy.stats</span></tt>)</a> &raquo;</li>
      
      <li>sigma_clip</li> 
    </ul>
</div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="sigma-clip">
<h1>sigma_clip<a class="headerlink" href="#sigma-clip" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="astropy.stats.funcs.sigma_clip">
<tt class="descclassname">astropy.stats.funcs.</tt><tt class="descname">sigma_clip</tt><big>(</big><em>data</em>, <em>sig=3</em>, <em>iters=1</em>, <em>cenfunc=&lt;function median at 0x14d4c08&gt;</em>, <em>varfunc=&lt;function var at 0x13490c8&gt;</em>, <em>maout=False</em><big>)</big><a class="reference external" href="http://github.com/astropy/astropy/tree/v0.2.4/astropy/stats/funcs.py#L16" title="Push the Edit button on the next page"><span class="edit-on-github viewcode-link">&nbsp;[edit on github]</span></a><a class="reference internal" href="../_modules/astropy/stats/funcs.html#sigma_clip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astropy.stats.funcs.sigma_clip" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform sigma-clipping on the provided data.</p>
<p>This performs the sigma clipping algorithm - i.e. the data will be iterated
over, each time rejecting points that are more than a specified number of
standard deviations discrepant.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><tt class="xref py py-obj docutils literal"><span class="pre">scipy.stats.sigmaclip</span></tt> provides a subset of the functionality in this
function.</p>
</div>
<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>data</strong> : array-like</p>
<blockquote>
<div><p>The data to be sigma-clipped (any shape).</p>
</div></blockquote>
<p><strong>sig</strong> : float</p>
<blockquote>
<div><p>The number of standard deviations (<em>not</em> variances) to use as the
clipping limit.</p>
</div></blockquote>
<p><strong>iters</strong> : int or None</p>
<blockquote>
<div><p>The number of iterations to perform clipping for, or None to clip until
convergence is achieved (i.e. continue until the last iteration clips
nothing).</p>
</div></blockquote>
<p><strong>cenfunc</strong> : callable</p>
<blockquote>
<div><p>The technique to compute the center for the clipping. Must be a
callable that takes in a 1D data array and outputs the central value.
Defaults to the median.</p>
</div></blockquote>
<p><strong>varfunc</strong> : callable</p>
<blockquote>
<div><p>The technique to compute the variance about the center. Must be a
callable that takes in a 1D data array and outputs the width estimator
that will be interpreted as a variance. Defaults to the variance.</p>
</div></blockquote>
<p><strong>maout</strong> : bool or &#8216;copy&#8217;</p>
<blockquote>
<div><p>If True, a masked array will be returned. If the special string
&#8216;inplace&#8217;, the masked array will contain the same array as <tt class="xref py py-obj docutils literal"><span class="pre">data</span></tt>,
otherwise the array data will be copied.</p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>filtereddata</strong> : <tt class="xref py py-obj docutils literal"><span class="pre">numpy.ndarray</span></tt> or <tt class="xref py py-obj docutils literal"><span class="pre">numpy.masked.MaskedArray</span></tt></p>
<blockquote>
<div><p>If <tt class="xref py py-obj docutils literal"><span class="pre">maout</span></tt> is True, this is a masked array with a shape matching the
input that is masked where the algorithm has rejected those values.
Otherwise, a 1D array of values including only those that are not
clipped.</p>
</div></blockquote>
<p><strong>mask</strong> : boolean array</p>
<blockquote class="last">
<div><p>Only present if <tt class="xref py py-obj docutils literal"><span class="pre">maout</span></tt> is False. A boolean array with a shape matching
the input <tt class="xref py py-obj docutils literal"><span class="pre">data</span></tt> that is False for rejected values and True for all
others.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<p>This will generate random variates from a Gaussian distribution and return
only the points that are within 2 <em>sample</em> standard deviation from the
median:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">astropy.stats</span> <span class="kn">import</span> <span class="n">sigma_clip</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">numpy.random</span> <span class="kn">import</span> <span class="n">randn</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">randvar</span> <span class="o">=</span> <span class="n">randn</span><span class="p">(</span><span class="mi">10000</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span><span class="p">,</span><span class="n">mask</span> <span class="o">=</span> <span class="n">sigma_clip</span><span class="p">(</span><span class="n">randvar</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<p>This will clipping on a similar distribution, but for 3 sigma relative to
the sample <em>mean</em>, will clip until converged, and produces a
<tt class="xref py py-obj docutils literal"><span class="pre">numpy.masked.MaskedArray</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">astropy.stats</span> <span class="kn">import</span> <span class="n">sigma_clip</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">numpy.random</span> <span class="kn">import</span> <span class="n">randn</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">numpy</span> <span class="kn">import</span> <span class="n">mean</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">randvar</span> <span class="o">=</span> <span class="n">randn</span><span class="p">(</span><span class="mi">10000</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">maskedarr</span> <span class="o">=</span> <span class="n">sigma_clip</span><span class="p">(</span><span class="n">randvar</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="n">mean</span><span class="p">,</span> <span class="n">maout</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper"><h3>Page Contents</h3>
<ul>
<li><a class="reference internal" href="#">sigma_clip</a></li>
</ul>


        </div>
      </div>
      <div class="clearer"></div>
    </div>
<footer class="footer">
  <p class="pull-right">
    <a href="../_sources/_generated/astropy.stats.funcs.sigma_clip.txt"
       rel="nofollow">Page Source</a> &nbsp;
    <a href="#">Back to Top</a></p>
  <p>
    &copy; Copyright 2011-2013, The Astropy Developers.<br/>
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. &nbsp;
    Last built 22 Oct 2013. <br/>
  </p>
</footer>
  </body>
</html>