awips2/pythonPackages/scientific/Doc/Reference/Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html
2016-06-27 15:10:22 -05:00

828 lines
31 KiB
HTML
Executable file

<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Scientific.Physics.PhysicalQuantities.PhysicalQuantity</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="Scientific-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Tree link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Index link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Help link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://dirac.cnrs-orleans.fr/ScientificPython/">Scientific Python</a></th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="Scientific-module.html">Package&nbsp;Scientific</a> ::
<a href="Scientific.Physics-module.html">Package&nbsp;Physics</a> ::
<a href="Scientific.Physics.PhysicalQuantities-module.html">Module&nbsp;PhysicalQuantities</a> ::
Class&nbsp;PhysicalQuantity
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>]&nbsp;|&nbsp;<a href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html"
target="_top">no&nbsp;frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class PhysicalQuantity</h1><p class="nomargin-top"></p>
<p>Physical quantity with units</p>
<p>PhysicalQuantity instances allow addition, subtraction,
multiplication, and division with each other as well as multiplication,
division, and exponentiation with numbers. Addition and subtraction check
that the units of the two operands are compatible and return the result
in the units of the first operand. A limited set of mathematical
functions (from module Numeric) is applicable as well:</p>
<ul>
<li>
sqrt: equivalent to exponentiation with 0.5.
</li>
<li>
sin, cos, tan: applicable only to objects whose unit is compatible
with 'rad'.
</li>
</ul>
<p>See the documentation of the PhysicalQuantities module for a list of
the available units.</p>
<p>Here is an example on usage:</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> PhysicalQuantities <span class="py-keyword">import</span> PhysicalQuantity <span class="py-keyword">as</span> p <span class="py-comment"># short hand</span>
<span class="py-prompt">&gt;&gt;&gt; </span>distance1 = p(<span class="py-string">'10 m'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>distance2 = p(<span class="py-string">'10 km'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>total = distance1 + distance2
<span class="py-prompt">&gt;&gt;&gt; </span>total
<span class="py-output">PhysicalQuantity(10010.0,'m')</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>total.convertToUnit(<span class="py-string">'km'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>total.getValue()
<span class="py-output">10.01</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>total.getUnitName()
<span class="py-output">'km'</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>total = total.inBaseUnits()
<span class="py-prompt">&gt;&gt;&gt; </span>total
<span class="py-output">PhysicalQuantity(10010.0,'m')</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>
<span class="py-prompt">&gt;&gt;&gt; </span>t = p(314159., <span class="py-string">'s'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-comment"># convert to days, hours, minutes, and second:</span>
<span class="py-prompt">&gt;&gt;&gt; </span>t2 = t.inUnitsOf(<span class="py-string">'d'</span>,<span class="py-string">'h'</span>,<span class="py-string">'min'</span>,<span class="py-string">'s'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>t2_print = <span class="py-string">' '</span>.join([str(i) <span class="py-keyword">for</span> i <span class="py-keyword">in</span> t2])
<span class="py-prompt">&gt;&gt;&gt; </span>t2_print
<span class="py-output">'3.0 d 15.0 h 15.0 min 59.0 s'</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>
<span class="py-prompt">&gt;&gt;&gt; </span>e = p(<span class="py-string">'2.7 Hartree*Nav'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>e.convertToUnit(<span class="py-string">'kcal/mol'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>e
<span class="py-output">PhysicalQuantity(1694.2757596034764,'kcal/mol')</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>e = e.inBaseUnits()
<span class="py-prompt">&gt;&gt;&gt; </span>str(e)
<span class="py-output">'7088849.77818 kg*m**2/s**2/mol'</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt; </span>
<span class="py-prompt">&gt;&gt;&gt; </span>freeze = p(<span class="py-string">'0 degC'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>freeze = freeze.inUnitsOf (<span class="py-string">'degF'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>str(freeze)
<span class="py-output">'32.0 degF'</span>
<span class="py-output"></span><span class="py-prompt">&gt;&gt;&gt;</span></pre>
<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td align="left" colspan="2" class="table-header">
<span class="table-header">Instance Methods</span></td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__abs__"></a><span class="summary-sig-name">__abs__</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__add__"></a><span class="summary-sig-name">__add__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__cmp__"></a><span class="summary-sig-name">__cmp__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__div__"></a><span class="summary-sig-name">__div__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">*args</span>)</span><br />
There are two constructor calling patterns:</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__mul__"></a><span class="summary-sig-name">__mul__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__neg__"></a><span class="summary-sig-name">__neg__</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__nonzero__"></a><span class="summary-sig-name">__nonzero__</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__pos__"></a><span class="summary-sig-name">__pos__</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__pow__"></a><span class="summary-sig-name">__pow__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__radd__"></a><span class="summary-sig-name">__radd__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__rdiv__"></a><span class="summary-sig-name">__rdiv__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__repr__"></a><span class="summary-sig-name">__repr__</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__rmul__"></a><span class="summary-sig-name">__rmul__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__rpow__"></a><span class="summary-sig-name">__rpow__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__rsub__"></a><span class="summary-sig-name">__rsub__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__str__"></a><span class="summary-sig-name">__str__</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__sub__"></a><span class="summary-sig-name">__sub__</span>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">other</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#convertToUnit" class="summary-sig-name">convertToUnit</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">unit</span>)</span><br />
Change the unit and adjust the value such that the combination is
equivalent to the original one.</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="cos"></a><span class="summary-sig-name">cos</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="getUnitName"></a><span class="summary-sig-name">getUnitName</span>(<span class="summary-sig-arg">self</span>)</span><br />
Return unit (string) of physical quantity.</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="getValue"></a><span class="summary-sig-name">getValue</span>(<span class="summary-sig-arg">self</span>)</span><br />
Return value (float) of physical quantity (no unit).</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"><a
href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html"
class="link">PhysicalQuantity</a></span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#inBaseUnits" class="summary-sig-name">inBaseUnits</a>(<span class="summary-sig-arg">self</span>)</span><br />
Returns:
the same quantity converted to base units, i.e.</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"><a
href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html"
class="link">PhysicalQuantity</a> or <code>tuple</code> of <a
href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html"
class="link">PhysicalQuantity</a></span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#inUnitsOf" class="summary-sig-name">inUnitsOf</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">*units</span>)</span><br />
Express the quantity in different units.</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"><code>bool</code></span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#isCompatible" class="summary-sig-name">isCompatible</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">unit</span>)</span><br />
Returns:
<code>True</code> if the specified unit is compatible with the one of
the quantity</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="sin"></a><span class="summary-sig-name">sin</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="sqrt"></a><span class="summary-sig-name">sqrt</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">&nbsp;</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="tan"></a><span class="summary-sig-name">tan</span>(<span class="summary-sig-arg">self</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td align="left" colspan="2" class="table-header">
<span class="table-header">Method Details</span></td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">*args</span>)</span>
<br /><em class="fname">(Constructor)</em>
</h3>
</td><td align="right" valign="top"
>&nbsp;
</td>
</tr></table>
<p>There are two constructor calling patterns:</p>
<ol start="1">
<li>
PhysicalQuantity(value, unit), where value is any number and unit is
a string defining the unit
</li>
<li>
PhysicalQuantity(value_with_unit), where value_with_unit is a string
that contains both the value and the unit, i.e. '1.5 m/s'. This form
is provided for more convenient interactive use.
</li>
</ol>
<dl class="fields">
<dt>Parameters:</dt>
<dd><ul class="nomargin-top">
<li><strong class="pname"><code>args</code></strong> ((number, <code>str</code>) or (<code>str</code>,)) - either (value, unit) or (value_with_unit,)</li>
</ul></dd>
</dl>
</td></tr></table>
</div>
<a name="convertToUnit"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">convertToUnit</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">unit</span>)</span>
</h3>
</td><td align="right" valign="top"
>&nbsp;
</td>
</tr></table>
<p>Change the unit and adjust the value such that the combination is
equivalent to the original one. The new unit must be compatible with the
previous unit of the object.</p>
<dl class="fields">
<dt>Parameters:</dt>
<dd><ul class="nomargin-top">
<li><strong class="pname"><code>unit</code></strong> (<code>str</code>) - a unit</li>
</ul></dd>
<dt>Raises:</dt>
<dd><ul class="nomargin-top">
<li><code><strong class='fraise'>TypeError</strong></code> - if the unit string is not a know unit or a unit incompatible with
the current one</li>
</ul></dd>
</dl>
</td></tr></table>
</div>
<a name="inBaseUnits"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">inBaseUnits</span>(<span class="sig-arg">self</span>)</span>
</h3>
</td><td align="right" valign="top"
>&nbsp;
</td>
</tr></table>
<dl class="fields">
<dt>Returns: <a
href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html"
class="link">PhysicalQuantity</a></dt>
<dd>the same quantity converted to base units, i.e. SI units in most
cases</dd>
</dl>
</td></tr></table>
</div>
<a name="inUnitsOf"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">inUnitsOf</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">*units</span>)</span>
</h3>
</td><td align="right" valign="top"
>&nbsp;
</td>
</tr></table>
<p>Express the quantity in different units. If one unit is specified, a
new PhysicalQuantity object is returned that expresses the quantity in
that unit. If several units are specified, the return value is a tuple of
PhysicalObject instances with with one element per unit such that the sum
of all quantities in the tuple equals the the original quantity and all
the values except for the last one are integers. This is used to convert
to irregular unit systems like hour/minute/second.</p>
<dl class="fields">
<dt>Parameters:</dt>
<dd><ul class="nomargin-top">
<li><strong class="pname"><code>units</code></strong> (<code>str</code> or sequence of <code>str</code>) - one or several units</li>
</ul></dd>
<dt>Returns: <a
href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html"
class="link">PhysicalQuantity</a> or <code>tuple</code> of <a
href="Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html"
class="link">PhysicalQuantity</a></dt>
<dd>one or more physical quantities</dd>
<dt>Raises:</dt>
<dd><ul class="nomargin-top">
<li><code><strong class='fraise'>TypeError</strong></code> - if any of the specified units are not compatible with the original
unit</li>
</ul></dd>
</dl>
</td></tr></table>
</div>
<a name="isCompatible"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">isCompatible</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">unit</span>)</span>
</h3>
</td><td align="right" valign="top"
>&nbsp;
</td>
</tr></table>
<dl class="fields">
<dt>Parameters:</dt>
<dd><ul class="nomargin-top">
<li><strong class="pname"><code>unit</code></strong> (<code>str</code>) - a unit</li>
</ul></dd>
<dt>Returns: <code>bool</code></dt>
<dd><code>True</code> if the specified unit is compatible with the
one of the quantity</dd>
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="Scientific-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Tree link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Index link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Help link -->
<th>&nbsp;&nbsp;&nbsp;<a
href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://dirac.cnrs-orleans.fr/ScientificPython/">Scientific Python</a></th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0 on Tue Oct 28 14:16:07 2008
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
// -->
</script>
</body>
</html>