From f04b45e4e92479ebb4b75969fa52d20b270bf3e7 Mon Sep 17 00:00:00 2001 From: Joy Zhang Date: Thu, 9 May 2024 14:52:32 -0700 Subject: [PATCH 1/2] Update units.py --- exposan/metab/units.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/exposan/metab/units.py b/exposan/metab/units.py index 401213c8..c696ccb2 100644 --- a/exposan/metab/units.py +++ b/exposan/metab/units.py @@ -436,6 +436,12 @@ def _init_state(self): self._dstate = self._state * 0. else: super()._init_state() + + @property + def ODE(self): + if self._ODE is None: + self._compile_ODE() + return self._ODE def _compile_ODE(self): cmps = self.components From c2bb9445fd3a5c8b22e62ea9d2983598c06fece1 Mon Sep 17 00:00:00 2001 From: Joy Zhang Date: Thu, 11 Jul 2024 09:05:30 -0700 Subject: [PATCH 2/2] attempt to control rounding error --- exposan/metab/units.py | 1 + 1 file changed, 1 insertion(+) diff --git a/exposan/metab/units.py b/exposan/metab/units.py index c696ccb2..ba5386ff 100644 --- a/exposan/metab/units.py +++ b/exposan/metab/units.py @@ -1057,6 +1057,7 @@ def _update_state(self): cmps = self.components n_cmps = len(cmps) n_gas = self._n_gas + self._state[self._state < 2.2e-16] = 0. y = self._state[-(n_cmps+n_gas+1):] i_mass = cmps.i_mass chem_MW = self.components.chem_MW