(Generate patch)
# Line 135 | Line 135
135      t3 = float(params['t3']['value'])
136      if ('cofa' in params.keys()):
137          conc *= float(params['cofa']['value'])
138 <
138 >
139 >    ## Initialize variables.
140 >    errlog = {}  ## Error status dictionary.
141      y = np.zeros(len(time), dtype=float)
142      base = y[0] = data[0]  ## Baseline SPR signal.
143
# Line 150 | Line 152
152              ## Binding phase
153              yb = y[i-1] - base
154              dy = conc*kon*(rmax-yb) - koff*yb
153            if (abs(y[i-1]) > 999999999): dy = 0  ## Is this useful?
155              y[i] = y[i-1] + dy*dt
156 +            ## Check if we overshot the maximum response.
157 +            if (y[i] > (base+rmax)):
158 +                y[i] = base+rmax
159 +                errlog['Response overshot rmax.'] = True
160          elif (t2 < time[i] <= t3):
161              ## Dissociation (conc=0)
162              yb = y[i-1]-base
163              dy = 0 - koff*yb
164              y[i] = y[i-1] + dy*dt
165 +
166 +    if any(errlog): print "Errors in simple1to1:", errlog.keys()
167
168      return y
169      """End of simple1to1() function"""
# Line 212 | Line 219
219          conc *= float(params['cofa']['value'])
220
221      ## Initialize variables.
222 <    stat = {}  ## Error status dictionary.
222 >    errlog = {}  ## Error status dictionary.
223      y = np.zeros(len(time), dtype=float)
224      base = y[0] = data[0]  ## Baseline SPR signal.
225
# Line 233 | Line 240
240              ## Binding phase
241              yb = y[i-1] - base
242              dy = (conc*kon*(rmax-yb) - koff*yb) / (1 + kon*(rmax-yb)/kmtl)
236            ## Check for integration errors producing wild results.
237            if (abs(y[i-1]) > 9e9): dy = 0; stat['y>9e9'] = True
243              y[i] = y[i-1] + dy*dt
244 +            ## Check if we overshot the maximum response.
245 +            if (y[i] > (base+rmax)):
246 +                y[i] = base+rmax
247 +                errlog['Response overshot rmax.'] = True
248          elif (t2 < time[i] <= t3):
249              ## Dissociation (conc=0)
250              yb = y[i-1] - base
251              dy = (0 - koff*yb) / (1 + kon*(rmax-yb)/kmtl)
252              y[i] = y[i-1] + dy*dt
253
254 <    if (len(stat.keys()) > 0): print "Errors in simple1to1:", stat.keys()
254 >    if any(errlog): print "Errors in simple1to1:", errlog.keys()
255
256      return y
257      """End of simple1to1_mtl() function"""

Diff Legend

 – Removed lines + Added lines < Changed lines > Changed lines