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 for plotting CCE output data #6011

Merged
merged 3 commits into from
May 22, 2024

Conversation

knelli2
Copy link
Contributor

@knelli2 knelli2 commented May 20, 2024

Proposed changes

Also update the CCE tutorial to point to this CLI so we don't just have a large block of python code in our tutorial.

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 May 20, 2024
callback=_parse_modes,
required=True,
help=(
"Which mode to plot. Specified as 'l,m'. Will plot both real and"
Copy link
Member

Choose a reason for hiding this comment

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

Use nargs=2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I personally don't like using nargs=2 for click.options (for click.arguments they are good). It feels more natural to me to have comma separated value (maybe it's because there isn't a space so it feels like one option rather than two).

Copy link
Member

Choose a reason for hiding this comment

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

We're currently not consistent with comma vs space, so either is fine with me

src/Visualization/Python/PlotCce.py Outdated Show resolved Hide resolved
src/Visualization/Python/PlotCce.py Outdated Show resolved Hide resolved
)
self.reduction_file_name_one_subfile = "TestCceReductions1.h5"
self.reduction_file_name_two_subfiles = "TestCceReductions2.h5"
plot_quantities = [
Copy link
Member

Choose a reason for hiding this comment

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

(Optional) Is it possible to use the C++ routine that writes data in the simulation also to write data here? Would be nice to make sure the code keeps working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not easily I don't think. This data is written from an iterable action that then calls either a threaded action or a local synchronous action to do the writing. The iterable action is pretty complex too

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.

Squash 👍

src/Visualization/Python/PlotCce.py Outdated Show resolved Hide resolved
@@ -100,6 +100,7 @@ def command(output, **kwargs):
)
else:
plt.savefig(output)
plt.close()
Copy link
Member

Choose a reason for hiding this comment

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

For my information, did you encounter an issue with this?

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 when I was running the unit test on my machine, even when I had the -o option specified, it would still open the plot interactively causing a timeout. This stopped that from happening.

Does not do any BMS transformations. Only plots raw CCE output
nilsvu
nilsvu previously approved these changes May 21, 2024
nilsdeppe
nilsdeppe previously approved these changes May 21, 2024
Copy link
Member

@nilsdeppe nilsdeppe left a comment

Choose a reason for hiding this comment

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

LGTM! A couple small suggestions. Please squash if you decide to do them, otherwise feel free to merge directly.

r"Re $Y_{" + str(mode_l) + r"\," + str(mode_m) + r"}$",
r"Im $Y_{" + str(mode_l) + r"\," + str(mode_m) + r"}$"
])
If you'd like to do something more complex than just make a quick plot, you'll
Copy link
Member

Choose a reason for hiding this comment

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

maybe complex -> complicated? Since CCE deals with complex numbers, just to avoid any possible confusion? Up to you!

\note The CLI can also plot the "old" version of CCE output, described above.
Pass `--cce-group Cce` to the CLI. This option is only for backwards
compatibility with the old CCE output and is not supported for the current
version of output.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add This option is deprecated and will be removed in the future.

@knelli2
Copy link
Contributor Author

knelli2 commented May 21, 2024

@nilsdeppe Squashed in the changes

@nilsdeppe nilsdeppe enabled auto-merge May 21, 2024 20:04
@nilsdeppe nilsdeppe added the auto-merge GitHub's auto-merge has been enabled for this PR. label May 21, 2024
@nilsdeppe nilsdeppe disabled auto-merge May 22, 2024 15:40
@nilsdeppe nilsdeppe merged commit df6ed03 into sxs-collaboration:develop May 22, 2024
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge GitHub's auto-merge has been enabled for this PR. cli/pybindings Command line interface & Python bindings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants