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

Avoid closing plots that are meant to be interactive. #1978

Merged

Conversation

ntouran
Copy link
Member

@ntouran ntouran commented Oct 26, 2024

What is the change?

This change puts the close() only in the code branches that are expected to be run non-interactively, e.g. compute code. That allows the system to keep memory clear during big runs while still allowing interactive and gallery usage.

Fixes #1977

Why is the change being made?

The plt.show() options are intended for:

  1. Interactive use on ipython or notebooks
  2. Automated use during sphinx-gallery generation

Running plt.show() followed by plt.close() prevents at least the 2nd use case from working, as seen in #1977.


Checklist

  • The release notes have been updated if necessary.
  • The documentation is still up-to-date in the doc folder.
  • The dependencies are still up-to-date in pyproject.toml.

The plt.show() options are intended for:

1. Interactive use on ipython or notebooks
2. Automated use during sphinx-gallery generation

Running plt.show() followed by plt.close() prevents at
least the 2nd use case from working, as seen in terrapower#1977.

This change puts the close() only in the code branches
that are expected to be run non-interactively, e.g.
compute code. That allows the system to keep memory
clear during big runs while still allowing interactive
and gallery usage.

Fixes terrapower#1977
@ntouran ntouran force-pushed the ntouran/fix-interactive-plotting branch from ca91d53 to cc2ff77 Compare October 26, 2024 14:18
@john-science john-science added bug Something is wrong: Highest Priority documentation Improvements or additions to documentation labels Oct 26, 2024
@john-science john-science merged commit 8a43001 into terrapower:main Oct 26, 2024
11 checks passed
drewj-tp added a commit that referenced this pull request Oct 29, 2024
* main:
  Fixing HexBlock docstrings (#1981)
  Removing a duplicate hex rotation impl tag (#1979)
  Avoiding closing plots that are meant to be interactive (#1978)
  Ensuring HexBlock.rotate updates child spatial locators (#1943)
  Add new memory runLog info to memoryProfiler.py  (#1970)
  Fixing various doc build issues (#1974)
  Hiding sphinx-needs warnings during doc build (#1973)
  Fixing warnings in CLI startup (#1972)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong: Highest Priority documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ARMI Gallery has several broken examples
2 participants