ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/osprai/osprai/trunk/mdl_module.py
(Generate patch)
# Line 44 | Line 44
44                    
45   Examples::
46  
47 <  >>> import mdl_module as mdl
48 <  >>> import numpy as np
47 >  >>> import mdl_module as mdl, numpy as np
48    >>> times, data = np.arange(300), np.zeros(300)
49    >>>
50    >>> param1 = {'rate': {'value':1.0, 'min':-10.0, 'max':10.0, 'fixed':True} }
# Line 70 | Line 69
69    160.3
70    
71   """
72 < __version__ = "110517"
72 > __version__ = "110519"
73  
74  
75   ## Import libraries
# Line 78 | Line 77
77   from copy import deepcopy
78  
79  
80 < def drift(time, data, params):
80 > def noise(time, data, params):
81      """
82 <    This function simply models a constant signal drift in units/second.
82 >    This function simply adds gaussian noise.
83      It requires numpy arrays of times and starting data values,
84 <    It only requires one parameter in the params list.
84 >    It only requires one parameter in the params list,
85 >    ``params['rms']['value']``.
86 >    """
87 >    noise = float(params['rms']['value'])
88 >    return (noise * np.random.randn(len(data)) + data)
89      
90 <    ``params['rate']['value']``
90 >
91 > def drift(time, data, params):
92 >    """
93 >    This function simply models a constant signal drift in units/second.
94 >    It requires numpy arrays of times and starting data values.
95 >    It only requires one parameter in the params list,    
96 >    ``params['rate']['value']``.
97      """
98      y = np.zeros(len(time), dtype=float)
99      try:
# Line 207 | Line 216
216        160.3
217      """
218      dpar = {}
219 <    dpar['rmax'] =  dict(value=1e3,   min=1e1,   max=1e4,   fixed=True)
220 <    dpar['conc'] =  dict(value=1e-6,  min=1e-12, max=1e-1,  fixed=True)
221 <    dpar['cofa'] =  dict(value=1.0,   min=1e-6,  max=1e6,   fixed=True)
222 <    dpar['t1'] =    dict(value=100.0, min=100.0, max=100.0, fixed=True)
223 <    dpar['kon'] =   dict(value=1e4,   min=1e2,   max=1e7,   fixed=True)
224 <    dpar['t2'] =    dict(value=200.0, min=200.0, max=200.0, fixed=True)
225 <    dpar['koff'] =  dict(value=1e-2,  min=1e-6,  max=1e-1,  fixed=True)
226 <    dpar['t3'] =    dict(value=300.0, min=300.0, max=300.0, fixed=True)
219 >    dpar['rmax'] =  dict(value=1e3,   min=1e1,   max=1e4,   fixed='fixed')
220 >    dpar['conc'] =  dict(value=1e-6,  min=1e-12, max=1e-1,  fixed='fixed')
221 >    dpar['cofa'] =  dict(value=1.0,   min=1e-6,  max=1e6,   fixed='fixed')
222 >    dpar['t1'] =    dict(value=100.0, min=100.0, max=100.0, fixed='fixed')
223 >    dpar['kon'] =   dict(value=1e4,   min=1e2,   max=1e7,   fixed='fixed')
224 >    dpar['t2'] =    dict(value=200.0, min=200.0, max=200.0, fixed='fixed')
225 >    dpar['koff'] =  dict(value=1e-2,  min=1e-6,  max=1e-1,  fixed='fixed')
226 >    dpar['t3'] =    dict(value=300.0, min=300.0, max=300.0, fixed='fixed')
227      return dpar
228  
229  
# Line 316 | Line 325
325        161.1
326      """
327      dpar = simple1to1_def_params()  ## Based on simple1to1.
328 <    dpar['kmtl'] = dict(value=1e9, min=1e2, max=1e10, fixed=True)
328 >    dpar['kmtl'] = dict(value=1e9, min=1e2, max=1e10, fixed='fixed')
329      return dpar
330  
331  
# Line 421 | Line 430
430        160.3
431      """
432      dpar = {}
433 <    dpar['kon'] =  dict(value=1e4,   min=1e2,   max=1e7,   fixed=True)
434 <    dpar['koff'] = dict(value=1e-2,  min=1e-6,  max=1e-1,  fixed=True)
435 <    dpar['rmax'] = dict(value=1e3,   min=1e1,   max=1e4,   fixed=True)
436 <    dpar['tp'] =   dict(value=-50.0, min=-50.0, max=-50.0, fixed=True)
437 <    dpar['ta'] =   dict(value=100.0, min=100.0, max=100.0, fixed=True)
438 <    dpar['td'] =   dict(value=100.0, min=100.0, max=100.0, fixed=True)
433 >    dpar['kon'] =  dict(value=1e4,   min=1e2,   max=1e7,   fixed='fixed')
434 >    dpar['koff'] = dict(value=1e-2,  min=1e-6,  max=1e-1,  fixed='fixed')
435 >    dpar['rmax'] = dict(value=1e3,   min=1e1,   max=1e4,   fixed='fixed')
436 >    dpar['tp'] =   dict(value=-50.0, min=-50.0, max=-50.0, fixed='fixed')
437 >    dpar['ta'] =   dict(value=100.0, min=100.0, max=100.0, fixed='fixed')
438 >    dpar['td'] =   dict(value=100.0, min=100.0, max=100.0, fixed='fixed')
439      ## Set all eight concentrations to 1uM.
440      for key in ['c0','c1','c2','c3','c4','c5','c6','c7']:
441 <        dpar[key] = dict(value=1e-6,  min=1e-12, max=1e-1,  fixed=True)
441 >        dpar[key] = dict(value=1e-6,  min=1e-12, max=1e-1,  fixed='fixed')
442      ## Just describe the first injection at t0=100s.
443      for key in ['t0','t1','t2','t3','t4','t5','t6','t7']:
444 <        dpar[key] = dict(value=0.0,  min=0.0,  max=0.0,   fixed=True)
445 <    dpar['t0'] = dict(value=100.0, min=100.0, max=100.0, fixed=True)
444 >        dpar[key] = dict(value=0.0,  min=0.0,  max=0.0,   fixed='fixed')
445 >    dpar['t0'] = dict(value=100.0, min=100.0, max=100.0, fixed='fixed')
446      return dpar
447  
448  
# Line 462 | Line 471
471      return
472  
473   if __name__ == "__main__":
474 <    """
466 <    Code testing.  
467 <    Simply execute 'python mdl_module.py'.
468 <    """
474 >    """Use 'python mdl_module.py' for code testing."""
475      _test()
476  
477   ################################# End of module ###############################

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines