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 a Python parser for diag.out files and fix header formatting #2666

Merged
merged 2 commits into from
Dec 3, 2023

Conversation

yut23
Copy link
Collaborator

@yut23 yut23 commented Dec 1, 2023

PR summary

This PR adds some Python code that can parse the files and sanitize any duplicate entries (which often occurs when a run is restarted from an earlier checkpoint). It also fixes some mistakes in the gravity_diag.out header formatting, and cleans up some of the other header-writing code.

Additional details

N.B.: Standard streams in C++ are right-justified by default (compared to Python, where numbers are right-justified and strings are left-justified).

  • update the header printing code for gravity_diag.out to match the others (the column numbers were 26 characters long instead of 25, and number 8 was missing)
  • simplify species formatting for species_diag.out (the previous code was just adding leading spaces)
  • update the header field widths for amr_diag.out to match what's used for the data

PR checklist

  • test suite needs to be run on this PR
  • this PR will change answers in the test suite to more than roundoff level
  • all newly-added functions have docstrings as per the coding conventions
  • the CHANGES file has been updated, if appropriate
  • if appropriate, this change is described in the docs

Note: standard streams in C++ are right-justified by default (compared
to Python, where numbers are right-justified and strings are
left-justified).

* update the header printing code for gravity_diag.out to match the
  others (the column numbers were 26 characters long instead of 25, and
  number 8 was missing)
* simplify species formatting for species_diag.out (the previous code
  was just adding leading spaces)
* update the header field widths for amr_diag.out to match what's used
  for the data
@zingale
Copy link
Member

zingale commented Dec 2, 2023

can you add a short description to the docs about this, perhaps in the visualization section, along with an index entry for the diag files.

@zingale
Copy link
Member

zingale commented Dec 2, 2023

Oh, actually it looks like this is the place in the docs:

https://amrex-astro.github.io/Castro/docs/io.html#index-9

@aisclark91
Copy link
Collaborator

I just wonder if the source driver modifications alter the output file (adding or removing spaces, etc)?

@yut23
Copy link
Collaborator Author

yut23 commented Dec 2, 2023

I just wonder if the source driver modifications alter the output file (adding or removing spaces, etc)?

The gravity_diag.out column numbers are the only things that get changed in the outputs.

Copy link
Collaborator

@aisclark91 aisclark91 left a comment

Choose a reason for hiding this comment

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

I approve your PR, my only worry is if this script will work with the existing version of the logs, or with the suggested change version of them?

@yut23
Copy link
Collaborator Author

yut23 commented Dec 2, 2023

I made sure it works with both.

@zingale zingale merged commit 4f728c4 into AMReX-Astro:development Dec 3, 2023
19 checks passed
@yut23 yut23 deleted the diag-fixes branch December 4, 2023 17:39
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.

3 participants