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

Add CLI to plot size control diagnostics #5723

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

knelli2
Copy link
Contributor

@knelli2 knelli2 commented Jan 30, 2024

Proposed changes

This is just a quick utility that plots most of the size control diagnostics necessary to quickly see what has gone wrong in a simulation. Not intended for a super detailed analysis, but you can change the x-range on the plot to zoom in on a specific time (and have the y-axes of all plots rescale accordingly)

To quickly plot size control diagnostics, try

spectre plot-size-control --object-label A --output SizeControlDiag --x-label "Time (M)" --title "AhA size control diagnostics" ReductionsFile.h5

This gives the result of SizeControlDiagA.pdf

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

@knelli2 knelli2 added the cli/pybindings Command line interface & Python bindings label Jan 30, 2024
@knelli2 knelli2 requested a review from nilsvu January 30, 2024 00:12
Copy link
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

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

Will finish the review later

src/Visualization/Python/PlotSizeControl.py Outdated Show resolved Hide resolved
src/Visualization/Python/PlotSizeControl.py Outdated Show resolved Hide resolved
src/Visualization/Python/PlotSizeControl.py Outdated Show resolved Hide resolved
src/Visualization/Python/PlotSizeControl.py Outdated Show resolved Hide resolved
src/Visualization/Python/PlotSizeControl.py Outdated Show resolved Hide resolved
axes = list(axes)
# Damping times are sort of the odd ones out. Put it with control error but
# on a different y-axis
top1 = axes[0].plot(times, control_error, label="Control Error")
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to plot abs(control_error) on a log scale?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, not really. I think we'd lose a lot of information about small oscillations that way.

Copy link
Member

Choose a reason for hiding this comment

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

How so? You see small oscillations well on a log scale. I suggest trying a log scale, and/or plotting both. Anyway, this is up to you.

src/Visualization/Python/PlotSizeControl.py Outdated Show resolved Hide resolved
src/Visualization/Python/PlotSizeControl.py Outdated Show resolved Hide resolved
tests/Unit/Visualization/Python/Test_PlotSizeControl.py Outdated Show resolved Hide resolved
tests/Unit/Visualization/Python/Test_PlotSizeControl.py Outdated Show resolved Hide resolved
@nilsvu nilsvu merged commit 8187949 into sxs-collaboration:develop Feb 2, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli/pybindings Command line interface & Python bindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants