yoavram / curveball

Predicting microbial growth in a mixed culture from growth curve data
http://curveball.yoavram.com
Other
14 stars 5 forks source link

BUG: KeyError in find_max_growth_ci #136

Closed yoavram closed 8 years ago

yoavram commented 8 years ago

In dev branch.

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-13-560ed0dbbe8d> in <module>()
      4     low_K, K, high_K = curveball.models.find_K_ci(ds['param_samples_G'])
      5     print('* K = {:.3f} ({:.3f}, {:.3f}) -> {:.3f}'.format(K, low_K, high_K, ds['model_G'].best_values['K']))
----> 6     low_a, a, high_a, low_mu, mu, high_mu = curveball.models.find_max_growth_ci(ds['model_G'], ds['param_samples_G'])
      7     print('* maxr = {:.3f} ({:.3f}, {:.3f}) -> {:.2f}'.format(a, low_a, high_a, np.log(2)/a))
      8     print('* mu = {:.3f} ({:.3f}, {:.3f}) -> {:.2f}'.format(mu, low_mu, high_mu, np.log(2)/mu))

/Users/yoavram/Work/curveball_project/curveball/curveball/models.py in find_max_growth_ci(model_fit, param_samples, after_lag, ci)
    432     if not idx.all():
    433         warn("Warning: omitting {0} non-finite growth rate values".format(len(mumu) - idx.sum()))
--> 434     mumu = mumu[idx]
    435     est_mu = mumu.mean()
    436     low_mu = np.percentile(mumu, margin)

/Users/yoavram/Work/curveball_project/curveball/curveball/models.py in find_max_growth(model_fit, params, after_lag)
    365     mu = dfdt_y.max()
    366     i = dfdt_y.argmax()
--> 367     t2 = t[i]
    368     y2 = y[i]
    369 

KeyError: 'y0'