ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/osprai/osprai/trunk/sphinx/_build/html/mainapi.html
Revision: 53
Committed: Wed Feb 16 01:56:39 2011 UTC (8 years, 8 months ago) by clausted
File size: 53991 byte(s)
Log Message:
Add mdl_module documentation.  Also add sphinx html output to svn repository.
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     <title>The Application Program Interface &mdash; osprai-doc v0.1-110210 documentation</title>
9     <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     VERSION: '0.1-110210',
15     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     <link rel="top" title="osprai-doc v0.1-110210 documentation" href="index.html" />
23     <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     <li><a href="index.html">osprai-doc v0.1-110210 documentation</a> &raquo;</li>
39     </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     </div>
53     <div class="section" id="module-mdl_module">
54     <h1>The Python Source Code<a class="headerlink" href="#module-mdl_module" title="Permalink to this headline">¶</a></h1>
55     <div class="section" id="ba-class">
56     <h2>ba_class<a class="headerlink" href="#ba-class" title="Permalink to this headline">¶</a></h2>
57     <p>Biosensor Array class for storing SPRI data.
58     This contains an array of SPR sensorgrams with their
59     associated models and parameters.
60     This can also contain the microarray geometery.</p>
61     <p>Examples:</p>
62     <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>
63     <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>
64     <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>
65     <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>
66     </pre></div>
67     </div>
68     <dl class="class">
69     <dt id="ba_class.BiosensorArray">
70     <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>
71     <dd><p>The Biosensor Array class holds all ROIs (spots)
72     from an SPRI microarray run.</p>
73     <table border="1" class="docutils">
74     <colgroup>
75     <col width="23%" />
76     <col width="21%" />
77     <col width="56%" />
78     </colgroup>
79     <tbody valign="top">
80     <tr><td>Property</td>
81     <td>Type</td>
82     <td>Description</td>
83     </tr>
84     <tr><td>roi</td>
85     <td>list of object</td>
86     <td>List of RegOfInterest objects.</td>
87     </tr>
88     <tr><td>rois</td>
89     <td>integer</td>
90     <td>Size of roi (Number of ROIs).</td>
91     </tr>
92     <tr><td>dpoints</td>
93     <td>integer</td>
94     <td>Number of datapoints in each ROI.</td>
95     </tr>
96     <tr><td>primarydatafiles</td>
97     <td>list of string</td>
98     <td>List of file names.</td>
99     </tr>
100     <tr><td>comments</td>
101     <td>list of string</td>
102     <td>List of comments regarding experiments.</td>
103     </tr>
104     </tbody>
105     </table>
106     <dl class="method">
107     <dt id="ba_class.BiosensorArray.set_plot_all">
108     <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>
109     <dd>Choose to plot every sensorgram.</dd></dl>
110    
111     <dl class="method">
112     <dt id="ba_class.BiosensorArray.set_plot_list">
113     <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>
114     <dd>Choose a list of sensorgrams to plot</dd></dl>
115    
116     <dl class="method">
117     <dt id="ba_class.BiosensorArray.xy2uid">
118     <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>
119     <dd>Given roi coordinates, find corresponding uid (index).</dd></dl>
120    
121     </dd></dl>
122    
123     <dl class="class">
124     <dt id="ba_class.RegOfInterest">
125     <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>
126     <dd><p>This Region Of Interest class can hold one SPR sensorgram.</p>
127     <table border="1" class="docutils">
128     <colgroup>
129     <col width="15%" />
130     <col width="21%" />
131     <col width="63%" />
132     </colgroup>
133     <tbody valign="top">
134     <tr><td>Property</td>
135     <td>Type</td>
136     <td>Description</td>
137     </tr>
138     <tr><td>uid</td>
139     <td>integer</td>
140     <td>Unique ID integer. Never changes.</td>
141     </tr>
142     <tr><td>index</td>
143     <td>integer</td>
144     <td>Changes if ba size changes (add/remove rois).</td>
145     </tr>
146     <tr><td>time</td>
147     <td>nparray</td>
148     <td>Usually seconds.</td>
149     </tr>
150     <tr><td>value</td>
151     <td>nparray</td>
152     <td>Arbitrary units.</td>
153     </tr>
154     <tr><td>dpoints</td>
155     <td>integer</td>
156     <td>Can use for bounds checking.</td>
157     </tr>
158     <tr><td>name</td>
159     <td>string</td>
160     <td>Name of ROI.</td>
161     </tr>
162     <tr><td>desc</td>
163     <td>string</td>
164     <td>Description of ROI</td>
165     </tr>
166     <tr><td>gridx</td>
167     <td>integer</td>
168     <td>Can be Block number from GAL file.</td>
169     </tr>
170     <tr><td>gridy</td>
171     <td>integer</td>
172     <td>Unused?</td>
173     </tr>
174     <tr><td>spotx</td>
175     <td>integer</td>
176     <td>ROI column number.</td>
177     </tr>
178     <tr><td>spoty</td>
179     <td>integer</td>
180     <td>ROI row number.</td>
181     </tr>
182     <tr><td>bgroi</td>
183     <td>list of integer</td>
184     <td>One or more background ROIs.</td>
185     </tr>
186     <tr><td>calibM</td>
187     <td>float</td>
188     <td>Slope used for calibration</td>
189     </tr>
190     <tr><td>calibB</td>
191     <td>float</td>
192     <td>Intercept used for calibration.</td>
193     </tr>
194     <tr><td>plottable</td>
195     <td>boolean</td>
196     <td>Whether to plot</td>
197     </tr>
198     <tr><td>injconc</td>
199     <td>list of float</td>
200     <td>One or more analyte concentrations.</td>
201     </tr>
202     <tr><td>injstart</td>
203     <td>list of float</td>
204     <td>One or more injection start times.</td>
205     </tr>
206     <tr><td>injstop</td>
207     <td>list of float</td>
208     <td>One or more injection start times.</td>
209     </tr>
210     <tr><td>injrind</td>
211     <td>list of float</td>
212     <td>One or more expected refractive index jumps.</td>
213     </tr>
214     <tr><td>flow</td>
215     <td>float</td>
216     <td>Flowrate of injection.</td>
217     </tr>
218     <tr><td>model</td>
219     <td>ref to funct</td>
220     <td>Model describing this ROI.</td>
221     </tr>
222     <tr><td>params</td>
223     <td>dict of dict</td>
224     <td>Parameters for this model.</td>
225     </tr>
226     </tbody>
227     </table>
228     <dl class="method">
229     <dt id="ba_class.RegOfInterest.time2dp">
230     <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>
231     <dd>Find datapoint closest to given time.</dd></dl>
232    
233     <dl class="method">
234     <dt id="ba_class.RegOfInterest.time2val">
235     <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>
236     <dd>Return list of SPR values between t1 and t2</dd></dl>
237    
238     </dd></dl>
239    
240     </div>
241     <div class="section" id="vu-module">
242     <h2>vu_module<a class="headerlink" href="#vu-module" title="Permalink to this headline">¶</a></h2>
243     <p>This is the viewer module for SPR data in a ba_class.
244     Traces can be displayed as dotted lines, continuous lines, or combinations.
245     Typically, up to six traces are displayed at a time.
246     Features include zooming, measurements, and save-to-PNG.
247     Graphics utilize the old Tk GUI toolkit.</p>
248     <p>Examples:</p>
249     <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>
250     <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>
251     <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>
252     <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>
253     <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>
254     <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>
255     <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>
256     </pre></div>
257     </div>
258     <dl class="function">
259     <dt id="vu_module.dotgraph">
260     <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>
261     <dd><p>Display signal vs time using dotted lines.</p>
262     <table class="docutils field-list" frame="void" rules="none">
263     <col class="field-name" />
264     <col class="field-body" />
265     <tbody valign="top">
266     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
267     <li><em>baDot</em> (ba_class) &#8211; Object containing the data.</li>
268     <li><em>title</em> (str) &#8211; Title to place above the graph.</li>
269     </ul>
270     </td>
271     </tr>
272     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
273     </td>
274     </tr>
275     </tbody>
276     </table>
277     </dd></dl>
278    
279     <dl class="function">
280     <dt id="vu_module.dualgraph">
281     <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>
282     <dd><p>Display signal vs time using dotted AND continuous lines.</p>
283     <table class="docutils field-list" frame="void" rules="none">
284     <col class="field-name" />
285     <col class="field-body" />
286     <tbody valign="top">
287     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
288     <li><em>baDot</em> (ba_class) &#8211; Object containing the dotted-line data.</li>
289     <li><em>baLine</em> (ba_class) &#8211; Object containing the continuous-line data.</li>
290     <li><em>title</em> (str) &#8211; Title to place above the graph.</li>
291     </ul>
292     </td>
293     </tr>
294     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
295     </td>
296     </tr>
297     </tbody>
298     </table>
299     </dd></dl>
300    
301     <dl class="function">
302     <dt id="vu_module.linegraph">
303     <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>
304     <dd><p>Display signal vs time using continuous lines.</p>
305     <table class="docutils field-list" frame="void" rules="none">
306     <col class="field-name" />
307     <col class="field-body" />
308     <tbody valign="top">
309     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
310     <li><em>baLine</em> (ba_class) &#8211; Object containing the data.</li>
311     <li><em>title</em> (str) &#8211; Title to place above the graph.</li>
312     </ul>
313     </td>
314     </tr>
315     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
316     </td>
317     </tr>
318     </tbody>
319     </table>
320     </dd></dl>
321    
322     <dl class="function">
323     <dt id="vu_module.scatterplot">
324     <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>
325     <dd><p>Plot binding changes between (t4-t3) versus (t2-t1).
326     Also print the results to the standard output.</p>
327     <table class="docutils field-list" frame="void" rules="none">
328     <col class="field-name" />
329     <col class="field-body" />
330     <tbody valign="top">
331     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
332     <li><em>ba0</em> (ba_class) &#8211; Object containing the data.</li>
333     <li><em>t1</em> (float) &#8211; Timepoint before binding, first axis.</li>
334     <li><em>t2</em> (float) &#8211; Timepoint after binding, first axis.</li>
335     <li><em>t3</em> (float) &#8211; Timepoint before binding, second axis.</li>
336     <li><em>t4</em> (float) &#8211; Timepoint after binding, second axis.</li>
337     <li><em>title</em> (str) &#8211; Title to place above the graph.</li>
338     </ul>
339     </td>
340     </tr>
341     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
342     </td>
343     </tr>
344     </tbody>
345     </table>
346     </dd></dl>
347    
348     </div>
349     <div class="section" id="cal-module">
350     <h2>cal_module<a class="headerlink" href="#cal-module" title="Permalink to this headline">¶</a></h2>
351     <p>Calibration module for SPRI data in a ba_class.
352     This uses a known jump in index to turn arbitrary units into RIU.
353     Other routines provide background subtraction and data rearrangement.</p>
354     <p>Examples:</p>
355     <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>
356     <span class="gp">&gt;&gt;&gt; </span><span class="n">io_module</span> <span class="k">as</span> <span class="n">io</span>
357     <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>
358     <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>
359     <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>
360     <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>
361     <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>
362     </pre></div>
363     </div>
364     <dl class="function">
365     <dt id="cal_module.bgset">
366     <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>
367     <dd><p>Set i as the background ROI for all of the ROIs.</p>
368     <table class="docutils field-list" frame="void" rules="none">
369     <col class="field-name" />
370     <col class="field-body" />
371     <tbody valign="top">
372     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
373     <li><em>ba0</em> (ba_class) &#8211; Object containing the data to be calibrated.</li>
374     <li><em>i</em> (ba_class) &#8211; Object containing the data to be calibrated.</li>
375     </ul>
376     </td>
377     </tr>
378     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
379     </td>
380     </tr>
381     </tbody>
382     </table>
383     </dd></dl>
384    
385     <dl class="function">
386     <dt id="cal_module.bgsubt">
387     <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>
388     <dd><p>Apply the background subtraction and return a new ba object.</p>
389     <table class="docutils field-list" frame="void" rules="none">
390     <col class="field-name" />
391     <col class="field-body" />
392     <tbody valign="top">
393     <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>
394     </tr>
395     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">A new ba object</td>
396     </tr>
397     </tbody>
398     </table>
399     </dd></dl>
400    
401     <dl class="function">
402     <dt id="cal_module.calibrate">
403     <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>
404     <dd><p>Use data in baCal to calibrate ba0.
405     A simple two-point linear calibration using timepoints t1 and t2 and
406     corresponding refractive indices n1 and n2.
407     Average 30 seconds of data (t-15 to 5+15 seconds).
408     The ba object returned will remember the slopes and intercepts used.</p>
409     <table class="docutils field-list" frame="void" rules="none">
410     <col class="field-name" />
411     <col class="field-body" />
412     <tbody valign="top">
413     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
414     <li><em>ba0</em> (ba_class) &#8211; Object containing the data to be calibrated.</li>
415     <li><em>baCal</em> (ba_class) &#8211; Object containing the data to be calibrated.</li>
416     <li><em>t1</em> (float) &#8211; Timepoint where refractive index = n1</li>
417     <li><em>t2</em> (float) &#8211; Timepoint where refractive index = n2</li>
418     <li><em>n1</em> (float) &#8211; First refractive index. Default=1335700 (~1x PBS).</li>
419     <li><em>n2</em> (float) &#8211; Second refractive index. Default=1336600 (~2x PBS).</li>
420     </ul>
421     </td>
422     </tr>
423     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">nothing</p>
424     </td>
425     </tr>
426     </tbody>
427     </table>
428     </dd></dl>
429    
430     <dl class="function">
431     <dt id="cal_module.copyinterval">
432     <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>
433     <dd><p>Copy data from the interval between t1 and t2 and return a new ba object.</p>
434     <table class="docutils field-list" frame="void" rules="none">
435     <col class="field-name" />
436     <col class="field-body" />
437     <tbody valign="top">
438     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
439     <li><em>ba0</em> (ba_class) &#8211; Object containing the source data.</li>
440     <li><em>t1</em> (float) &#8211; Beginning timepoint.</li>
441     <li><em>t2</em> (float) &#8211; Ending timepoint.</li>
442     </ul>
443     </td>
444     </tr>
445     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A new ba object</p>
446     </td>
447     </tr>
448     </tbody>
449     </table>
450     </dd></dl>
451    
452     <dl class="function">
453     <dt id="cal_module.flattenlist">
454     <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>
455     <dd><p>Flatten nested lists into one list.</p>
456     <table class="docutils field-list" frame="void" rules="none">
457     <col class="field-name" />
458     <col class="field-body" />
459     <tbody valign="top">
460     <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>
461     </tr>
462     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">flat list</td>
463     </tr>
464     </tbody>
465     </table>
466     </dd></dl>
467    
468     <dl class="function">
469     <dt id="cal_module.zerotime">
470     <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>
471     <dd><p>Adjust sensorgrams to start at time[0]=0.</p>
472     <table class="docutils field-list" frame="void" rules="none">
473     <col class="field-name" />
474     <col class="field-body" />
475     <tbody valign="top">
476     <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>ba</em> (ba_class) &#8211; Object containing the data.</td>
477     </tr>
478     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">nothing</td>
479     </tr>
480     </tbody>
481     </table>
482     </dd></dl>
483    
484     <dl class="function">
485     <dt id="cal_module.zerovalue">
486     <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>
487     <dd><p>Adjust sensorgrams to start at value[0]=0.</p>
488     <table class="docutils field-list" frame="void" rules="none">
489     <col class="field-name" />
490     <col class="field-body" />
491     <tbody valign="top">
492     <tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>ba</em> (ba_class) &#8211; Object containing the data.</td>
493     </tr>
494     <tr class="field"><th class="field-name">Returns:</th><td class="field-body">nothing</td>
495     </tr>
496     </tbody>
497     </table>
498     </dd></dl>
499    
500     </div>
501     <div class="section" id="io-module">
502     <h2>io_module<a class="headerlink" href="#io-module" title="Permalink to this headline">¶</a></h2>
503     <p>Input/Output module for converting files to Biosensor Array class.
504     Supported sensorgram types include Biosensor, CLAMP, SPRit, and Plexera ICM.
505     Supported microarray types include GAL and ISB Map.</p>
506     <p>Examples:</p>
507     <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>
508     <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>
509     <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>
510     <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>
511     <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>
512     <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>
513     <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>
514     <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>
515     <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>
516     <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>
517     <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>
518     </pre></div>
519     </div>
520     <dl class="function">
521     <dt id="io_module.applygal">
522     <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>
523     <dd><p>Read a Gal file and apply its microarray information.</p>
524     <p><em>(This function is under construction)</em></p>
525     </dd></dl>
526    
527     <dl class="function">
528     <dt id="io_module.applykey">
529     <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>
530     <dd><p>Read a Key file and apply its microarray information.
531     Multiple background ROIs are not yet supported.
532     Here is a very simple example:</p>
533     <div class="highlight-python"><pre>No. Description1 Description2 Background ROI Col Row
534     1 Rat TNF Antibody01 2 1 1
535     2 ratIgG Antibody02 4 2 1
536     3 Hum TNF Antibody03 4 3 1
537     4 humIgG Antibody04 2 4 1</pre>
538     </div>
539     </dd></dl>
540    
541     <dl class="function">
542     <dt id="io_module.applymethod">
543     <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>
544     <dd><p>Read a ICM Analyte/Method xls file and apply its information.</p>
545     <p><em>(This feature is under construction.)</em></p>
546     </dd></dl>
547    
548     <dl class="function">
549     <dt id="io_module.outputbindinglevels">
550     <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>
551     <dd>Measure the binding level changes at multiple intervals along a sensorgram.
552     Write the data to a file. If interval is 500 and baselines are [100, 1100] then
553     binding levels are changes between 100-600s and between 1100-01600s.
554     Average 30s of data.</dd></dl>
555    
556     <dl class="function">
557     <dt id="io_module.readbiosensor">
558     <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>
559     <dd><p>Read a Biacore-style text file into a ba class.
560     Here is a very simple example of the tab-delimited format:</p>
561     <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
562     13.1 23.7644 93.1 0.713912
563     13.6 23.4265 93.6 0.0541172
564     14.1 23.1625 94.1 0.332768
565     14.6 23.5752 94.6 0.849459</pre>
566     </div>
567     </dd></dl>
568    
569     <dl class="function">
570     <dt id="io_module.readclamp">
571     <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>
572     <dd><p>Read a Clamp text file into a ba class.
573     It has two tab-delimited columns per SPR flowcell/roi..
574     It has a varying number of header lines with injection information.
575     Here is a very simple example with 2 rois and 3 datapoints:</p>
576     <div class="highlight-python"><pre>Vers 3.41 Data
577     Conc1 0 0 0 0
578     Start1 301.5 301.5 301.5 301.5
579     Stop1 949.8 949.8 949.8 949.8
580     RInd1 0 0 0 0
581     Conc2 0 0 0 0
582     Start2 986.4 0 0 0
583     Stop2 1626 0 0 0
584     RInd2 0 0 0 0
585     Flow 1 1 1 1
586     Time1 Data1 Time2 Data2
587     0.094 0.062 0.094 0.053
588     1.094 0.026 1.094 0.05
589     2.094 0.119 2.094 0.055</pre>
590     </div>
591     </dd></dl>
592    
593     <dl class="function">
594     <dt id="io_module.readcsv">
595     <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>
596     <dd><p>Read a comma-separated value text file into a ba class.
597     The first column contains time data while the others contain response data.
598     Here is a very simple example of the format:</p>
599     <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>
600     <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>
601     <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>
602     <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>
603     </pre></div>
604     </div>
605     </dd></dl>
606    
607     <dl class="function">
608     <dt id="io_module.readicmtxt">
609     <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>
610     <dd><p>Read a ICM text file into a ba class.
611     Here is a very simple example of the tab-delimited format:</p>
612     <div class="highlight-python"><pre>03/05/2010 13:37:21.312 249.408 0.000 0.000
613     03/05/2010 13:37:22.312 249.306 0.000 0.000</pre>
614     </div>
615     </dd></dl>
616    
617     <dl class="function">
618     <dt id="io_module.readsprit">
619     <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>
620     <dd><p>Read a SPRit text file into a ba class.
621     It has two tab-delimited columns and two header lines.
622     Here is a very simple example with 2 rois and 3 datapoints:</p>
623     <div class="highlight-python"><pre>Elapsed Time (Seconds) Average Intensity (Pixel Intensity)
624     BEGIN
625     0.000000e+000 2.863145e+003
626     5.013000e+000 2.863367e+003
627     1.002500e+001 2.862950e+003
628     0.000000e+000 2.862875e+003
629     5.013000e+000 2.862510e+003</pre>
630     </div>
631     </dd></dl>
632    
633     <dl class="function">
634     <dt id="io_module.writebiosensor">
635     <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>
636     <dd>Write a ba class to a Biosensor text file.</dd></dl>
637    
638     <dl class="function">
639     <dt id="io_module.writeclamp">
640     <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>
641     <dd>Write a ba class to a Clamp text file.</dd></dl>
642    
643     <dl class="function">
644     <dt id="io_module.writesprit">
645     <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>
646     <dd>Write a ba class to a SPRit text file.</dd></dl>
647    
648     </div>
649     <div class="section" id="mdl-module">
650     <h2>mdl_module<a class="headerlink" href="#mdl-module" title="Permalink to this headline">¶</a></h2>
651     <p><strong>Example model functions module for SPRI data.</strong>
652     Just a few simple, common interaction models will go here.
653     In the future, each new model will go in its own module/file.
654     Each model is a function taking three parameters</p>
655     <blockquote>
656     <ol class="arabic simple">
657     <li><em>time</em> An array of time values, usually in seconds.</li>
658     <li><em>data</em> An array of initial SPR signal values.</li>
659     <li><em>params</em> A dictionary of dictionaries.</li>
660     </ol>
661     </blockquote>
662     <p>The dictionary keys are the names of model parameters
663     (e.g. &#8216;rmax&#8217; for maximal response, or &#8216;kon&#8217; for kinetic on-rate).
664     Each model parameter is described by a subdictionary containing four entries.</p>
665     <blockquote>
666     <ol class="arabic simple">
667     <li><em>&#8216;value&#8217;</em> The current value of the parameter.</li>
668     <li><em>&#8216;min&#8217;</em> The minimum allowable value.</li>
669     <li><em>&#8216;max&#8217;</em> The maximum allowable value.</li>
670     <li><em>&#8216;fixed&#8217;</em> Either &#8216;float&#8217;, &#8216;fixed&#8217;, or a reference to another ROI.</li>
671     </ol>
672     </blockquote>
673     <p>The <em>min</em>, <em>max</em>, and <em>fixed</em> keys are used during automatic curve-fitting.
674     A fixed parameter is not allowed to change, while a float parameter is adjusted
675     until the least-squares algorithm has minimized the sum-squared error.
676     The <em>fixed</em> parameter may also be an integer, in which case it is fixed to
677     the value of a parameter of the same name in another ROI.</p>
678     <p>The model function returns an array of values obtained by numerical integration.
679     The model is represented by differential equations and integrated using the
680     rectangle rule or, preferentially, using the trapezoidal rule.</p>
681     <p>Examples:</p>
682     <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>
683     <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>
684     <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>
685     <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>
686     <span class="gp">&gt;&gt;&gt; </span>
687     <span class="gp">&gt;&gt;&gt; </span><span class="n">params1</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>
688     <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>
689     <span class="gp">&gt;&gt;&gt; </span>
690     <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>
691     <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>
692     <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>
693     <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>
694     <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>
695     <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>
696     <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>
697     <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>
698     </pre></div>
699     </div>
700     <dl class="function">
701     <dt id="mdl_module.drift">
702     <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>
703     <dd><p>This function simply models a constant signal drift in units/second.
704     It requires numpy arrays of times and starting data values,
705     It only requires one parameter in the params list.</p>
706     <p>params[&#8216;rate&#8217;][&#8216;value&#8217;]</p>
707     <table class="docutils field-list" frame="void" rules="none">
708     <col class="field-name" />
709     <col class="field-body" />
710     <tbody valign="top">
711     <tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
712     <li><em>time</em> (numpy array) &#8211; Time points.</li>
713     <li><em>data</em> (numpy array) &#8211; SPR signal values.</li>
714     <li><em>params</em> (dictionary of dictionaries) &#8211; Binding model parameter description.</li>
715     </ul>
716     </td>
717     </tr>
718     <tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">numpy array</p>
719     </td>
720     </tr>
721     </tbody>
722     </table>
723     </dd></dl>
724    
725     <dl class="function">
726     <dt id="mdl_module.simple1to1">
727     <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>
728     <dd><p>This function simply models a 1:1 interaction.</p>
729     <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     <dd><p>This function simply models a 1:1 interaction with mass transport limitation.</p>
788     <p>Model:</p>
789     <div class="highlight-python"><pre>[Abulk] --km-&gt; [Asurf] + [L] --kon--&gt; [AL]
790     [Abulk] &lt;-km-- [Asurf] + [L] &lt;-koff-- [AL]</pre>
791     </div>
792     <p>Derivation:</p>
793     <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>
794     <span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="n">AL</span><span class="p">]</span>
795     <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>
796     <span class="n">conc</span> <span class="o">=</span> <span class="p">[</span><span class="n">Abulk</span><span class="p">]</span>
797     <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>
798     <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>
799     </pre></div>
800     </div>
801     <table border="1" class="docutils">
802     <colgroup>
803     <col width="34%" />
804     <col width="66%" />
805     </colgroup>
806     <thead valign="bottom">
807     <tr><th class="head">Model Parameter</th>
808     <th class="head">Description</th>
809     </tr>
810     </thead>
811     <tbody valign="top">
812     <tr><td>params[&#8216;t1&#8217;][&#8216;value&#8217;]</td>
813     <td>time of injection for binding, (s)</td>
814     </tr>
815     <tr><td>params[&#8216;rmax&#8217;][&#8216;value&#8217;]</td>
816     <td>maximum response, (RIU)</td>
817     </tr>
818     <tr><td>params[&#8216;conc&#8217;][&#8216;value&#8217;]</td>
819     <td>concentration of analyte [Abulk], (M)</td>
820     </tr>
821     <tr><td>params[&#8216;kon&#8217;][&#8216;value&#8217;]</td>
822     <td>on-rate of analyte, (1/Ms)</td>
823     </tr>
824     <tr><td>params[&#8216;t2&#8217;][&#8216;value&#8217;]</td>
825     <td>time of end binding &amp; begin washing, (s)</td>
826     </tr>
827     <tr><td>params[&#8216;koff&#8217;][&#8216;value&#8217;]</td>
828     <td>off-rate of analyte, (1/s)</td>
829     </tr>
830     <tr><td>params[&#8216;t3&#8217;][&#8216;value&#8217;]</td>
831     <td>time end of washing &amp; data fitting, (s)</td>
832     </tr>
833     <tr><td>params[&#8216;kmtl&#8217;][&#8216;value&#8217;]</td>
834     <td>rate of diffusion, (RIU/Ms)</td>
835     </tr>
836     <tr><td><em>Optional</em></td>
837     <td>&nbsp;</td>
838     </tr>
839     <tr><td>params[&#8216;cofa&#8217;][&#8216;value&#8217;]</td>
840     <td>concentration factor, (1/dilution factor)</td>
841     </tr>
842     </tbody>
843     </table>
844     </dd></dl>
845    
846     </div>
847     </div>
848    
849    
850     </div>
851     </div>
852     </div>
853     <div class="sphinxsidebar">
854     <div class="sphinxsidebarwrapper">
855     <h3><a href="index.html">Table Of Contents</a></h3>
856     <ul>
857     <li><a class="reference external" href="#">The Application Program Interface</a></li>
858     <li><a class="reference external" href="#module-mdl_module">The Python Source Code</a><ul>
859     <li><a class="reference external" href="#ba-class">ba_class</a></li>
860     <li><a class="reference external" href="#vu-module">vu_module</a></li>
861     <li><a class="reference external" href="#cal-module">cal_module</a></li>
862     <li><a class="reference external" href="#io-module">io_module</a></li>
863     <li><a class="reference external" href="#mdl-module">mdl_module</a></li>
864     </ul>
865     </li>
866     </ul>
867    
868     <h4>Previous topic</h4>
869     <p class="topless"><a href="tutorial01.html"
870     title="previous chapter">OSPRAI Tutorial 1</a></p>
871     <h3>This Page</h3>
872     <ul class="this-page-menu">
873     <li><a href="_sources/mainapi.txt"
874     rel="nofollow">Show Source</a></li>
875     </ul>
876     <div id="searchbox" style="display: none">
877     <h3>Quick search</h3>
878     <form class="search" action="search.html" method="get">
879     <input type="text" name="q" size="18" />
880     <input type="submit" value="Go" />
881     <input type="hidden" name="check_keywords" value="yes" />
882     <input type="hidden" name="area" value="default" />
883     </form>
884     <p class="searchtip" style="font-size: 90%">
885     Enter search terms or a module, class or function name.
886     </p>
887     </div>
888     <script type="text/javascript">$('#searchbox').show(0);</script>
889     </div>
890     </div>
891     <div class="clearer"></div>
892     </div>
893     <div class="related">
894     <h3>Navigation</h3>
895     <ul>
896     <li class="right" style="margin-right: 10px">
897     <a href="genindex.html" title="General Index"
898     >index</a></li>
899     <li class="right" >
900     <a href="modindex.html" title="Global Module Index"
901     >modules</a> |</li>
902     <li class="right" >
903     <a href="tutorial01.html" title="OSPRAI Tutorial 1"
904     >previous</a> |</li>
905     <li><a href="index.html">osprai-doc v0.1-110210 documentation</a> &raquo;</li>
906     </ul>
907     </div>
908     <div class="footer">
909     &copy; Copyright 2011, Christopher Lausted.
910     Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
911     </div>
912     </body>
913     </html>