<!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>Miscellaneous Features — 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="FITS File handling (astropy.io.fits)" href="../index.html" /> <link rel="next" title="Examples" href="examples.html" /> <link rel="prev" title="Executable Scripts" href="scripts.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="examples.html" title="Examples"> next » </a> </li> <li class="right"> <a href="scripts.html" title="Executable Scripts"> « previous </a> | </li> <li> <a href="../../../index.html">Astropy v0.2.4</a> » </li> <li><a href="../index.html" accesskey="U">FITS File handling (<tt class="docutils literal"><span class="pre">astropy.io.fits</span></tt>)</a> »</li> <li>Miscellaneous Features</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="miscellaneous-features"> <h1>Miscellaneous Features<a class="headerlink" href="#miscellaneous-features" title="Permalink to this headline">¶</a></h1> <p>This section describes some of the miscellaneous features of <tt class="xref py py-obj docutils literal"><span class="pre">astropy.io.fits</span></tt>.</p> <div class="section" id="differs"> <h2>Differs<a class="headerlink" href="#differs" title="Permalink to this headline">¶</a></h2> <p>The <a class="reference internal" href="../api/diff.html#module-astropy.io.fits.diff" title="astropy.io.fits.diff"><tt class="xref py py-mod docutils literal"><span class="pre">astropy.io.fits.diff</span></tt></a> module contains several facilities for generating and reporting the differences between two FITS files, or two components of a FITS file.</p> <p>The <a class="reference internal" href="../api/diff.html#astropy.io.fits.FITSDiff" title="astropy.io.fits.FITSDiff"><tt class="xref py py-class docutils literal"><span class="pre">FITSDiff</span></tt></a> class can be used to generate and represent the differences between either two FITS files on disk, or two existing <a class="reference internal" href="../api/hdulists.html#astropy.io.fits.HDUList" title="astropy.io.fits.HDUList"><tt class="xref py py-class docutils literal"><span class="pre">HDUList</span></tt></a> objects (or some combination thereof).</p> <p>Likewise, the <a class="reference internal" href="../api/diff.html#astropy.io.fits.HeaderDiff" title="astropy.io.fits.HeaderDiff"><tt class="xref py py-class docutils literal"><span class="pre">HeaderDiff</span></tt></a> class can be used to find the differences just between two <a class="reference internal" href="../api/headers.html#astropy.io.fits.Header" title="astropy.io.fits.Header"><tt class="xref py py-class docutils literal"><span class="pre">Header</span></tt></a> objects. Other available differs include <a class="reference internal" href="../api/diff.html#astropy.io.fits.HDUDiff" title="astropy.io.fits.HDUDiff"><tt class="xref py py-class docutils literal"><span class="pre">HDUDiff</span></tt></a>, <a class="reference internal" href="../api/diff.html#astropy.io.fits.ImageDataDiff" title="astropy.io.fits.ImageDataDiff"><tt class="xref py py-class docutils literal"><span class="pre">ImageDataDiff</span></tt></a>, <a class="reference internal" href="../api/diff.html#astropy.io.fits.TableDataDiff" title="astropy.io.fits.TableDataDiff"><tt class="xref py py-class docutils literal"><span class="pre">TableDataDiff</span></tt></a>, and <a class="reference internal" href="../api/diff.html#astropy.io.fits.RawDataDiff" title="astropy.io.fits.RawDataDiff"><tt class="xref py py-class docutils literal"><span class="pre">RawDataDiff</span></tt></a>.</p> <p>Each of these classes are instantiated with two instances of the objects that they diff. The returned diff instance has a number of attributes starting with <tt class="docutils literal"><span class="pre">.diff_</span></tt> that describe differences between the two objects.</p> <p>For example the <a class="reference internal" href="../api/diff.html#astropy.io.fits.HeaderDiff" title="astropy.io.fits.HeaderDiff"><tt class="xref py py-class docutils literal"><span class="pre">HeaderDiff</span></tt></a> class cam be used to find the differences between two <a class="reference internal" href="../api/headers.html#astropy.io.fits.Header" title="astropy.io.fits.Header"><tt class="xref py py-class docutils literal"><span class="pre">Header</span></tt></a> objects like so:</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">astropy.io</span> <span class="kn">import</span> <span class="n">fits</span> <span class="gp">>>> </span><span class="n">header1</span> <span class="o">=</span> <span class="n">fits</span><span class="o">.</span><span class="n">Header</span><span class="p">([(</span><span class="s">'KEY_A'</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="s">'KEY_B'</span><span class="p">,</span> <span class="mi">2</span><span class="p">)])</span> <span class="gp">>>> </span><span class="n">header2</span> <span class="o">=</span> <span class="n">fits</span><span class="o">.</span><span class="n">Header</span><span class="p">([(</span><span class="s">'KEY_A'</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="p">(</span><span class="s">'KEY_C'</span><span class="p">,</span> <span class="mi">4</span><span class="p">)])</span> <span class="gp">>>> </span><span class="n">diff</span> <span class="o">=</span> <span class="n">fits</span><span class="o">.</span><span class="n">diff</span><span class="o">.</span><span class="n">HeaderDiff</span><span class="p">(</span><span class="n">header1</span><span class="p">,</span> <span class="n">header2</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">diff</span><span class="o">.</span><span class="n">identical</span> <span class="go">False</span> <span class="gp">>>> </span><span class="n">diff</span><span class="o">.</span><span class="n">diff_keywords</span> <span class="go">(['KEY_B'], ['KEY_C'])</span> <span class="gp">>>> </span><span class="n">diff</span><span class="o">.</span><span class="n">diff_keyword_values</span> <span class="go">defaultdict(<function <lambda> at ...>, {'KEY_A': [(1, 3)]})</span> </pre></div> </div> <p>See the API documentation for details on the different differ classes.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"><h3>Page Contents</h3> <ul> <li><a class="reference internal" href="#">Miscellaneous Features</a><ul> <li><a class="reference internal" href="#differs">Differs</a></li> </ul> </li> </ul> </div> </div> <div class="clearer"></div> </div> <footer class="footer"> <p class="pull-right"> <a href="http://github.com/astropy/astropy/tree/v0.2.4/docs/io/fits/usage/misc.rst">Edit This Page on Github</a> <a href="../../../_sources/io/fits/usage/misc.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>