Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrator instance, not class #47

Merged
merged 5 commits into from
Jan 14, 2024
Merged

Conversation

nstarman
Copy link
Contributor

@nstarman nstarman commented Jan 2, 2024

Instead of passing the integrator class and kwargs, you now pass an integrator instance. The integrators are equinox Modules (ie dataclasses) so the state is now reset by calling replace for each integration.


integrator = integrator_cls(self._integrator_F, **(integrator_kw or {}))
ws = integrator.run(qp0, t0, t1, ts)
ws = integrator_.run(self._integrator_F, qp0, t0, t1, ts) # type: ignore[arg-type]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very strange: _integrator_F is a FCallable. Shouldn't be erroring.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is it erroring? The type checker?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, mypy. Had to add the type ignore. Will need to investigate further

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

src/galax/integrate/_base.py Outdated Show resolved Hide resolved
@adrn
Copy link
Collaborator

adrn commented Jan 3, 2024

Ah, yes I think this is a good idea!

@nstarman nstarman marked this pull request as ready for review January 5, 2024 19:38
@nstarman nstarman marked this pull request as draft January 5, 2024 19:38
@nstarman nstarman marked this pull request as ready for review January 12, 2024 03:16
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
@nstarman
Copy link
Contributor Author

Fixed. And merging in.

@nstarman nstarman merged commit 49c36e6 into GalacticDynamics:main Jan 14, 2024
10 checks passed
@nstarman nstarman deleted the integrator branch January 14, 2024 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants