This file is indexed.

/usr/share/doc/python-brian-doc/docs/reference-units.html is in python-brian-doc 1.3.1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!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>Units system &mdash; Brian v1.3.1 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:     '1.3.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </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>
    <link rel="top" title="Brian v1.3.1 documentation" href="index.html" />
    <link rel="up" title="Reference" href="reference.html" />
    <link rel="next" title="Clocks" href="reference-clocks.html" />
    <link rel="prev" title="SciPy, NumPy and PyLab" href="reference-scipy.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="reference-clocks.html" title="Clocks"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="reference-scipy.html" title="SciPy, NumPy and PyLab"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Brian v1.3.1 documentation</a> &raquo;</li>
          <li><a href="reference.html" accesskey="U">Reference</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="units-system">
<span id="index-0"></span><h1>Units system<a class="headerlink" href="#units-system" title="Permalink to this headline"></a></h1>
<dl class="function">
<dt id="brian.have_same_dimensions">
<tt class="descclassname">brian.</tt><tt class="descname">have_same_dimensions</tt><big>(</big><em>obj1</em>, <em>obj2</em><big>)</big><a class="headerlink" href="#brian.have_same_dimensions" title="Permalink to this definition"></a></dt>
<dd><p>Tests if two scalar values have the same dimensions, returns a <tt class="docutils literal"><span class="pre">bool</span></tt>.</p>
<p>Note that the syntax may change in later releases of Brian, with tighter
integration of scalar and array valued quantities.</p>
</dd></dl>

<dl class="function">
<dt id="brian.is_dimensionless">
<tt class="descclassname">brian.</tt><tt class="descname">is_dimensionless</tt><big>(</big><em>obj</em><big>)</big><a class="headerlink" href="#brian.is_dimensionless" title="Permalink to this definition"></a></dt>
<dd><p>Tests if a scalar value is dimensionless or not, returns a <tt class="docutils literal"><span class="pre">bool</span></tt>.</p>
<p>Note that the syntax may change in later releases of Brian, with tighter
integration of scalar and array valued quantities.</p>
</dd></dl>

<span class="target" id="index-1"></span><dl class="exception">
<dt id="brian.DimensionMismatchError">
<em class="property">exception </em><tt class="descclassname">brian.</tt><tt class="descname">DimensionMismatchError</tt><big>(</big><em>description</em>, <em>*dims</em><big>)</big><a class="headerlink" href="#brian.DimensionMismatchError" title="Permalink to this definition"></a></dt>
<dd><p>Exception class for attempted operations with inconsistent dimensions</p>
<p>For example, <tt class="docutils literal"><span class="pre">3*mvolt</span> <span class="pre">+</span> <span class="pre">2*amp</span></tt> raises this exception. The purpose of this
class is to help catch errors based on incorrect units. The exception will
print a representation of the dimensions of the two inconsistent objects
that were operated on. If you want to check for inconsistent units in your
code, do something like:</p>
<div class="highlight-python"><pre>try:
    ...
    your code here
    ...
except DimensionMismatchError, inst:
    ...
    cleanup code here, e.g.
    print "Found dimension mismatch, details:", inst
    ...</pre>
</div>
</dd></dl>

<dl class="function">
<dt id="brian.check_units">
<tt class="descclassname">brian.</tt><tt class="descname">check_units</tt><big>(</big><em>**au</em><big>)</big><a class="headerlink" href="#brian.check_units" title="Permalink to this definition"></a></dt>
<dd><p>Decorator to check units of arguments passed to a function</p>
<p><strong>Sample usage:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="nd">@check_units</span><span class="p">(</span><span class="n">I</span><span class="o">=</span><span class="n">amp</span><span class="p">,</span><span class="n">R</span><span class="o">=</span><span class="n">ohm</span><span class="p">,</span><span class="n">wibble</span><span class="o">=</span><span class="n">metre</span><span class="p">,</span><span class="n">result</span><span class="o">=</span><span class="n">volt</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">getvoltage</span><span class="p">(</span><span class="n">I</span><span class="p">,</span><span class="n">R</span><span class="p">,</span><span class="o">**</span><span class="n">k</span><span class="p">):</span>
    <span class="k">return</span> <span class="n">I</span><span class="o">*</span><span class="n">R</span>
</pre></div>
</div>
<p>You don&#8217;t have to check the units of every variable in the function, and
you can define what the units should be for variables that aren&#8217;t
explicitly named in the definition of the function. For example, the code
above checks that the variable wibble should be a length, so writing:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">getvoltage</span><span class="p">(</span><span class="mi">1</span><span class="o">*</span><span class="n">amp</span><span class="p">,</span><span class="mi">1</span><span class="o">*</span><span class="n">ohm</span><span class="p">,</span><span class="n">wibble</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<p>would fail, but:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">getvoltage</span><span class="p">(</span><span class="mi">1</span><span class="o">*</span><span class="n">amp</span><span class="p">,</span><span class="mi">1</span><span class="o">*</span><span class="n">ohm</span><span class="p">,</span><span class="n">wibble</span><span class="o">=</span><span class="mi">1</span><span class="o">*</span><span class="n">metre</span><span class="p">)</span>
</pre></div>
</div>
<p>would pass.
String arguments are not checked (e.g. <tt class="docutils literal"><span class="pre">getvoltage(wibble='hello')</span></tt> would pass).</p>
<p>The special name <tt class="docutils literal"><span class="pre">result</span></tt> is for the return value of the function.</p>
<p>An error in the input value raises a <a class="reference internal" href="#brian.DimensionMismatchError" title="brian.DimensionMismatchError"><tt class="xref py py-exc docutils literal"><span class="pre">DimensionMismatchError</span></tt></a>, and an error
in the return value raises an <tt class="docutils literal"><span class="pre">AssertionError</span></tt> (because it is a code
problem rather than a value problem).</p>
<p><strong>Notes</strong></p>
<p>This decorator will destroy the signature of the original function, and
replace it with the signature <tt class="docutils literal"><span class="pre">(*args,</span> <span class="pre">**kwds)</span></tt>. Other decorators will
do the same thing, and this decorator critically needs to know the signature
of the function it is acting on, so it is important that it is the first
decorator to act on a function. It cannot be used in combination with another
decorator that also needs to know the signature of the function.</p>
</dd></dl>

<p>Typically, you shouldn&#8217;t need to use any details about the following
two classes, and their implementations are subject to change in
future releases of Brian.</p>
<dl class="class">
<dt id="brian.Quantity">
<em class="property">class </em><tt class="descclassname">brian.</tt><tt class="descname">Quantity</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#brian.Quantity" title="Permalink to this definition"></a></dt>
<dd><p>A number with an associated physical dimension.</p>
<p>In most cases, it is not necessary to create a <a class="reference internal" href="#brian.Quantity" title="brian.Quantity"><tt class="xref py py-class docutils literal"><span class="pre">Quantity</span></tt></a> object
by hand, instead use the constant unit names <tt class="docutils literal"><span class="pre">second</span></tt>, <tt class="docutils literal"><span class="pre">kilogram</span></tt>,
etc. The details of how <a class="reference internal" href="#brian.Quantity" title="brian.Quantity"><tt class="xref py py-class docutils literal"><span class="pre">Quantity</span></tt></a> objects work is subject to
change in future releases of Brian, as we plan to reimplement it
in a more efficient manner, more tightly integrated with numpy. The
following can be safely used:</p>
<ul class="simple">
<li><a class="reference internal" href="#brian.Quantity" title="brian.Quantity"><tt class="xref py py-class docutils literal"><span class="pre">Quantity</span></tt></a>, this name will not change, and the usage
<tt class="docutils literal"><span class="pre">isinstance(x,Quantity)</span></tt> should be safe.</li>
<li>The standard unit objects, <tt class="docutils literal"><span class="pre">second</span></tt>, <tt class="docutils literal"><span class="pre">kilogram</span></tt>, etc.
documented in the main documentation will not be subject
to change (as they are based on SI standardisation).</li>
<li>Scalar arithmetic will work with future implementations.</li>
</ul>
</dd></dl>

<dl class="class">
<dt id="brian.Unit">
<em class="property">class </em><tt class="descclassname">brian.</tt><tt class="descname">Unit</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#brian.Unit" title="Permalink to this definition"></a></dt>
<dd><p>A physical unit</p>
<p>Normally, you do not need to worry about the implementation of
units. They are derived from the <a class="reference internal" href="#brian.Quantity" title="brian.Quantity"><tt class="xref py py-class docutils literal"><span class="pre">Quantity</span></tt></a> object with
some additional information (name and string representation).
You can define new units which will be used when generating
string representations of quantities simply by doing an
arithmetical operation with only units, for example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">Nm</span> <span class="o">=</span> <span class="n">newton</span> <span class="o">*</span> <span class="n">metre</span>
</pre></div>
</div>
<p>Note that operations with units are slower than operations with
<a class="reference internal" href="#brian.Quantity" title="brian.Quantity"><tt class="xref py py-class docutils literal"><span class="pre">Quantity</span></tt></a> objects, so for efficiency if you do not need the
extra information that a <a class="reference internal" href="#brian.Unit" title="brian.Unit"><tt class="xref py py-class docutils literal"><span class="pre">Unit</span></tt></a> object carries around, write
<tt class="docutils literal"><span class="pre">1*second</span></tt> in preference to <tt class="docutils literal"><span class="pre">second</span></tt>.</p>
</dd></dl>

<span class="target" id="index-2"></span></div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/brian-logo.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="reference-scipy.html"
                        title="previous chapter">SciPy, NumPy and PyLab</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="reference-clocks.html"
                        title="next chapter">Clocks</a></p>
<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="reference-clocks.html" title="Clocks"
             >next</a> |</li>
        <li class="right" >
          <a href="reference-scipy.html" title="SciPy, NumPy and PyLab"
             >previous</a> |</li>
        <li><a href="index.html">Brian v1.3.1 documentation</a> &raquo;</li>
          <li><a href="reference.html" >Reference</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2008, Romain Brette, Dan Goodman.
      Last updated on Feb 19, 2012.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.
    </div>
  </body>
</html>