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

Fix callbacks in run_tardis #1165

Merged
merged 3 commits into from
Jun 1, 2020
Merged

Fix callbacks in run_tardis #1165

merged 3 commits into from
Jun 1, 2020

Conversation

Rodot-
Copy link
Contributor

@Rodot- Rodot- commented May 26, 2020

run_tardis allows users to specify a list of callbacks to be run at each iteration of the simulation. The current version does not allow a user to specify any extra arguments or access any attributes of the simulation itself.

Description

when run_tardis allocates callbacks, it now adds them using the *unpacking syntax to allow for arguments to be passed along with the callback function. This allows users to specify functions that can act on the simulation object itself as well as provide extra arguments.

Motivation and Context

The ability to use callbacks with the tardis model was severely limited. Now callbacks can give live feedback on the simulation as it runs.

How Has This Been Tested?

I ran through the test modules and none of the failed. I also wrote a few functions to perform various simple tasks like printing the iteration number at each iteration. The examples in the documentation offer a test of the changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@wkerzendorf
Copy link
Member

Looks great - can you add to the documentation

@Rodot- Rodot- marked this pull request as draft May 27, 2020 15:01
@Rodot- Rodot- marked this pull request as ready for review May 27, 2020 16:12
@arjunsavel arjunsavel self-requested a review May 27, 2020 16:13
@Rodot- Rodot- marked this pull request as draft May 27, 2020 16:17
@Rodot- Rodot- requested a review from marxwillia May 27, 2020 17:45
@Rodot- Rodot- marked this pull request as ready for review May 29, 2020 18:19
Copy link
Contributor

@marxwillia marxwillia left a comment

Choose a reason for hiding this comment

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

Tests pass and added functionality will be very useful for writing diagnostics to run during simulations.

Copy link
Contributor

@arjunsavel arjunsavel left a comment

Choose a reason for hiding this comment

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

Looks good to me! And we chatted about making the documentation build — glad it worked out.

@Rodot- Rodot- merged commit 5cf3786 into tardis-sn:master Jun 1, 2020
atharva-2001 pushed a commit to atharva-2001/tardis that referenced this pull request Oct 1, 2021
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.

4 participants