ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/osprai/osprai/trunk/test.py
(Generate patch)
# Line 1 | Line 1
1   """
2   Christopher Lausted, Institute for Systems Biology
3 < Last modified on 100519 (yymmdd)
3 > Last modified on 110519 (yymmdd)
4   Scripts to test various OSPRAI components.
5   """
6  
7 + ## Set the PYTHONPATH to your preferred OSPRAI installation.
8 + import sys
9 + sys.path.append("/home/clausted/Dropbox/ISB/subversion/osprai/trunk")
10 +
11   ## Import libaries
12   import ba_class
13   import vu_module
# Line 140 | Line 144
144      print "Done with test demo_mtl."
145  
146  
147 + def test_mdl_module_series():
148 +    print "Test the model module..."
149 +    
150 +    ## Multiple injection model (ba0)
151 +    ## Create ba with two ROIs and 950 datapoints.
152 +    ba0 = BiosensorArray(2,950)
153 +    for roi in ba0.roi:
154 +        roi.time = arange(950, dtype=float)  ## Samples every 1 second.
155 +        roi.value = zeros(950, dtype=float) + 20  ## Baseline signal is 20.
156 +        roi.params = simple1to1_series_def_params()
157 +        roi.model = simple1to1_series
158 +    ## Define ROI0
159 +    roi = ba0.roi[0]
160 +    roi.params['kon']['value'] = 1e4
161 +    roi.params['t0']['value'] = 100
162 +    roi.params['c0']['value'] = 1e-6
163 +    roi.params['t1']['value'] = 400
164 +    roi.params['c1']['value'] = 2e-6
165 +    roi.params['t2']['value'] = 700
166 +    roi.params['c2']['value'] = 4e-6
167 +    roi.value = roi.model(roi.time, roi.value, roi.params)
168 +    ## Define ROI1
169 +    roi = ba0.roi[1]
170 +    roi.params['kon']['value'] = 2e3
171 +    roi.params['t0']['value'] = 100
172 +    roi.params['c0']['value'] = 1e-6
173 +    roi.params['t1']['value'] = 400
174 +    roi.params['c1']['value'] = 2e-6
175 +    roi.params['t2']['value'] = 700
176 +    roi.params['c2']['value'] = 4e-6
177 +    roi.value = roi.model(roi.time, roi.value, roi.params)
178 +    
179 +    ## Single-injection model (ba1)
180 +    ba1 = BiosensorArray(2,950)
181 +    for roi in ba1.roi:
182 +        roi.time = arange(950, dtype=float)  ## Samples every 1 second.
183 +        roi.value = zeros(950, dtype=float) + 15  ## Baseline signal is 19.
184 +        roi.params = simple1to1_def_params()
185 +        roi.model = simple1to1
186 +    ## Define ROI0
187 +    roi = ba1.roi[0]
188 +    roi.params['kon']['value'] = 1e4
189 +    roi.params['conc']['value'] = 1e-6
190 +    roi.value = roi.model(roi.time, roi.value, roi.params)
191 +    ## Define ROI1
192 +    roi = ba1.roi[1]
193 +    roi.params['kon']['value'] = 2e3
194 +    roi.params['conc']['value'] = 1e-6
195 +    roi.value = roi.model(roi.time, roi.value, roi.params)
196 +    
197 +    ## Display graph.
198 +    dualgraph(ba0, ba1, "test_mdl_module_series")
199 +    return
200 +
201 +
202 +
203   ## Run selected test or tests.
204   #test_io_module()
205   #test_cal_module_vu_module()
206   #demo_mtl()
207 < test_mdl_module_fit_module()
207 > #test_mdl_module_fit_module()
208 > test_mdl_module_series()
209 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines