Index: _modules/sas/plottools/unitConverter.html
===================================================================
--- _modules/sas/plottools/unitConverter.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
+++ _modules/sas/plottools/unitConverter.html	(revision a462c6a6616628a6536b55fc2886d9ab1224149a)
@@ -0,0 +1,176 @@
+<!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>sas.plottools.unitConverter &mdash; SasView 3.0.0 documentation</title>
+    
+    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
+    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
+    
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    '../../../',
+        VERSION:     '3.0.0',
+        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="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+    <link rel="top" title="SasView 3.0.0 documentation" href="../../../index.html" />
+    <link rel="up" title="Module code" href="../../index.html" /> 
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../index.html" accesskey="U">Module code</a> &raquo;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body">
+            
+  <h1>Source code for sas.plottools.unitConverter</h1><div class="highlight"><pre>
+<span class="kn">import</span> <span class="nn">re</span>
+<span class="kn">import</span> <span class="nn">string</span>
+<span class="c">#Input   -&gt;  new scale  -&gt;  Output</span>
+
+<span class="n">unit1</span> <span class="o">=</span> <span class="s">&quot;A^{-1} &quot;</span>  <span class="c">#             x                    A^{-1}</span>
+<span class="n">unit2</span> <span class="o">=</span> <span class="s">&quot;A&quot;</span>  <span class="c">#                   x                     A</span>
+<span class="n">unit3</span> <span class="o">=</span> <span class="s">&quot;A&quot;</span>  <span class="c">#                   x^2                  A^{2}</span>
+<span class="n">unit4</span> <span class="o">=</span> <span class="s">&quot;A &quot;</span>  <span class="c">#                  1/x                  A^{-1}</span>
+<span class="n">unit5</span> <span class="o">=</span> <span class="s">&quot;A^{0.5} &quot;</span>  <span class="c">#        x^2                      A</span>
+<span class="n">unit9</span> <span class="o">=</span> <span class="s">&quot;m^{1/2}&quot;</span>  <span class="c">#         x^2               m</span>
+
+<span class="c">#If you don&#39;t recognize the pattern, give up</span>
+<span class="c"># and just put some parentheses around the unit and write the transoformation:</span>
+
+<span class="n">unit6</span> <span class="o">=</span> <span class="s">&quot;m/s&quot;</span>  <span class="c">#                x^2               (m/s)^{2}</span>
+<span class="n">unit7</span> <span class="o">=</span> <span class="s">&quot;m/s^{2}&quot;</span>  <span class="c">#         1/x                 (m/s^{2})^{-1}</span>
+<span class="n">unit8</span> <span class="o">=</span> <span class="s">&quot;m/s^{4}&quot;</span>  <span class="c">#         x^2               (m/s^{4})^{2}</span>
+
+
+<div class="viewcode-block" id="UnitConvertion"><a class="viewcode-back" href="../../../dev/api/sas.plottools.html#sas.plottools.unitConverter.UnitConvertion">[docs]</a><span class="k">def</span> <span class="nf">UnitConvertion</span><span class="p">(</span><span class="nb">pow</span><span class="p">,</span> <span class="n">unit</span><span class="p">):</span>
+    <span class="sd">&quot;&quot;&quot;</span>
+<span class="sd">    &quot;&quot;&quot;</span>
+    <span class="k">if</span> <span class="nb">pow</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">:</span>
+        <span class="k">if</span> <span class="n">string</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="s">&quot;^&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>  <span class="c"># if the unit contains a power ^</span>
+            <span class="n">unitSplitted</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;\^&quot;</span><span class="p">,</span> <span class="n">unit</span><span class="p">)</span>
+            <span class="k">if</span> <span class="n">string</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">unitSplitted</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&quot;/&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span> <span class="ow">or</span>\
+                <span class="n">string</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">unitSplitted</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&quot;-&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span> <span class="p">:</span>  <span class="c"># find slash /</span>
+                <span class="k">if</span> <span class="nb">pow</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
+                    <span class="n">unit</span> <span class="o">=</span> <span class="n">unit</span>
+                <span class="k">else</span><span class="p">:</span>
+                    <span class="n">unit</span> <span class="o">=</span> <span class="s">&quot;(&quot;</span><span class="o">+</span><span class="n">unit</span><span class="o">+</span><span class="s">&quot;)&quot;</span> <span class="o">+</span> <span class="s">&quot;^{&quot;</span><span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="nb">pow</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;}&quot;</span>
+            <span class="k">else</span><span class="p">:</span>
+                <span class="k">if</span> <span class="n">string</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">unitSplitted</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="s">&quot;{&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>  <span class="c"># if found a {</span>
+                    <span class="n">findPower</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;{&quot;</span><span class="p">,</span> <span class="n">unitSplitted</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                    <span class="k">if</span> <span class="n">string</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">findPower</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="s">&quot;}&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>  <span class="c"># found }</span>
+                        <span class="n">unitPower</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;}&quot;</span><span class="p">,</span> <span class="n">findPower</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                        <span class="k">if</span><span class="p">(</span><span class="n">string</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">unitPower</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&quot;.&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">):</span>
+                            <span class="n">power</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">unitPower</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">*</span> <span class="nb">pow</span>
+                        <span class="k">elif</span><span class="p">(</span><span class="n">string</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">unitPower</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&quot;/&quot;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">):</span>
+                            <span class="c">#power is a float</span>
+                            <span class="n">poweSplitted</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&quot;/&quot;</span><span class="p">,</span> <span class="n">unitPower</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
+                            <span class="n">power</span> <span class="o">=</span> <span class="nb">pow</span> <span class="o">*</span> <span class="nb">int</span><span class="p">(</span><span class="n">poweSplitted</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>\
+                                         <span class="o">/</span><span class="nb">int</span><span class="p">(</span><span class="n">poweSplitted</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">power</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">unitPower</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">*</span> <span class="nb">pow</span>
+                       
+                        <span class="k">if</span> <span class="n">power</span> <span class="o">==</span> <span class="mf">1.0</span><span class="p">:</span>
+                            <span class="n">unit</span> <span class="o">=</span> <span class="n">unitSplitted</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
+                        <span class="k">elif</span> <span class="n">power</span> <span class="o">==</span> <span class="mf">0.5</span><span class="p">:</span>
+                            <span class="n">unit</span> <span class="o">=</span> <span class="n">unitSplitted</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot;^{1/2}&quot;</span>
+                        <span class="k">elif</span> <span class="n">power</span> <span class="o">==</span> <span class="o">-</span><span class="mf">0.5</span><span class="p">:</span>
+                            <span class="n">unit</span> <span class="o">=</span> <span class="n">unitSplitted</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot;^{-1/2}&quot;</span>
+                        <span class="k">else</span><span class="p">:</span>
+                            <span class="n">unit</span> <span class="o">=</span> <span class="n">unitSplitted</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot;^{&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">power</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;}&quot;</span>
+                <span class="k">else</span><span class="p">:</span>
+                     <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;missing } in unit expression&quot;</span>
+        <span class="k">else</span><span class="p">:</span>  <span class="c"># no power</span>
+            <span class="k">if</span>  <span class="nb">pow</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
+                <span class="n">unit</span> <span class="o">=</span> <span class="s">&quot;(&quot;</span> <span class="o">+</span> <span class="n">unit</span> <span class="o">+</span> <span class="s">&quot;)&quot;</span> <span class="o">+</span> <span class="s">&quot;^{&quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="nb">pow</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;}&quot;</span>
+    <span class="k">else</span><span class="p">:</span>
+        <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">,</span> <span class="s">&quot;empty unit ,enter a power different from zero&quot;</span>
+    <span class="k">return</span> <span class="n">unit</span>
+
+</div>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&quot;__main__&quot;</span><span class="p">:</span> 
+    <span class="k">print</span> <span class="s">&quot;this unit1 </span><span class="si">%s</span><span class="s"> ,its power </span><span class="si">%s</span><span class="s"> , and value </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">unit1</span><span class="p">,</span>
+                                                <span class="mi">1</span><span class="p">,</span> <span class="n">UnitConvertion</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit1</span><span class="p">))</span>
+    <span class="k">print</span> <span class="s">&quot;this unit2 </span><span class="si">%s</span><span class="s"> ,its power </span><span class="si">%s</span><span class="s"> , and value </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">unit2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span>
+                                                <span class="n">UnitConvertion</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit2</span><span class="p">))</span>
+    <span class="k">print</span> <span class="s">&quot;this unit3 </span><span class="si">%s</span><span class="s"> ,its power </span><span class="si">%s</span><span class="s"> , and value </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">unit3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span>
+                                                    <span class="n">UnitConvertion</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">unit3</span><span class="p">))</span>
+    <span class="k">print</span> <span class="s">&quot;this unit4 </span><span class="si">%s</span><span class="s"> ,its power </span><span class="si">%s</span><span class="s"> , and value </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">unit4</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                <span class="n">UnitConvertion</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit4</span><span class="p">))</span>
+    <span class="k">print</span> <span class="s">&quot;this unit5 </span><span class="si">%s</span><span class="s"> ,its power </span><span class="si">%s</span><span class="s"> , and value </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">unit5</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span>
+                                                    <span class="n">UnitConvertion</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">unit5</span><span class="p">))</span>
+    <span class="k">print</span> <span class="s">&quot;this unit6 </span><span class="si">%s</span><span class="s"> ,its power </span><span class="si">%s</span><span class="s"> , and value </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">unit6</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span>
+                                                    <span class="n">UnitConvertion</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">unit6</span><span class="p">))</span>
+    <span class="k">print</span> <span class="s">&quot;this unit7 </span><span class="si">%s</span><span class="s"> ,its power </span><span class="si">%s</span><span class="s"> , and value </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">unit7</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span>
+                                                    <span class="n">UnitConvertion</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">unit7</span><span class="p">))</span>
+    <span class="k">print</span> <span class="s">&quot;this unit8 </span><span class="si">%s</span><span class="s"> ,its power </span><span class="si">%s</span><span class="s"> , and value </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">unit8</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span>
+                                                    <span class="n">UnitConvertion</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">unit8</span><span class="p">))</span>
+    <span class="k">print</span> <span class="s">&quot;this unit9 </span><span class="si">%s</span><span class="s"> ,its power </span><span class="si">%s</span><span class="s"> , and value </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">unit9</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span>
+                                                    <span class="n">UnitConvertion</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">unit9</span><span class="p">))</span>
+</pre></div>
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+<div id="searchbox" style="display: none">
+  <h3>Quick search</h3>
+    <form class="search" action="../../../search.html" method="get">
+      <input type="text" name="q" />
+      <input type="submit" value="Go" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+    <p class="searchtip" style="font-size: 90%">
+    Enter search terms or a module, class or function name.
+    </p>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="../../../genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="../../../py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li><a href="../../../index.html">SasView 3.0.0 documentation</a> &raquo;</li>
+          <li><a href="../../index.html" >Module code</a> &raquo;</li> 
+      </ul>
+    </div>
+    <div class="footer">
+        &copy; Copyright 2013, The SasView Project.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
+    </div>
+  </body>
+</html>
