ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/osprai/osprai/trunk/mdl_module.py
Revision: 17
Committed: Thu Apr 22 00:22:37 2010 UTC (9 years, 6 months ago) by clausted
File size: 1082 byte(s)
Log Message:
Start work on curve fitting.  Added two properties, model and params, to ba.roi in ba_class.  Add mdl_module which will hold functions that model SPR interactions.  
Line File contents
1 """
2 mdl: Example model functions module for SPRI data.
3 Christopher Lausted, Institute for Systems Biology,
4 OSPRAI developers
5 Last modified on 100421 (yymmdd)
6
7 Example:
8 #import mdl_module as mdl
9 #params = {'Rate': {'value':1, 'min':-100.0, 'max':100.0, 'fixed':False} }
10 #params = dict(Rate = dict(value=1, min=0, max=10, fixed=False))
11 #times = range(100)
12 #data1 = drift(time, data0, params)
13 print data1
14 """
15 __version__ = "100421"
16
17
18 ## Import libraries
19 import numpy as np
20 #import ba_class as ba
21 #from copy import deepcopy
22
23
24 def drift(time, data0, params):
25 """
26 This function simply models a constant signal drift in units/second.
27 It requires numpys array of times and starting data values,
28 It only requires one parameter in the params list.
29 params['Rate']['value']
30 """
31 data1 = np.zeros(len(times))
32 try:
33 rate = params['Rate']['value']
34 except KeyError:
35 print "Error: Rate parameter not supplied to drift() model."
36 return data1
37
38 ## ToDo: Finish this code.
39
40 return data1