Skip to content

Commit

Permalink
Add extended usage
Browse files Browse the repository at this point in the history
  • Loading branch information
gabbpuy committed Jul 18, 2015
1 parent 386fdcf commit 1be0a4a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,41 @@ Units.RealWorld to configure prefixes that aren't normally used.
4.0 m
</code>
</pre>
Unit.Units defines SI units, which are looked up by symbol.

<pre>
<code lang=python>
>>> q = Quantity(1.0, "MV")
>>> q
1.0 MV
>>> q = Quantity(1000000, 'V')
>>> q
1.0 MV
>>> q.to('V')
1000000.0
</code>
</pre>
Many simple conversions are also provided

<pre>
<code lang=python>
>>> volts = Quantity(10, 'V')
>>> amps = Quantity(100, 'A')
>>> volts * amps
1.0 kW
>>> volts / amps
100.0 mΩ
</code>
</pre>
You can define your own units. We can get frames per second by defining frames.

<pre>
<code lang=python>
>>> frame = Unit.Unit('f', "frame")
>>> frames = Quantity(432000, "frame")
>>> runningTime = Quantity(120 * 60, 's')
>>> fps = frames / runningTime
>>> fps
60.0 f/s
</code>
</python>

0 comments on commit 1be0a4a

Please sign in to comment.