COMPASS-DOE / PoolDilutionR

Home of PoolDilutionR, a package for easily calculating gross rates from isotope pool dilution data
Other
3 stars 0 forks source link

ap_prediction behavior #6

Open bpbond opened 1 year ago

bpbond commented 1 year ago

Behaviors to expect (and thus test for) from ap_prediction:

No production or consumption

If inputs P = k = 0.0 , then outputs mt and nt should be constant and equal to m0 and n0 respectively.

Currently NaN values are returned due to the P/k division:

> ap_prediction(time = 0:5, m0 = 10, n0 = 1, P = 0.0, k = 0.0)
   mt  nt AP_pred
1 NaN NaN     NaN
2 NaN NaN     NaN
3 NaN NaN     NaN
4 NaN NaN     NaN
5 NaN NaN     NaN
6 NaN NaN     NaN

No methane and no production

A variant of the previous one. If inputs P = m0 = n0 = 0.0 , then outputs mt and nt should be constant zero. This works:

> ap_prediction(time = 0:5, m0 = 0, n0 = 0, P = 0.0, k = 0.1)
  mt nt AP_pred
1  0  0     NaN
2  0  0     NaN
3  0  0     NaN
4  0  0     NaN
5  0  0     NaN
6  0  0     NaN

No discrimination

If inputs frac_P = frac_k = 1.0 , then output AP_pred should be constant.

Right now this doesn't happen:

> ap_prediction(time = 0:5, m0 = 10, n0 = 1, P = 0.5, k = 0.3, frac_P = 1, frac_k = 1)
         mt       nt  AP_pred
1 10.000000 1.000000 10.00000
2  7.840152 1.172788 14.95874
3  6.240097 1.300792 20.84571
4  5.054747 1.395620 27.61009
5  4.176618 1.465871 35.09707
6  3.526085 1.517913 43.04812

@kendalynnm Does this make sense to you? Other tests/thoughts?