ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/osprai/osprai/trunk/sphinx/_build/html/mainapi.html
Revision: 54
Committed: Wed Feb 16 21:29:02 2011 UTC (8 years, 8 months ago) by clausted
File size: 62655 byte(s)
Log Message:
Added fit_module and mdl_module to sphinx documentation.
Line User Rev File contents
1 clausted 53 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3    
4     <html xmlns="http://www.w3.org/1999/xhtml">
5     <head>
6     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7    
8 clausted 54 <title>The Application Program Interface &mdash; osprai-doc v0.5-110215 documentation</title>
9 clausted 53 <link rel="stylesheet" href="_static/default.css" type="text/css" />
10     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
11     <script type="text/javascript">
12     var DOCUMENTATION_OPTIONS = {
13     URL_ROOT: '#',
14 clausted 54 VERSION: '0.5-110215',
15 clausted 53 COLLAPSE_MODINDEX: false,
16     FILE_SUFFIX: '.html',
17     HAS_SOURCE: true
18     };
19     </script>
20     <script type="text/javascript" src="_static/jquery.js"></script>
21     <script type="text/javascript" src="_static/doctools.js"></script>
22 clausted 54 <link rel="top" title="osprai-doc v0.5-110215 documentation" href="index.html" />
23 clausted 53 <link rel="prev" title="OSPRAI Tutorial 1" href="tutorial01.html" />
24     </head>
25     <body>
26     <div class="related">
27     <h3>Navigation</h3>
28     <ul>
29     <li class="right" style="margin-right: 10px">
30     <a href="genindex.html" title="General Index"
31     accesskey="I">index</a></li>
32     <li class="right" >
33     <a href="modindex.html" title="Global Module Index"
34     accesskey="M">modules</a> |</li>
35     <li class="right" >
36     <a href="tutorial01.html" title="OSPRAI Tutorial 1"
37     accesskey="P">previous</a> |</li>
38 clausted 54 <li><a href="index.html">osprai-doc v0.5-110215 documentation</a> &raquo;</li>
39 clausted 53 </ul>
40     </div>
41    
42     <div class="document">
43     <div class="documentwrapper">
44     <div class="bodywrapper">
45     <div class="body">
46    
47     <div class="section" id="the-application-program-interface">
48     <h1>The Application Program Interface<a class="headerlink" href="#the-application-program-interface" title="Permalink to this headline">¶</a></h1>
49     <p>The Osprai API is the set of public functions and classes contained in the <tt class="docutils literal"><span class="pre">osprai_one</span></tt> module.
50     The API provides an interface to the software from a python command line, such as <a class="reference external" href="http://ipython.scipy.org/moin/">IPython</a>.
51     In the future, web or desktop graphical user interfaces could be written using this API to assist SPR users with common data anaylsis procedures.</p>
52 clausted 54 <p>To use Osprai, set your Python path environment variable to the location where it is installed.
53     This can be done from the shell (bash example):</p>
54     <div class="highlight-python"><pre>$ export PYTHONPATH=/home/user/osprai/trunk
55     $ ipython</pre>
56 clausted 53 </div>
57 clausted 54 <p>Alternatively, the path can be set from inside the Python interpreter (IPython example):</p>
58     <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sys</span>
59     <span class="gp">&gt;&gt;&gt; </span><span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s">&#39;/home/user/osprai/trunk&#39;</span><span class="p">)</span>
60     <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">osprai_one</span> <span class="kn">as</span> <span class="nn">osp</span>
61     <span class="gp">&gt;&gt;&gt; </span><span class="n">help</span> <span class="n">osp</span>
62     </pre></div>
63     </div>
64     </div>
65     <div class="section" id="module-fit_module">
66     <h1>The Python Source Code<a class="headerlink" href="#module-fit_module" title="Permalink to this headline">¶</a></h1>
67 clausted 53 <div class="section" id="ba-class">
68     <h2>ba_class<a class="headerlink" href="#ba-class" title="Permalink to this headline">¶</a></h2>
69     <p>Biosensor Array class for storing SPRI data.
70     This contains an array of SPR sensorgrams with their
71     associated models and parameters.
72     This can also contain the microarray geometery.</p>
73     <p>Examples:</p>
74     <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span> <span class="o">=</span> <span class="n">BiosensorArray</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span><span class="mi">1500</span><span class="p">)</span> <span class="c">## Allocate object with 800 spots of 1500 time points.</span>
75     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span><span class="o">.</span><span class="n">roi</span><span class="p">[</span><span class="mi">799</span><span class="p">]</span><span class="o">.</span><span class="n">time</span><span class="p">[</span><span class="mi">1499</span><span class="p">]</span> <span class="o">=</span> <span class="mf">7502.1</span> <span class="c">## Set time in seconds.</span>
76     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span><span class="o">.</span><span class="n">roi</span><span class="p">[</span><span class="mi">799</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">[</span><span class="mi">1499</span><span class="p">]</span> <span class="o">=</span> <span class="mf">0.50</span> <span class="c">## Set SPR reflectance signal. </span>
77     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span><span class="o">.</span><span class="n">roi</span><span class="p">[</span><span class="mi">799</span><span class="p">]</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s">&quot;anti-IgG&quot;</span> <span class="c">## Set name of microarray feature.</span>
78     </pre></div>
79     </div>
80     <dl class="class">
81     <dt id="ba_class.BiosensorArray">
82     <em class="property">class </em><tt class="descclassname">ba_class.</tt><tt class="descname">BiosensorArray</tt><big>(</big><em>roi_size</em>, <em>datapoint_size</em><big>)</big><a class="headerlink" href="#ba_class.BiosensorArray" title="Permalink to this definition">¶</a></dt>
83     <dd><p>The Biosensor Array class holds all ROIs (spots)
84     from an SPRI microarray run.</p>
85     <table border="1" class="docutils">
86     <colgroup>
87     <col width="23%" />
88     <col width="21%" />
89     <col width="56%" />
90     </colgroup>
91     <tbody valign="top">
92     <tr><td>Property</td>
93     <td>Type</td>
94     <td>Description</td>
95     </tr>
96     <tr><td>roi</td>
97     <td>list of object</td>
98     <td>List of RegOfInterest objects.</td>
99     </tr>
100     <tr><td>rois</td>
101     <td>integer</td>
102     <td>Size of roi (Number of ROIs).</td>
103     </tr>
104     <tr><td>dpoints</td>
105     <td>integer</td>
106     <td>Number of datapoints in each ROI.</td>
107     </tr>
108     <tr><td>primarydatafiles</td>
109     <td>list of string</td>
110     <td>List of file names.</td>
111     </tr>
112     <tr><td>comments</td>
113     <td>list of string</td>
114     <td>List of comments regarding experiments.</td>
115     </tr>
116     </tbody>
117     </table>
118     <dl class="method">
119     <dt id="ba_class.BiosensorArray.set_plot_all">
120     <tt class="descname">set_plot_all</tt><big>(</big><big>)</big><a class="headerlink" href="#ba_class.BiosensorArray.set_plot_all" title="Permalink to this definition">¶</a></dt>
121     <dd>Choose to plot every sensorgram.</dd></dl>
122    
123     <dl class="method">
124     <dt id="ba_class.BiosensorArray.set_plot_list">
125     <tt class="descname">set_plot_list</tt><big>(</big><em>ilist</em><big>)</big><a class="headerlink" href="#ba_class.BiosensorArray.set_plot_list" title="Permalink to this definition">¶</a></dt>
126     <dd>Choose a list of sensorgrams to plot</dd></dl>
127    
128     <dl class="method">
129     <dt id="ba_class.BiosensorArray.xy2uid">
130     <tt class="descname">xy2uid</tt><big>(</big><em>gx</em>, <em>gy</em>, <em>x</em>, <em>y</em><big>)</big><a class="headerlink" href="#ba_class.BiosensorArray.xy2uid" title="Permalink to this definition">¶</a></dt>
131     <dd>Given roi coordinates, find corresponding uid (index).</dd></dl>
132    
133     </dd></dl>
134    
135     <dl class="class">
136     <dt id="ba_class.RegOfInterest">
137     <em class="property">class </em><tt class="descclassname">ba_class.</tt><tt class="descname">RegOfInterest</tt><big>(</big><em>i</em>, <em>datapoint_size</em><big>)</big><a class="headerlink" href="#ba_class.RegOfInterest" title="Permalink to this definition">¶</a></dt>
138     <dd><p>This Region Of Interest class can hold one SPR sensorgram.</p>
139     <table border="1" class="docutils">
140     <colgroup>
141     <col width="15%" />
142     <col width="21%" />
143     <col width="63%" />
144     </colgroup>
145     <tbody valign="top">
146     <tr><td>Property</td>
147     <td>Type</td>
148     <td>Description</td>
149     </tr>
150     <tr><td>uid</td>
151     <td>integer</td>
152     <td>Unique ID integer. Never changes.</td>
153     </tr>
154     <tr><td>index</td>
155     <td>integer</td>
156     <td>Changes if ba size changes (add/remove rois).</td>
157     </tr>
158     <tr><td>time</td>
159     <td>nparray</td>
160     <td>Usually seconds.</td>
161     </tr>
162     <tr><td>value</td>
163     <td>nparray</td>
164     <td>Arbitrary units.</td>
165     </tr>
166     <tr><td>dpoints</td>
167     <td>integer</td>
168     <td>Can use for bounds checking.</td>
169     </tr>
170     <tr><td>name</td>
171     <td>string</td>
172     <td>Name of ROI.</td>
173     </tr>
174     <tr><td>desc</td>
175     <td>string</td>
176     <td>Description of ROI</td>
177     </tr>
178     <tr><td>gridx</td>
179     <td>integer</td>
180     <td>Can be Block number from GAL file.</td>
181     </tr>
182     <tr><td>gridy</td>
183     <td>integer</td>
184     <td>Unused?</td>
185     </tr>
186     <tr><td>spotx</td>
187     <td>integer</td>
188     <td>ROI column number.</td>
189     </tr>
190     <tr><td>spoty</td>
191     <td>integer</td>
192     <td>ROI row number.</td>
193     </tr>
194     <tr><td>bgroi</td>
195     <td>list of integer</td>
196     <td>One or more background ROIs.</td>
197     </tr>
198     <tr><td>calibM</td>
199     <td>float</td>
200     <td>Slope used for calibration</td>
201     </tr>
202     <tr><td>calibB</td>
203     <td>float</td>
204     <td>Intercept used for calibration.</td>
205     </tr>
206     <tr><td>plottable</td>
207     <td>boolean</td>
208     <td>Whether to plot</td>
209     </tr>
210     <tr><td>injconc</td>
211     <td>list of float</td>
212     <td>One or more analyte concentrations.</td>
213     </tr>
214     <tr><td>injstart</td>
215     <td>list of float</td>
216     <td>One or more injection start times.</td>
217     </tr>
218     <tr><td>injstop</td>
219     <td>list of float</td>
220     <td>One or more injection start times.</td>
221     </tr>
222     <tr><td>injrind</td>
223     <td>list of float</td>
224     <td>One or more expected refractive index jumps.</td>
225     </tr>
226     <tr><td>flow</td>
227     <td>float</td>
228     <td>Flowrate of injection.</td>
229     </tr>
230     <tr><td>model</td>
231     <td>ref to funct</td>
232     <td>Model describing this ROI.</td>
233     </tr>
234     <tr><td>params</td>
235     <td>dict of dict</td>
236     <td>Parameters for this model.</td>
237     </tr>
238     </tbody>
239     </table>
240     <dl class="method">
241     <dt id="ba_class.RegOfInterest.time2dp">
242     <tt class="descname">time2dp</tt><big>(</big><em>t</em><big>)</big><a class="headerlink" href="#ba_class.RegOfInterest.time2dp" title="Permalink to this definition">¶</a></dt>
243     <dd>Find datapoint closest to given time.</dd></dl>
244    
245     <dl class="method">
246     <dt id="ba_class.RegOfInterest.time2val">
247     <tt class="descname">time2val</tt><big>(</big><em>t1</em>, <em>t2</em><big>)</big><a class="headerlink" href="#ba_class.RegOfInterest.time2val" title="Permalink to this definition">¶</a></dt>
248     <dd>Return list of SPR values between t1 and t2</dd></dl>
249    
250     </dd></dl>
251    
252     </div>
253     <div class="section" id="vu-module">
254     <h2>vu_module<a class="headerlink" href="#vu-module" title="Permalink to this headline">¶</a></h2>
255     <p>This is the viewer module for SPR data in a ba_class.
256     Traces can be displayed as dotted lines, continuous lines, or combinations.
257     Typically, up to six traces are displayed at a time.
258     Features include zooming, measurements, and save-to-PNG.
259     Graphics utilize the old Tk GUI toolkit.</p>
260     <p>Examples:</p>
261     <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">vu_module</span> <span class="kn">as</span> <span class="nn">vu</span>
262     <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">io_module</span> <span class="kn">as</span> <span class="nn">io</span>
263     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">readsprit</span><span class="p">(</span><span class="s">&quot;spritdata.txt&quot;</span><span class="p">)</span>
264     <span class="gp">&gt;&gt;&gt; </span><span class="n">vu</span><span class="o">.</span><span class="n">dotgraph</span><span class="p">(</span><span class="n">ba1</span><span class="p">,</span> <span class="s">&quot;Title&quot;</span><span class="p">)</span>
265     <span class="gp">&gt;&gt;&gt; </span><span class="n">vu</span><span class="o">.</span><span class="n">linegraph</span><span class="p">(</span><span class="n">ba1</span><span class="p">,</span> <span class="s">&quot;Title&quot;</span><span class="p">)</span>
266     <span class="gp">&gt;&gt;&gt; </span><span class="n">vu</span><span class="o">.</span><span class="n">dualgraph</span><span class="p">(</span><span class="n">ba1</span><span class="p">,</span> <span class="n">ba2</span><span class="p">,</span> <span class="s">&quot;Title&quot;</span><span class="p">)</span>
267     <span class="gp">&gt;&gt;&gt; </span><span class="n">vu</span><span class="o">.</span><span class="n">scatterplot</span><span class="p">(</span><span class="n">ba1</span><span class="p">,</span> <span class="n">t1</span><span class="p">,</span> <span class="n">t2</span><span class="p">,</span> <span class="n">t3</span><span class="p">,</span> <span class="n">t4</span><span class="p">,</span> <span class="n">title</span><span class="p">)</span>
268     </pre></div>
269     </div>
270     <dl class="function">
271     <dt id="vu_module.dotgraph">
272     <tt class="descclassname">vu_module.</tt><tt class="descname">dotgraph</tt><big>(</big><em>baDot</em>, <em>title=''</em><big>)</big><a class="headerlink" href="#vu_module.dotgraph" title="Permalink to this definition">¶</a></dt>
273     <dd><p>Display signal vs time using dotted lines.</p>
274     <table class="docutils field-list" frame="void" rules="none">
275     <col class="field-name" />
276     <col class="field-body" />
277     <tbody valign="top">
278     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
279 clausted 54 <li><em>baDot</em> (BiosensorArray) &#8211; Object containing the data.</li>
280 clausted 53 <li><em>title</em> (str) &#8211; Title to place above the graph.</li>
281     </ul>
282     </td>
283     </tr>
284     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
285     </td>
286     </tr>
287     </tbody>
288     </table>
289     </dd></dl>
290    
291     <dl class="function">
292     <dt id="vu_module.dualgraph">
293     <tt class="descclassname">vu_module.</tt><tt class="descname">dualgraph</tt><big>(</big><em>baDot</em>, <em>baLine</em>, <em>title=''</em><big>)</big><a class="headerlink" href="#vu_module.dualgraph" title="Permalink to this definition">¶</a></dt>
294     <dd><p>Display signal vs time using dotted AND continuous lines.</p>
295     <table class="docutils field-list" frame="void" rules="none">
296     <col class="field-name" />
297     <col class="field-body" />
298     <tbody valign="top">
299     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
300 clausted 54 <li><em>baDot</em> (BiosensorArray) &#8211; Object containing the dotted-line data.</li>
301     <li><em>baLine</em> (BiosensorArray) &#8211; Object containing the continuous-line data.</li>
302 clausted 53 <li><em>title</em> (str) &#8211; Title to place above the graph.</li>
303     </ul>
304     </td>
305     </tr>
306     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
307     </td>
308     </tr>
309     </tbody>
310     </table>
311     </dd></dl>
312    
313     <dl class="function">
314     <dt id="vu_module.linegraph">
315     <tt class="descclassname">vu_module.</tt><tt class="descname">linegraph</tt><big>(</big><em>baLine</em>, <em>title=''</em><big>)</big><a class="headerlink" href="#vu_module.linegraph" title="Permalink to this definition">¶</a></dt>
316     <dd><p>Display signal vs time using continuous lines.</p>
317     <table class="docutils field-list" frame="void" rules="none">
318     <col class="field-name" />
319     <col class="field-body" />
320     <tbody valign="top">
321     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
322 clausted 54 <li><em>baLine</em> (BiosensorArray) &#8211; Object containing the data.</li>
323 clausted 53 <li><em>title</em> (str) &#8211; Title to place above the graph.</li>
324     </ul>
325     </td>
326     </tr>
327     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
328     </td>
329     </tr>
330     </tbody>
331     </table>
332     </dd></dl>
333    
334     <dl class="function">
335     <dt id="vu_module.scatterplot">
336     <tt class="descclassname">vu_module.</tt><tt class="descname">scatterplot</tt><big>(</big><em>ba0</em>, <em>t1</em>, <em>t2</em>, <em>t3</em>, <em>t4</em>, <em>title</em><big>)</big><a class="headerlink" href="#vu_module.scatterplot" title="Permalink to this definition">¶</a></dt>
337     <dd><p>Plot binding changes between (t4-t3) versus (t2-t1).
338     Also print the results to the standard output.</p>
339     <table class="docutils field-list" frame="void" rules="none">
340     <col class="field-name" />
341     <col class="field-body" />
342     <tbody valign="top">
343     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
344 clausted 54 <li><em>ba0</em> (BiosensorArray) &#8211; Object containing the data.</li>
345 clausted 53 <li><em>t1</em> (float) &#8211; Timepoint before binding, first axis.</li>
346     <li><em>t2</em> (float) &#8211; Timepoint after binding, first axis.</li>
347     <li><em>t3</em> (float) &#8211; Timepoint before binding, second axis.</li>
348     <li><em>t4</em> (float) &#8211; Timepoint after binding, second axis.</li>
349     <li><em>title</em> (str) &#8211; Title to place above the graph.</li>
350     </ul>
351     </td>
352     </tr>
353     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
354     </td>
355     </tr>
356     </tbody>
357     </table>
358     </dd></dl>
359    
360     </div>
361     <div class="section" id="cal-module">
362     <h2>cal_module<a class="headerlink" href="#cal-module" title="Permalink to this headline">¶</a></h2>
363     <p>Calibration module for SPRI data in a ba_class.
364     This uses a known jump in index to turn arbitrary units into RIU.
365     Other routines provide background subtraction and data rearrangement.</p>
366     <p>Examples:</p>
367     <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">cal_module</span> <span class="kn">as</span> <span class="nn">cal</span>
368 clausted 54 <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">io_module</span> <span class="kn">as</span> <span class="nn">io</span>
369 clausted 53 <span class="gp">&gt;&gt;&gt; </span><span class="n">baC</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">readsprit</span><span class="p">(</span><span class="s">&quot;calibrationdata.txt&quot;</span><span class="p">)</span>
370     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">readsprit</span><span class="p">(</span><span class="s">&quot;spritdata.txt&quot;</span><span class="p">)</span>
371     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba2</span> <span class="o">=</span> <span class="n">cal</span><span class="o">.</span><span class="n">calibrate</span><span class="p">(</span><span class="n">ba1</span><span class="p">,</span> <span class="n">baCal</span><span class="p">,</span> <span class="n">t1</span><span class="p">,</span> <span class="n">t2</span><span class="p">,</span> <span class="n">n1</span><span class="p">,</span> <span class="n">n2</span><span class="p">)</span>
372     <span class="gp">&gt;&gt;&gt; </span><span class="n">cal</span><span class="o">.</span><span class="n">bgset</span><span class="p">(</span><span class="n">ba2</span><span class="p">,</span> <span class="n">bgroi</span><span class="p">)</span>
373     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba3</span> <span class="o">=</span> <span class="n">cal</span><span class="o">.</span><span class="n">bgsubt</span><span class="p">(</span><span class="n">ba2</span><span class="p">)</span>
374     </pre></div>
375     </div>
376     <dl class="function">
377     <dt id="cal_module.bgset">
378     <tt class="descclassname">cal_module.</tt><tt class="descname">bgset</tt><big>(</big><em>ba0</em>, <em>i</em><big>)</big><a class="headerlink" href="#cal_module.bgset" title="Permalink to this definition">¶</a></dt>
379     <dd><p>Set i as the background ROI for all of the ROIs.</p>
380     <table class="docutils field-list" frame="void" rules="none">
381     <col class="field-name" />
382     <col class="field-body" />
383     <tbody valign="top">
384     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
385     <li><em>ba0</em> (ba_class) &#8211; Object containing the data to be calibrated.</li>
386     <li><em>i</em> (ba_class) &#8211; Object containing the data to be calibrated.</li>
387     </ul>
388     </td>
389     </tr>
390     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
391     </td>
392     </tr>
393     </tbody>
394     </table>
395     </dd></dl>
396    
397     <dl class="function">
398     <dt id="cal_module.bgsubt">
399     <tt class="descclassname">cal_module.</tt><tt class="descname">bgsubt</tt><big>(</big><em>ba0</em><big>)</big><a class="headerlink" href="#cal_module.bgsubt" title="Permalink to this definition">¶</a></dt>
400     <dd><p>Apply the background subtraction and return a new ba object.</p>
401     <table class="docutils field-list" frame="void" rules="none">
402     <col class="field-name" />
403     <col class="field-body" />
404     <tbody valign="top">
405     <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>ba0</em> (ba_class) &#8211; Object containing the source data.</td>
406     </tr>
407     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">A new ba object</td>
408     </tr>
409     </tbody>
410     </table>
411     </dd></dl>
412    
413     <dl class="function">
414     <dt id="cal_module.calibrate">
415     <tt class="descclassname">cal_module.</tt><tt class="descname">calibrate</tt><big>(</big><em>ba0</em>, <em>baCal</em>, <em>t1</em>, <em>t2</em>, <em>n1=1335700</em>, <em>n2=1336600</em><big>)</big><a class="headerlink" href="#cal_module.calibrate" title="Permalink to this definition">¶</a></dt>
416     <dd><p>Use data in baCal to calibrate ba0.
417     A simple two-point linear calibration using timepoints t1 and t2 and
418     corresponding refractive indices n1 and n2.
419     Average 30 seconds of data (t-15 to 5+15 seconds).
420     The ba object returned will remember the slopes and intercepts used.</p>
421     <table class="docutils field-list" frame="void" rules="none">
422     <col class="field-name" />
423     <col class="field-body" />
424     <tbody valign="top">
425     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
426     <li><em>ba0</em> (ba_class) &#8211; Object containing the data to be calibrated.</li>
427     <li><em>baCal</em> (ba_class) &#8211; Object containing the data to be calibrated.</li>
428     <li><em>t1</em> (float) &#8211; Timepoint where refractive index = n1</li>
429     <li><em>t2</em> (float) &#8211; Timepoint where refractive index = n2</li>
430     <li><em>n1</em> (float) &#8211; First refractive index. Default=1335700 (~1x PBS).</li>
431     <li><em>n2</em> (float) &#8211; Second refractive index. Default=1336600 (~2x PBS).</li>
432     </ul>
433     </td>
434     </tr>
435     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
436     </td>
437     </tr>
438     </tbody>
439     </table>
440     </dd></dl>
441    
442     <dl class="function">
443     <dt id="cal_module.copyinterval">
444     <tt class="descclassname">cal_module.</tt><tt class="descname">copyinterval</tt><big>(</big><em>ba0</em>, <em>t1</em>, <em>t2</em><big>)</big><a class="headerlink" href="#cal_module.copyinterval" title="Permalink to this definition">¶</a></dt>
445     <dd><p>Copy data from the interval between t1 and t2 and return a new ba object.</p>
446     <table class="docutils field-list" frame="void" rules="none">
447     <col class="field-name" />
448     <col class="field-body" />
449     <tbody valign="top">
450     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
451     <li><em>ba0</em> (ba_class) &#8211; Object containing the source data.</li>
452     <li><em>t1</em> (float) &#8211; Beginning timepoint.</li>
453     <li><em>t2</em> (float) &#8211; Ending timepoint.</li>
454     </ul>
455     </td>
456     </tr>
457     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A new ba object</p>
458     </td>
459     </tr>
460     </tbody>
461     </table>
462     </dd></dl>
463    
464     <dl class="function">
465     <dt id="cal_module.flattenlist">
466     <tt class="descclassname">cal_module.</tt><tt class="descname">flattenlist</tt><big>(</big><em>lst</em>, <em>ltypes=(&lt;type 'list'&gt;</em>, <em>&lt;type 'tuple'&gt;)</em><big>)</big><a class="headerlink" href="#cal_module.flattenlist" title="Permalink to this definition">¶</a></dt>
467     <dd><p>Flatten nested lists into one list.</p>
468     <table class="docutils field-list" frame="void" rules="none">
469     <col class="field-name" />
470     <col class="field-body" />
471     <tbody valign="top">
472     <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>lst</em> &#8211; Non-list, list, or list of lists!</td>
473     </tr>
474     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">flat list</td>
475     </tr>
476     </tbody>
477     </table>
478     </dd></dl>
479    
480     <dl class="function">
481     <dt id="cal_module.zerotime">
482     <tt class="descclassname">cal_module.</tt><tt class="descname">zerotime</tt><big>(</big><em>ba</em><big>)</big><a class="headerlink" href="#cal_module.zerotime" title="Permalink to this definition">¶</a></dt>
483     <dd><p>Adjust sensorgrams to start at time[0]=0.</p>
484     <table class="docutils field-list" frame="void" rules="none">
485     <col class="field-name" />
486     <col class="field-body" />
487     <tbody valign="top">
488     <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>ba</em> (ba_class) &#8211; Object containing the data.</td>
489     </tr>
490     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">nothing</td>
491     </tr>
492     </tbody>
493     </table>
494     </dd></dl>
495    
496     <dl class="function">
497     <dt id="cal_module.zerovalue">
498     <tt class="descclassname">cal_module.</tt><tt class="descname">zerovalue</tt><big>(</big><em>ba</em><big>)</big><a class="headerlink" href="#cal_module.zerovalue" title="Permalink to this definition">¶</a></dt>
499     <dd><p>Adjust sensorgrams to start at value[0]=0.</p>
500     <table class="docutils field-list" frame="void" rules="none">
501     <col class="field-name" />
502     <col class="field-body" />
503     <tbody valign="top">
504     <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>ba</em> (ba_class) &#8211; Object containing the data.</td>
505     </tr>
506     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">nothing</td>
507     </tr>
508     </tbody>
509     </table>
510     </dd></dl>
511    
512     </div>
513     <div class="section" id="io-module">
514     <h2>io_module<a class="headerlink" href="#io-module" title="Permalink to this headline">¶</a></h2>
515     <p>Input/Output module for converting files to Biosensor Array class.
516     Supported sensorgram types include Biosensor, CLAMP, SPRit, and Plexera ICM.
517     Supported microarray types include GAL and ISB Map.</p>
518     <p>Examples:</p>
519     <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">io_module</span> <span class="kn">as</span> <span class="nn">io</span>
520     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">readsprit</span><span class="p">(</span><span class="s">&quot;spritdata.txt&quot;</span><span class="p">)</span>
521     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">readclamp</span><span class="p">(</span><span class="s">&quot;spritdata.txt&quot;</span><span class="p">)</span>
522     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">readicmtxt</span><span class="p">(</span><span class="s">&quot;icmdata.txt&quot;</span><span class="p">)</span>
523     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">readbiosensor</span><span class="p">(</span><span class="s">&quot;icmdata.txt&quot;</span><span class="p">)</span>
524     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba1</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">readcsv</span><span class="p">(</span><span class="s">&quot;rawdata.csv&quot;</span><span class="p">)</span>
525     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba2</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">applygal</span><span class="p">(</span><span class="n">ba1</span><span class="p">,</span> <span class="s">&quot;galfile.gal&quot;</span><span class="p">)</span>
526     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba2</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">applykey</span><span class="p">(</span><span class="n">ba1</span><span class="p">,</span> <span class="s">&quot;keyfile.tsv&quot;</span><span class="p">)</span>
527     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba3</span> <span class="o">=</span> <span class="n">io</span><span class="o">.</span><span class="n">applymethod</span><span class="p">(</span><span class="n">ba2</span><span class="p">,</span> <span class="s">&quot;icmmethod.xls&quot;</span><span class="p">)</span>
528     <span class="gp">&gt;&gt;&gt; </span><span class="n">io</span><span class="o">.</span><span class="n">writesprit</span><span class="p">(</span><span class="n">ba3</span><span class="p">,</span> <span class="s">&quot;newspritfile.txt&quot;</span><span class="p">)</span>
529     <span class="gp">&gt;&gt;&gt; </span><span class="n">io</span><span class="o">.</span><span class="n">writeclamp</span><span class="p">(</span><span class="n">ba3</span><span class="p">,</span> <span class="s">&quot;newclampfile.txt&quot;</span><span class="p">)</span>
530     </pre></div>
531     </div>
532     <dl class="function">
533     <dt id="io_module.applygal">
534     <tt class="descclassname">io_module.</tt><tt class="descname">applygal</tt><big>(</big><em>ba0</em>, <em>fname</em><big>)</big><a class="headerlink" href="#io_module.applygal" title="Permalink to this definition">¶</a></dt>
535     <dd><p>Read a Gal file and apply its microarray information.</p>
536     <p><em>(This function is under construction)</em></p>
537     </dd></dl>
538    
539     <dl class="function">
540     <dt id="io_module.applykey">
541     <tt class="descclassname">io_module.</tt><tt class="descname">applykey</tt><big>(</big><em>ba0</em>, <em>fname</em><big>)</big><a class="headerlink" href="#io_module.applykey" title="Permalink to this definition">¶</a></dt>
542     <dd><p>Read a Key file and apply its microarray information.
543     Multiple background ROIs are not yet supported.
544     Here is a very simple example:</p>
545     <div class="highlight-python"><pre>No. Description1 Description2 Background ROI Col Row
546     1 Rat TNF Antibody01 2 1 1
547     2 ratIgG Antibody02 4 2 1
548     3 Hum TNF Antibody03 4 3 1
549     4 humIgG Antibody04 2 4 1</pre>
550     </div>
551     </dd></dl>
552    
553     <dl class="function">
554     <dt id="io_module.applymethod">
555     <tt class="descclassname">io_module.</tt><tt class="descname">applymethod</tt><big>(</big><em>ba0</em>, <em>fname</em><big>)</big><a class="headerlink" href="#io_module.applymethod" title="Permalink to this definition">¶</a></dt>
556     <dd><p>Read a ICM Analyte/Method xls file and apply its information.</p>
557     <p><em>(This feature is under construction.)</em></p>
558     </dd></dl>
559    
560     <dl class="function">
561     <dt id="io_module.outputbindinglevels">
562     <tt class="descclassname">io_module.</tt><tt class="descname">outputbindinglevels</tt><big>(</big><em>ba0</em>, <em>fname</em>, <em>interval</em>, <em>*baselines</em><big>)</big><a class="headerlink" href="#io_module.outputbindinglevels" title="Permalink to this definition">¶</a></dt>
563     <dd>Measure the binding level changes at multiple intervals along a sensorgram.
564     Write the data to a file. If interval is 500 and baselines are [100, 1100] then
565     binding levels are changes between 100-600s and between 1100-01600s.
566     Average 30s of data.</dd></dl>
567    
568     <dl class="function">
569     <dt id="io_module.readbiosensor">
570     <tt class="descclassname">io_module.</tt><tt class="descname">readbiosensor</tt><big>(</big><em>fname</em><big>)</big><a class="headerlink" href="#io_module.readbiosensor" title="Permalink to this definition">¶</a></dt>
571     <dd><p>Read a Biacore-style text file into a ba class.
572     Here is a very simple example of the tab-delimited format:</p>
573     <div class="highlight-python"><pre>Ab1 Fc=4- 1_X Ab1 Fc=4 -1_Y Ab2 Fc=4 -1_X Ab2 Fc=4 -1_Y
574     13.1 23.7644 93.1 0.713912
575     13.6 23.4265 93.6 0.0541172
576     14.1 23.1625 94.1 0.332768
577     14.6 23.5752 94.6 0.849459</pre>
578     </div>
579     </dd></dl>
580    
581     <dl class="function">
582     <dt id="io_module.readclamp">
583     <tt class="descclassname">io_module.</tt><tt class="descname">readclamp</tt><big>(</big><em>fname</em><big>)</big><a class="headerlink" href="#io_module.readclamp" title="Permalink to this definition">¶</a></dt>
584     <dd><p>Read a Clamp text file into a ba class.
585     It has two tab-delimited columns per SPR flowcell/roi..
586     It has a varying number of header lines with injection information.
587     Here is a very simple example with 2 rois and 3 datapoints:</p>
588     <div class="highlight-python"><pre>Vers 3.41 Data
589     Conc1 0 0 0 0
590     Start1 301.5 301.5 301.5 301.5
591     Stop1 949.8 949.8 949.8 949.8
592     RInd1 0 0 0 0
593     Conc2 0 0 0 0
594     Start2 986.4 0 0 0
595     Stop2 1626 0 0 0
596     RInd2 0 0 0 0
597     Flow 1 1 1 1
598     Time1 Data1 Time2 Data2
599     0.094 0.062 0.094 0.053
600     1.094 0.026 1.094 0.05
601     2.094 0.119 2.094 0.055</pre>
602     </div>
603     </dd></dl>
604    
605     <dl class="function">
606     <dt id="io_module.readcsv">
607     <tt class="descclassname">io_module.</tt><tt class="descname">readcsv</tt><big>(</big><em>fname</em><big>)</big><a class="headerlink" href="#io_module.readcsv" title="Permalink to this definition">¶</a></dt>
608     <dd><p>Read a comma-separated value text file into a ba class.
609     The first column contains time data while the others contain response data.
610     Here is a very simple example of the format:</p>
611     <div class="highlight-python"><div class="highlight"><pre><span class="mf">1.0001</span><span class="p">,</span> <span class="mf">23.7644</span><span class="p">,</span> <span class="mf">0.7139</span>
612     <span class="mf">2.0001</span><span class="p">,</span> <span class="mf">23.4265</span><span class="p">,</span> <span class="mf">0.0541</span>
613     <span class="mf">3.0001</span><span class="p">,</span> <span class="mf">23.1625</span><span class="p">,</span> <span class="mf">0.3327</span>
614     <span class="mf">4.0001</span><span class="p">,</span> <span class="mf">23.5752</span><span class="p">,</span> <span class="mf">0.8494</span>
615     </pre></div>
616     </div>
617     </dd></dl>
618    
619     <dl class="function">
620     <dt id="io_module.readicmtxt">
621     <tt class="descclassname">io_module.</tt><tt class="descname">readicmtxt</tt><big>(</big><em>fname</em><big>)</big><a class="headerlink" href="#io_module.readicmtxt" title="Permalink to this definition">¶</a></dt>
622     <dd><p>Read a ICM text file into a ba class.
623     Here is a very simple example of the tab-delimited format:</p>
624     <div class="highlight-python"><pre>03/05/2010 13:37:21.312 249.408 0.000 0.000
625     03/05/2010 13:37:22.312 249.306 0.000 0.000</pre>
626     </div>
627     </dd></dl>
628    
629     <dl class="function">
630     <dt id="io_module.readsprit">
631     <tt class="descclassname">io_module.</tt><tt class="descname">readsprit</tt><big>(</big><em>fname</em><big>)</big><a class="headerlink" href="#io_module.readsprit" title="Permalink to this definition">¶</a></dt>
632     <dd><p>Read a SPRit text file into a ba class.
633     It has two tab-delimited columns and two header lines.
634     Here is a very simple example with 2 rois and 3 datapoints:</p>
635     <div class="highlight-python"><pre>Elapsed Time (Seconds) Average Intensity (Pixel Intensity)
636     BEGIN
637     0.000000e+000 2.863145e+003
638     5.013000e+000 2.863367e+003
639     1.002500e+001 2.862950e+003
640     0.000000e+000 2.862875e+003
641     5.013000e+000 2.862510e+003</pre>
642     </div>
643     </dd></dl>
644    
645     <dl class="function">
646     <dt id="io_module.writebiosensor">
647     <tt class="descclassname">io_module.</tt><tt class="descname">writebiosensor</tt><big>(</big><em>ba0</em>, <em>fname</em><big>)</big><a class="headerlink" href="#io_module.writebiosensor" title="Permalink to this definition">¶</a></dt>
648     <dd>Write a ba class to a Biosensor text file.</dd></dl>
649    
650     <dl class="function">
651     <dt id="io_module.writeclamp">
652     <tt class="descclassname">io_module.</tt><tt class="descname">writeclamp</tt><big>(</big><em>ba0</em>, <em>fname</em><big>)</big><a class="headerlink" href="#io_module.writeclamp" title="Permalink to this definition">¶</a></dt>
653     <dd>Write a ba class to a Clamp text file.</dd></dl>
654    
655     <dl class="function">
656     <dt id="io_module.writesprit">
657     <tt class="descclassname">io_module.</tt><tt class="descname">writesprit</tt><big>(</big><em>ba0</em>, <em>fname</em><big>)</big><a class="headerlink" href="#io_module.writesprit" title="Permalink to this definition">¶</a></dt>
658     <dd>Write a ba class to a SPRit text file.</dd></dl>
659    
660     </div>
661     <div class="section" id="mdl-module">
662     <h2>mdl_module<a class="headerlink" href="#mdl-module" title="Permalink to this headline">¶</a></h2>
663 clausted 54 <p><em>Example model functions module for SPRI data.</em>
664 clausted 53 Just a few simple, common interaction models will go here.
665     In the future, each new model will go in its own module/file.
666 clausted 54 Each model is a function taking three parameters.</p>
667     <dl class="docutils">
668     <dt><strong>Parameters:</strong></dt>
669     <dd><ul class="first last simple">
670     <li><em>time</em> (numpy array) &#8211; Time points, usually in seconds.</li>
671     <li><em>data</em> (numpy array) &#8211; Initial SPR signal values.</li>
672     <li><em>params</em> (dictionary of dictionaries) &#8211; Model parameter description.</li>
673     </ul>
674     </dd>
675     </dl>
676     <p><strong>Returns:</strong> numpy array of calculated SPR signal values.</p>
677 clausted 53 <p>The dictionary keys are the names of model parameters
678     (e.g. &#8216;rmax&#8217; for maximal response, or &#8216;kon&#8217; for kinetic on-rate).
679     Each model parameter is described by a subdictionary containing four entries.</p>
680     <blockquote>
681 clausted 54 <ul class="simple">
682     <li><tt class="docutils literal"><span class="pre">'value'</span></tt> The current value of the parameter.</li>
683     <li><tt class="docutils literal"><span class="pre">'min'</span></tt> The minimum allowable value.</li>
684     <li><tt class="docutils literal"><span class="pre">'max'</span></tt> The maximum allowable value.</li>
685     <li><tt class="docutils literal"><span class="pre">'fixed'</span></tt> Either &#8216;float&#8217;, &#8216;fixed&#8217;, or a reference to another ROI.</li>
686     </ul>
687 clausted 53 </blockquote>
688 clausted 54 <p>The <tt class="docutils literal"><span class="pre">min</span></tt>, <tt class="docutils literal"><span class="pre">max</span></tt>, and <tt class="docutils literal"><span class="pre">fixed</span></tt> keys are used during automatic curve-fitting.
689 clausted 53 A fixed parameter is not allowed to change, while a float parameter is adjusted
690     until the least-squares algorithm has minimized the sum-squared error.
691     The <em>fixed</em> parameter may also be an integer, in which case it is fixed to
692     the value of a parameter of the same name in another ROI.</p>
693     <p>The model function returns an array of values obtained by numerical integration.
694     The model is represented by differential equations and integrated using the
695     rectangle rule or, preferentially, using the trapezoidal rule.</p>
696     <p>Examples:</p>
697     <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">mdl_module</span> <span class="kn">as</span> <span class="nn">mdl</span>
698     <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
699     <span class="gp">&gt;&gt;&gt; </span><span class="n">times</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span>
700     <span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span>
701     <span class="gp">&gt;&gt;&gt; </span>
702 clausted 54 <span class="gp">&gt;&gt;&gt; </span><span class="n">param1</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">rate</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="nb">min</span><span class="o">=-</span><span class="mf">100.0</span><span class="p">,</span> <span class="nb">max</span><span class="o">=</span><span class="mf">100.0</span><span class="p">,</span> <span class="n">fixed</span><span class="o">=</span><span class="bp">True</span><span class="p">))</span>
703 clausted 53 <span class="gp">&gt;&gt;&gt; </span><span class="n">data1</span> <span class="o">=</span> <span class="n">drift</span><span class="p">(</span><span class="n">time</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">param1</span><span class="p">)</span>
704     <span class="gp">&gt;&gt;&gt; </span>
705     <span class="gp">&gt;&gt;&gt; </span><span class="n">param2</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;t1&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s">&#39;value&#39;</span><span class="p">:</span><span class="mf">30.0</span><span class="p">,</span> <span class="s">&#39;min&#39;</span><span class="p">:</span><span class="mf">30.0</span><span class="p">,</span> <span class="s">&#39;max&#39;</span><span class="p">:</span><span class="mf">30.0</span><span class="p">,</span> <span class="s">&#39;fixed&#39;</span><span class="p">:</span><span class="bp">True</span><span class="p">}</span> <span class="p">}</span>
706     <span class="gp">&gt;&gt;&gt; </span><span class="n">param2</span><span class="p">[</span><span class="s">&#39;rmax&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;value&#39;</span><span class="p">:</span> <span class="mf">100.0</span><span class="p">}</span>
707     <span class="gp">&gt;&gt;&gt; </span><span class="n">param2</span><span class="p">[</span><span class="s">&#39;conc&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;value&#39;</span><span class="p">:</span> <span class="mf">1e-6</span><span class="p">}</span>
708     <span class="gp">&gt;&gt;&gt; </span><span class="n">param2</span><span class="p">[</span><span class="s">&#39;kon&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;value&#39;</span><span class="p">:</span> <span class="mf">2e4</span><span class="p">}</span>
709     <span class="gp">&gt;&gt;&gt; </span><span class="n">param2</span><span class="p">[</span><span class="s">&#39;t2&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;value&#39;</span><span class="p">:</span> <span class="mf">150.0</span><span class="p">}</span>
710     <span class="gp">&gt;&gt;&gt; </span><span class="n">param2</span><span class="p">[</span><span class="s">&#39;koff&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;value&#39;</span><span class="p">:</span> <span class="mf">1e-3</span><span class="p">}</span>
711     <span class="gp">&gt;&gt;&gt; </span><span class="n">param2</span><span class="p">[</span><span class="s">&#39;t3&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;value&#39;</span><span class="p">:</span> <span class="mf">270.0</span><span class="p">}</span>
712     <span class="gp">&gt;&gt;&gt; </span><span class="n">data2</span> <span class="o">=</span> <span class="n">simple1to1</span><span class="p">(</span><span class="n">time</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">param2</span><span class="p">)</span>
713     </pre></div>
714     </div>
715     <dl class="function">
716     <dt id="mdl_module.drift">
717     <tt class="descclassname">mdl_module.</tt><tt class="descname">drift</tt><big>(</big><em>time</em>, <em>data</em>, <em>params</em><big>)</big><a class="headerlink" href="#mdl_module.drift" title="Permalink to this definition">¶</a></dt>
718     <dd><p>This function simply models a constant signal drift in units/second.
719     It requires numpy arrays of times and starting data values,
720     It only requires one parameter in the params list.</p>
721 clausted 54 <p><tt class="docutils literal"><span class="pre">params['rate']['value']</span></tt></p>
722 clausted 53 </dd></dl>
723    
724     <dl class="function">
725     <dt id="mdl_module.simple1to1">
726     <tt class="descclassname">mdl_module.</tt><tt class="descname">simple1to1</tt><big>(</big><em>time</em>, <em>data</em>, <em>params</em><big>)</big><a class="headerlink" href="#mdl_module.simple1to1" title="Permalink to this definition">¶</a></dt>
727 clausted 54 <dd><p>This function simply models a 1:1 interaction.
728     The model parameters are described in the table below.</p>
729 clausted 53 <p>Model:</p>
730     <div class="highlight-python"><pre>[A] + [L] --kon--&gt; [AL]
731     [A] + [L] &lt;-koff-- [AL]</pre>
732     </div>
733     <p>Derivation:</p>
734     <div class="highlight-python"><div class="highlight"><pre><span class="n">d</span><span class="p">[</span><span class="n">AL</span><span class="p">]</span><span class="o">/</span><span class="n">dt</span> <span class="o">=</span> <span class="n">kon</span><span class="o">*</span><span class="p">[</span><span class="n">A</span><span class="p">]</span><span class="o">*</span><span class="p">[</span><span class="n">L</span><span class="p">]</span> <span class="o">-</span> <span class="n">koff</span><span class="o">*</span><span class="p">[</span><span class="n">AL</span><span class="p">]</span>
735     <span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="n">AL</span><span class="p">]</span>
736     <span class="p">(</span><span class="n">rmax</span><span class="o">-</span><span class="n">y</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span><span class="n">L</span><span class="p">]</span>
737     <span class="n">conc</span> <span class="o">=</span> <span class="p">[</span><span class="n">A</span><span class="p">]</span>
738     <span class="n">rmax</span> <span class="o">=</span> <span class="p">[</span><span class="n">AL</span><span class="p">]</span> <span class="o">+</span> <span class="p">[</span><span class="n">L</span><span class="p">]</span>
739     <span class="n">dy</span><span class="o">/</span><span class="n">dt</span> <span class="o">=</span> <span class="n">conc</span><span class="o">*</span><span class="n">kon</span><span class="o">*</span><span class="p">(</span><span class="n">rmax</span><span class="o">-</span><span class="n">y</span><span class="p">)</span> <span class="o">-</span> <span class="n">koff</span><span class="o">*</span><span class="n">y</span>
740     </pre></div>
741     </div>
742     <table border="1" class="docutils">
743     <colgroup>
744     <col width="34%" />
745     <col width="66%" />
746     </colgroup>
747     <thead valign="bottom">
748     <tr><th class="head">Model Parameter</th>
749     <th class="head">Description</th>
750     </tr>
751     </thead>
752     <tbody valign="top">
753     <tr><td>params[&#8216;t1&#8217;][&#8216;value&#8217;]</td>
754     <td>time of injection for binding, (s)</td>
755     </tr>
756     <tr><td>params[&#8216;rmax&#8217;][&#8216;value&#8217;]</td>
757     <td>maximum response, (RIU)</td>
758     </tr>
759     <tr><td>params[&#8216;conc&#8217;][&#8216;value&#8217;]</td>
760     <td>concentration of analyte [A], (M)</td>
761     </tr>
762     <tr><td>params[&#8216;kon&#8217;][&#8216;value&#8217;]</td>
763     <td>on-rate of analyte, (1/Ms)</td>
764     </tr>
765     <tr><td>params[&#8216;t2&#8217;][&#8216;value&#8217;]</td>
766     <td>time of end binding &amp; begin washing, (s)</td>
767     </tr>
768     <tr><td>params[&#8216;koff&#8217;][&#8216;value&#8217;]</td>
769     <td>off-rate of analyte, (1/s)</td>
770     </tr>
771     <tr><td>params[&#8216;t3&#8217;][&#8216;value&#8217;]</td>
772     <td>time end of washing &amp; data fitting, (s)</td>
773     </tr>
774     <tr><td><em>Optional</em></td>
775     <td>&nbsp;</td>
776     </tr>
777     <tr><td>params[&#8216;cofa&#8217;][&#8216;value&#8217;]</td>
778     <td>concentration factor, (1/dilution factor)</td>
779     </tr>
780     </tbody>
781     </table>
782     </dd></dl>
783    
784     <dl class="function">
785     <dt id="mdl_module.simple1to1_mtl">
786     <tt class="descclassname">mdl_module.</tt><tt class="descname">simple1to1_mtl</tt><big>(</big><em>time</em>, <em>data</em>, <em>params</em><big>)</big><a class="headerlink" href="#mdl_module.simple1to1_mtl" title="Permalink to this definition">¶</a></dt>
787 clausted 54 <dd><p>This function simply models a 1:1 interaction with mass transport limitation.
788     The model parameters are described in the table below.</p>
789 clausted 53 <p>Model:</p>
790     <div class="highlight-python"><pre>[Abulk] --km-&gt; [Asurf] + [L] --kon--&gt; [AL]
791     [Abulk] &lt;-km-- [Asurf] + [L] &lt;-koff-- [AL]</pre>
792     </div>
793     <p>Derivation:</p>
794     <div class="highlight-python"><div class="highlight"><pre><span class="n">d</span><span class="p">[</span><span class="n">AL</span><span class="p">]</span><span class="o">/</span><span class="n">dt</span> <span class="o">=</span> <span class="p">(</span><span class="n">kon</span><span class="o">*</span><span class="p">[</span><span class="n">A</span><span class="p">]</span><span class="o">*</span><span class="p">[</span><span class="n">L</span><span class="p">]</span> <span class="o">-</span> <span class="n">koff</span><span class="o">*</span><span class="p">[</span><span class="n">AL</span><span class="p">])</span> <span class="o">/</span> <span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">kon</span><span class="o">*</span><span class="p">[</span><span class="n">L</span><span class="p">]</span><span class="o">/</span><span class="n">kmtl</span><span class="p">)</span>
795     <span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="n">AL</span><span class="p">]</span>
796     <span class="p">(</span><span class="n">rmax</span><span class="o">-</span><span class="n">y</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span><span class="n">L</span><span class="p">]</span>
797     <span class="n">conc</span> <span class="o">=</span> <span class="p">[</span><span class="n">Abulk</span><span class="p">]</span>
798     <span class="n">rmax</span> <span class="o">=</span> <span class="p">[</span><span class="n">AL</span><span class="p">]</span> <span class="o">+</span> <span class="p">[</span><span class="n">L</span><span class="p">]</span>
799     <span class="n">dy</span><span class="o">/</span><span class="n">dt</span> <span class="o">=</span> <span class="p">(</span><span class="n">kon</span><span class="o">*</span><span class="n">conc</span><span class="o">*</span><span class="p">(</span><span class="n">rmax</span><span class="o">-</span><span class="n">y</span><span class="p">)</span> <span class="o">-</span> <span class="n">koff</span><span class="o">*</span><span class="n">y</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">kon</span><span class="o">*</span><span class="p">(</span><span class="n">rmax</span><span class="o">-</span><span class="n">y</span><span class="p">)</span><span class="o">/</span><span class="n">kmtl</span><span class="p">)</span>
800     </pre></div>
801     </div>
802     <table border="1" class="docutils">
803     <colgroup>
804     <col width="34%" />
805     <col width="66%" />
806     </colgroup>
807     <thead valign="bottom">
808     <tr><th class="head">Model Parameter</th>
809     <th class="head">Description</th>
810     </tr>
811     </thead>
812     <tbody valign="top">
813     <tr><td>params[&#8216;t1&#8217;][&#8216;value&#8217;]</td>
814     <td>time of injection for binding, (s)</td>
815     </tr>
816     <tr><td>params[&#8216;rmax&#8217;][&#8216;value&#8217;]</td>
817     <td>maximum response, (RIU)</td>
818     </tr>
819     <tr><td>params[&#8216;conc&#8217;][&#8216;value&#8217;]</td>
820     <td>concentration of analyte [Abulk], (M)</td>
821     </tr>
822     <tr><td>params[&#8216;kon&#8217;][&#8216;value&#8217;]</td>
823     <td>on-rate of analyte, (1/Ms)</td>
824     </tr>
825     <tr><td>params[&#8216;t2&#8217;][&#8216;value&#8217;]</td>
826     <td>time of end binding &amp; begin washing, (s)</td>
827     </tr>
828     <tr><td>params[&#8216;koff&#8217;][&#8216;value&#8217;]</td>
829     <td>off-rate of analyte, (1/s)</td>
830     </tr>
831     <tr><td>params[&#8216;t3&#8217;][&#8216;value&#8217;]</td>
832     <td>time end of washing &amp; data fitting, (s)</td>
833     </tr>
834     <tr><td>params[&#8216;kmtl&#8217;][&#8216;value&#8217;]</td>
835     <td>rate of diffusion, (RIU/Ms)</td>
836     </tr>
837     <tr><td><em>Optional</em></td>
838     <td>&nbsp;</td>
839     </tr>
840     <tr><td>params[&#8216;cofa&#8217;][&#8216;value&#8217;]</td>
841     <td>concentration factor, (1/dilution factor)</td>
842     </tr>
843     </tbody>
844     </table>
845     </dd></dl>
846    
847     </div>
848 clausted 54 <div class="section" id="fit-module">
849     <h2>fit_module<a class="headerlink" href="#fit-module" title="Permalink to this headline">¶</a></h2>
850     <p><em>Curve-fitting module for SPRI data.</em>
851     These routines are based on the Levenberg-Marquart Algorithm (LMA) from SciPy.
852     This module provides several extended features that make it
853     particularly powerful for the analysis of high-throughput SPRI data.</p>
854     <blockquote>
855     <ul class="simple">
856     <li>Constrained parameters.
857     <em>Invalid results such as negative kinetic rates can be avoided.</em></li>
858     <li>Simultaneous fitting of multiple curves.
859     <em>Parameters used in one ROI may be tied to those in other ROIs.</em></li>
860     <li>Multiple models may be specified.
861     <em>Different ROIs may exhibit different binding interactions.</em></li>
862     </ul>
863     </blockquote>
864     <p>Users should take advantage of the <tt class="docutils literal"><span class="pre">mclma()</span></tt> function.
865     The <tt class="docutils literal"><span class="pre">lma()</span></tt> and <tt class="docutils literal"><span class="pre">clma()</span></tt> functions have been deprecated.</p>
866     <p>Examples:</p>
867     <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">fit_module</span> <span class="kn">as</span> <span class="nn">fit</span>
868     <span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">mdl_module</span> <span class="kn">as</span> <span class="nn">mdl</span>
869     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba</span><span class="o">.</span><span class="n">roi</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">mdl</span><span class="o">.</span><span class="n">drift</span>
870     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba</span><span class="o">.</span><span class="n">roi</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="n">mdl</span><span class="o">.</span><span class="n">drift</span>
871     <span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;rate&#39;</span><span class="p">:</span> <span class="p">{</span><span class="s">&#39;value&#39;</span><span class="p">:</span><span class="mf">1.0</span><span class="p">,</span> <span class="s">&#39;min&#39;</span><span class="p">:</span><span class="o">-</span><span class="mf">100.0</span><span class="p">,</span> <span class="s">&#39;max&#39;</span><span class="p">:</span><span class="mf">100.0</span><span class="p">,</span> <span class="s">&#39;fixed&#39;</span><span class="p">:</span><span class="s">&#39;float&#39;</span><span class="p">}</span> <span class="p">}</span>
872     <span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">rate</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="nb">min</span><span class="o">=-</span><span class="mf">100.0</span><span class="p">,</span> <span class="nb">max</span><span class="o">=</span><span class="mf">100.0</span><span class="p">,</span> <span class="n">fixed</span><span class="o">=</span><span class="bp">True</span><span class="p">))</span>
873     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba</span><span class="o">.</span><span class="n">roi</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">params</span> <span class="o">=</span> <span class="n">p1</span>
874     <span class="gp">&gt;&gt;&gt; </span><span class="n">ba</span><span class="o">.</span><span class="n">roi</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">params</span> <span class="o">=</span> <span class="n">p2</span>
875     <span class="gp">&gt;&gt;&gt; </span><span class="n">i</span> <span class="o">=</span> <span class="n">mclma</span><span class="p">(</span><span class="n">ba</span><span class="o">.</span><span class="n">roi</span><span class="p">)</span>
876     </pre></div>
877 clausted 53 </div>
878 clausted 54 <dl class="function">
879     <dt id="fit_module.clma">
880     <tt class="descclassname">fit_module.</tt><tt class="descname">clma</tt><big>(</big><em>roi</em><big>)</big><a class="headerlink" href="#fit_module.clma" title="Permalink to this definition">¶</a></dt>
881     <dd><p><em>Constrained LMA curve-fitting. (Deprecated)</em>
882     Least-squares curve-fitting is performed on the data in the specified ROI.
883     The ROI must contain SPR data, a model, and initial (guess) parameters.
884     The roi.params values are modified in place.
885     The maximum number of iterations is set to 999.</p>
886     <table class="docutils field-list" frame="void" rules="none">
887     <col class="field-name" />
888     <col class="field-body" />
889     <tbody valign="top">
890     <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>roi</em> (RegOfInterest) &#8211; ROI containing data, a model, and initial parameter guesses.</td>
891     </tr>
892     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">number of iterations completed.</td>
893     </tr>
894     </tbody>
895     </table>
896     </dd></dl>
897 clausted 53
898 clausted 54 <dl class="function">
899     <dt id="fit_module.lma">
900     <tt class="descclassname">fit_module.</tt><tt class="descname">lma</tt><big>(</big><em>roi</em><big>)</big><a class="headerlink" href="#fit_module.lma" title="Permalink to this definition">¶</a></dt>
901     <dd><p><em>Normal LMA curve-fitting. (Deprecated)</em>
902     Least-squares curve-fitting is performed on the data in the specified ROI.
903     The ROI must contain SPR data, a model, and initial (guess) parameters.
904     The roi.params values are modified in place.
905     The maximum number of iterations is set to 500.</p>
906     <table class="docutils field-list" frame="void" rules="none">
907     <col class="field-name" />
908     <col class="field-body" />
909     <tbody valign="top">
910     <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>roi</em> (RegOfInterest) &#8211; ROI containing data, a model, and initial parameter guesses.</td>
911     </tr>
912     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">number of iterations completed.</td>
913     </tr>
914     </tbody>
915     </table>
916     </dd></dl>
917 clausted 53
918 clausted 54 <dl class="function">
919     <dt id="fit_module.mclma">
920     <tt class="descclassname">fit_module.</tt><tt class="descname">mclma</tt><big>(</big><em>rois</em><big>)</big><a class="headerlink" href="#fit_module.mclma" title="Permalink to this definition">¶</a></dt>
921     <dd><p><em>Multiple-curve Constrained Levenberg-Marquart Algorithm.</em>
922     Least-squares curve-fitting is performed on the data in the specified ROIs.
923     The ROIs must contain SPR data, a model, and initial (guess) parameters.
924     The roi.params values are modified in place.
925     The maximum number of iterations is set to 999.</p>
926     <table class="docutils field-list" frame="void" rules="none">
927     <col class="field-name" />
928     <col class="field-body" />
929     <tbody valign="top">
930     <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>rois</em> (List of RegOfInterest) &#8211; ROI containing data, a model, and initial parameter guesses.</td>
931     </tr>
932     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">number of iterations completed.</td>
933     </tr>
934     </tbody>
935     </table>
936     </dd></dl>
937    
938     </div>
939     </div>
940    
941    
942 clausted 53 </div>
943     </div>
944     </div>
945     <div class="sphinxsidebar">
946     <div class="sphinxsidebarwrapper">
947     <h3><a href="index.html">Table Of Contents</a></h3>
948     <ul>
949     <li><a class="reference external" href="#">The Application Program Interface</a></li>
950 clausted 54 <li><a class="reference external" href="#module-fit_module">The Python Source Code</a><ul>
951 clausted 53 <li><a class="reference external" href="#ba-class">ba_class</a></li>
952     <li><a class="reference external" href="#vu-module">vu_module</a></li>
953     <li><a class="reference external" href="#cal-module">cal_module</a></li>
954     <li><a class="reference external" href="#io-module">io_module</a></li>
955     <li><a class="reference external" href="#mdl-module">mdl_module</a></li>
956 clausted 54 <li><a class="reference external" href="#fit-module">fit_module</a></li>
957 clausted 53 </ul>
958     </li>
959     </ul>
960    
961     <h4>Previous topic</h4>
962     <p class="topless"><a href="tutorial01.html"
963     title="previous chapter">OSPRAI Tutorial 1</a></p>
964     <h3>This Page</h3>
965     <ul class="this-page-menu">
966     <li><a href="_sources/mainapi.txt"
967     rel="nofollow">Show Source</a></li>
968     </ul>
969     <div id="searchbox" style="display: none">
970     <h3>Quick search</h3>
971     <form class="search" action="search.html" method="get">
972     <input type="text" name="q" size="18" />
973     <input type="submit" value="Go" />
974     <input type="hidden" name="check_keywords" value="yes" />
975     <input type="hidden" name="area" value="default" />
976     </form>
977     <p class="searchtip" style="font-size: 90%">
978     Enter search terms or a module, class or function name.
979     </p>
980     </div>
981     <script type="text/javascript">$('#searchbox').show(0);</script>
982     </div>
983     </div>
984     <div class="clearer"></div>
985     </div>
986     <div class="related">
987     <h3>Navigation</h3>
988     <ul>
989     <li class="right" style="margin-right: 10px">
990     <a href="genindex.html" title="General Index"
991     >index</a></li>
992     <li class="right" >
993     <a href="modindex.html" title="Global Module Index"
994     >modules</a> |</li>
995     <li class="right" >
996     <a href="tutorial01.html" title="OSPRAI Tutorial 1"
997     >previous</a> |</li>
998 clausted 54 <li><a href="index.html">osprai-doc v0.5-110215 documentation</a> &raquo;</li>
999 clausted 53 </ul>
1000     </div>
1001     <div class="footer">
1002     &copy; Copyright 2011, Christopher Lausted.
1003     Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
1004     </div>
1005     </body>
1006     </html>