Skip to content

Commit

Permalink
Make get_y return a function and use a clever default for t_span (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
schneiderfelipe committed Oct 13, 2021
1 parent b6ad009 commit 933bff3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions overreact/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
3 changes: 2 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 933bff3

Please sign in to comment.