def test_simple(params): logy, logt = params integr, Cref, rd = with_units.main(logy=logy, logt=logt) Cout = integr.with_units('Cout') if logy or logt: assert allclose(Cout[:, 0, :], Cref, atol=2e-5*molar) else: assert allclose(Cout[:, 0, :], Cref, atol=1e-6*molar)
def test_simple_other_units(): unit_registry = SI_base_registry.copy() unit_registry['length'] = decimetre unit_registry['amount'] = umol integr, Cref, rd = with_units.main(unit_registry=unit_registry) Cout = integr.with_units('Cout') assert allclose(Cout[:, 0, :], Cref, atol=1e-6*molar)
def test_with_units(): rd = ReactionDiffusion.nondimensionalisation( 2, [[0, 0]], [[1]], [2/molar/second], unit_registry=SI_base_registry) assert allclose(rd.with_units('k'), [2e-3 * metre**3/mole/second])