diff --git a/overreact/cli.py b/overreact/cli.py index 659e1e83..0e97e7b6 100644 --- a/overreact/cli.py +++ b/overreact/cli.py @@ -658,6 +658,15 @@ def _prepare_simulation(scheme, k, concentrations): ) yield Markdown(f"Simulation data was saved to **{self.savepath}**") + if self.savepath is not None: + np.savetxt( + self.savepath, + np.block([t[:, np.newaxis], y(t).T]), + header=f"t,{','.join(self.model.scheme.compounds)}", + delimiter=",", + ) + yield f"CSV file saved to {self.savepath}" + def main(): """Command-line interface.""" diff --git a/tests/test_core.py b/tests/test_core.py index 03c5d9ca..1ff1343b 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -186,7 +186,8 @@ def test_private_functions_work(): ] ) ) - ) == ["E + S -> ES", "ES -> E + S", "ES -> ES‡", "ES‡ -> E + P"] + == ["E + S -> ES", "ES -> E + S", "ES -> ES‡", "ES‡ -> E + P"] + ) assert list( rx.core._unparse_reactions(