ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/osprai/osprai/trunk/mdl_module.py
(Generate patch)
# Line 2 | Line 2
2   mdl_module
3   -------------------------------------------------------------------------------
4  
5 < **Example model functions module for SPRI data.**
5 > *Example model functions module for SPRI data.*
6   Just a few simple, common interaction models will go here.
7   In the future, each new model will go in its own module/file.
8 < Each model is a function taking three parameters
8 > Each model is a function taking three parameters.
9 >
10 > **Parameters:**
11 >  * *time* (numpy array) -- Time points, usually in seconds.
12 >  * *data* (numpy array) -- Initial SPR signal values.
13 >  * *params* (dictionary of dictionaries) -- Model parameter description.  
14 >  
15 > **Returns:** numpy array of calculated SPR signal values.
16  
10 1. *time*    An array of time values, usually in seconds.
11 2. *data*    An array of initial SPR signal values.
12 3. *params*  A dictionary of dictionaries.  
13
17   The dictionary keys are the names of model parameters
18   (e.g. 'rmax' for maximal response, or 'kon' for kinetic on-rate).
19   Each model parameter is described by a subdictionary containing four entries.
20  
21 < 1. *'value'*  The current value of the parameter.
22 < 2. *'min'*    The minimum allowable value.
23 < 3. *'max'*    The maximum allowable value.
24 < 4. *'fixed'*  Either 'float', 'fixed', or a reference to another ROI.
21 >  * ``'value'``  The current value of the parameter.
22 >  * ``'min'``    The minimum allowable value.
23 >  * ``'max'``    The maximum allowable value.
24 >  * ``'fixed'``  Either 'float', 'fixed', or a reference to another ROI.
25  
26 < The *min*, *max*, and *fixed* keys are used during automatic curve-fitting.
26 > The ``min``, ``max``, and ``fixed`` keys are used during automatic curve-fitting.
27   A fixed parameter is not allowed to change, while a float parameter is adjusted
28   until the least-squares algorithm has minimized the sum-squared error.
29   The *fixed* parameter may also be an integer, in which case it is fixed to
# Line 41 | Line 44
44    >>> times = np.arange(100)
45    >>> data = np.zeros(100)
46    >>>
47 <  >>> params1 = dict(rate=dict(value=1.0, min=-100.0, max=100.0, fixed=True))
47 >  >>> param1 = dict(rate=dict(value=1.0, min=-100.0, max=100.0, fixed=True))
48    >>> data1 = drift(time, data, param1)
49    >>>
50    >>> param2 = {'t1': {'value':30.0, 'min':30.0, 'max':30.0, 'fixed':True} }
# Line 53 | Line 56
56    >>> param2['t3'] =    {'value': 270.0}
57    >>> data2 = simple1to1(time, data, param2)
58   """
59 < __version__ = "110215"
59 > __version__ = "110216"
60  
61  
62   ## Import libraries
# Line 67 | Line 70
70      It requires numpy arrays of times and starting data values,
71      It only requires one parameter in the params list.
72      
73 <    params['rate']['value']
71 <    
72 <    :param time: Time points.
73 <    :type time: numpy array
74 <    :param data: SPR signal values.
75 <    :type data: numpy array
76 <    :param params: Binding model parameter description.
77 <    :type params: dictionary of dictionaries
78 <    :returns: numpy array
73 >    ``params['rate']['value']``
74      """
75      y = np.zeros(len(time), dtype=float)
76      try:
# Line 97 | Line 92
92   def simple1to1(time, data, params):
93      """
94      This function simply models a 1:1 interaction.
95 +    The model parameters are described in the table below.
96      
97      Model::
98      
# Line 169 | Line 165
165   def simple1to1_mtl(time, data, params):
166      """
167      This function simply models a 1:1 interaction with mass transport limitation.
168 +    The model parameters are described in the table below.
169      
170      Model::
171      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines