<!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>CompositeUnit — 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="Units (astropy.units)" href="../units/index.html" /> <link rel="next" title="PrefixUnit" href="astropy.units.core.PrefixUnit.html" /> <link rel="prev" title="Unit" href="astropy.units.core.Unit.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.units.core.PrefixUnit.html" title="PrefixUnit"> next » </a> </li> <li class="right"> <a href="astropy.units.core.Unit.html" title="Unit"> « previous </a> | </li> <li> <a href="../index.html">Astropy v0.2.4</a> » </li> <li><a href="../units/index.html" accesskey="U">Units (<tt class="docutils literal"><span class="pre">astropy.units</span></tt>)</a> »</li> <li>CompositeUnit</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="compositeunit"> <h1>CompositeUnit<a class="headerlink" href="#compositeunit" title="Permalink to this headline">¶</a></h1> <dl class="class"> <dt id="astropy.units.core.CompositeUnit"> <em class="property">class </em><tt class="descclassname">astropy.units.core.</tt><tt class="descname">CompositeUnit</tt><big>(</big><em>scale</em>, <em>bases</em>, <em>powers</em><big>)</big><a class="reference external" href="http://github.com/astropy/astropy/tree/v0.2.4/astropy/units/core.py#L1166" 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/units/core.html#CompositeUnit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astropy.units.core.CompositeUnit" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="astropy.units.core.UnitBase.html#astropy.units.core.UnitBase" title="astropy.units.core.UnitBase"><tt class="xref py py-class docutils literal"><span class="pre">astropy.units.core.UnitBase</span></tt></a></p> <p>Create a composite unit using expressions of previously defined units.</p> <p>Direct use of this class is not recommended. Instead use the factory function <tt class="xref py py-obj docutils literal"><span class="pre">Unit(...)</span></tt> and arithmetic operators to compose units.</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>scale</strong> : number</p> <blockquote> <div><p>A scaling factor for the unit.</p> </div></blockquote> <p><strong>bases</strong> : sequence of <a class="reference internal" href="astropy.units.core.UnitBase.html#astropy.units.core.UnitBase" title="astropy.units.core.UnitBase"><tt class="xref py py-obj docutils literal"><span class="pre">UnitBase</span></tt></a></p> <blockquote> <div><p>A sequence of units this unit is composed of.</p> </div></blockquote> <p><strong>powers</strong> : sequence of numbers</p> <blockquote class="last"> <div><p>A sequence of powers (in parallel with <a class="reference internal" href="#astropy.units.core.CompositeUnit.bases" title="astropy.units.core.CompositeUnit.bases"><tt class="xref py py-obj docutils literal"><span class="pre">bases</span></tt></a>) for each of the base units.</p> </div></blockquote> </td> </tr> </tbody> </table> <p class="rubric">Attributes Summary</p> <table border="1" class="longtable docutils"> <colgroup> <col width="10%" /> <col width="90%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><a class="reference internal" href="#astropy.units.core.CompositeUnit.bases" title="astropy.units.core.CompositeUnit.bases"><tt class="xref py py-obj docutils literal"><span class="pre">bases</span></tt></a></td> <td>Return the bases of the composite unit.</td> </tr> <tr class="row-even"><td><a class="reference internal" href="#astropy.units.core.CompositeUnit.powers" title="astropy.units.core.CompositeUnit.powers"><tt class="xref py py-obj docutils literal"><span class="pre">powers</span></tt></a></td> <td>Return the powers of the composite unit.</td> </tr> <tr class="row-odd"><td><a class="reference internal" href="#astropy.units.core.CompositeUnit.scale" title="astropy.units.core.CompositeUnit.scale"><tt class="xref py py-obj docutils literal"><span class="pre">scale</span></tt></a></td> <td>Return the scale of the composite unit.</td> </tr> </tbody> </table> <p class="rubric">Methods Summary</p> <table border="1" class="longtable docutils"> <colgroup> <col width="10%" /> <col width="90%" /> </colgroup> <tbody valign="top"> <tr class="row-odd"><td><a class="reference internal" href="#astropy.units.core.CompositeUnit.decompose" title="astropy.units.core.CompositeUnit.decompose"><tt class="xref py py-obj docutils literal"><span class="pre">decompose</span></tt></a>([bases])</td> <td>Return a unit object composed of only irreducible units.</td> </tr> </tbody> </table> <p class="rubric">Attributes Documentation</p> <dl class="attribute"> <dt id="astropy.units.core.CompositeUnit.bases"> <tt class="descname">bases</tt><a class="reference internal" href="../_modules/astropy/units/core.html#CompositeUnit.bases"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astropy.units.core.CompositeUnit.bases" title="Permalink to this definition">¶</a></dt> <dd><p>Return the bases of the composite unit.</p> </dd></dl> <dl class="attribute"> <dt id="astropy.units.core.CompositeUnit.powers"> <tt class="descname">powers</tt><a class="reference internal" href="../_modules/astropy/units/core.html#CompositeUnit.powers"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astropy.units.core.CompositeUnit.powers" title="Permalink to this definition">¶</a></dt> <dd><p>Return the powers of the composite unit.</p> </dd></dl> <dl class="attribute"> <dt id="astropy.units.core.CompositeUnit.scale"> <tt class="descname">scale</tt><a class="reference internal" href="../_modules/astropy/units/core.html#CompositeUnit.scale"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astropy.units.core.CompositeUnit.scale" title="Permalink to this definition">¶</a></dt> <dd><p>Return the scale of the composite unit.</p> </dd></dl> <p class="rubric">Methods Documentation</p> <dl class="method"> <dt id="astropy.units.core.CompositeUnit.decompose"> <tt class="descname">decompose</tt><big>(</big><em>bases=set([])</em><big>)</big><a class="reference external" href="http://github.com/astropy/astropy/tree/v0.2.4/astropy/units/core.py#L1281" 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/units/core.html#CompositeUnit.decompose"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#astropy.units.core.CompositeUnit.decompose" title="Permalink to this definition">¶</a></dt> <dd><p>Return a unit object composed of only irreducible units.</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>bases</strong> : sequence of UnitBase, optional</p> <blockquote> <div><p>The bases to decompose into. When not provided, decomposes down to any irreducible units. When provided, the decomposed result will only contain the given units. This will raises a <a class="reference internal" href="astropy.units.core.UnitsException.html#astropy.units.core.UnitsException" title="astropy.units.core.UnitsException"><tt class="xref py py-obj docutils literal"><span class="pre">UnitsException</span></tt></a> if it’s not possible to do so.</p> </div></blockquote> </td> </tr> <tr class="field-even field"><th class="field-name">Returns :</th><td class="field-body"><p class="first"><strong>unit</strong> : CompositeUnit object</p> <blockquote class="last"> <div><p>New object containing only irreducible unit objects.</p> </div></blockquote> </td> </tr> </tbody> </table> </dd></dl> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"><h3>Page Contents</h3> <ul> <li><a class="reference internal" href="#">CompositeUnit</a></li> </ul> </div> </div> <div class="clearer"></div> </div> <footer class="footer"> <p class="pull-right"> <a href="../_sources/_generated/astropy.units.core.CompositeUnit.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>