Skip to content

Conversation

@Yurlungur
Copy link
Contributor

@Yurlungur Yurlungur commented Aug 29, 2025

PR Summary

We recently finally refactored curvilinear coordinates in Parthenon and the ordering for cylindrical coordinates was normalized to the standard choice in yt. This MR fixes that in parthenon frontend. I also noticed that the yt frontend was not properly handling variables of tensor rank less than 1 (i.e., scalars on the mesh). This MR adds a one-line fix that gets that working.

PR Checklist

  • New features are documented, with docstrings and narrative docs
  • Adds a test for any bugs fixed. Adds tests for new features.

@welcome
Copy link

welcome bot commented Aug 29, 2025

Hi! Welcome, and thanks for opening this pull request. We have some guidelines for new pull requests, and soon you'll hear back about the results of our tests and continuous integration checks. Thank you for your contribution!

Comment on lines +55 to +58
if len(ds.shape) == 4:
data = ds[start:end, :, :, :].transpose()
else:
data = ds[start:end, fdi, :, :, :].transpose()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Parthenon's python reader can always split a variable into a flat index space, so I think this is now generic.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand this change. What's exactly happening here?
a) the Parthenon python reader is not used in yt
b) a flattened index space (from a vector or tensor variable) would always carry the fdi index, doesn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In riot's current format scalar fields are only 4D with the leading index the block. AthenaPK doesn't see this because it has a prim vector, but riot and phoebus do. That's what's this change is. I didn't modify the piece with prim vector, just special case scalars.

@Yurlungur
Copy link
Contributor Author

I believe this MR is a bugfix but I don't seem to have permissions to add a label.

@pgrete
Copy link
Contributor

pgrete commented Sep 2, 2025

@Yurlungur do you have any data to share with those coordinate that could be added to the regression tests?
I think some choice were specific to the (not merged) changes in AthenaPK, so I'd be happy to follow the new "standard" way if we merge non-Cart coords in AthenaPK.

@Yurlungur
Copy link
Contributor Author

@Yurlungur do you have any data to share with those coordinate that could be added to the regression tests?

Yes happy to provide something. In fact, for the scalar field check, even output from Parthenon's poisson example would do the trick. For cylindrical coordinates... I'm not sure we have anything, but I could mock something up. I can't access yt-hub, however, so I'd have to pass the file on to someone else to upload.

@Yurlungur
Copy link
Contributor Author

@pgrete sent you a dataset. Can you shepherd it into the tests, or should I try to do so?

@pgrete
Copy link
Contributor

pgrete commented Sep 5, 2025

Dataset PR is here: yt-project/website#141

Also, I added a skeleton on how to test the data (currently just checking for the field name).
Any creative suggestion on how to test the data itself @Yurlungur ?

@pgrete
Copy link
Contributor

pgrete commented Sep 5, 2025

btw if you quickly want to run local tests, just

nosetests -v --with-answer-testing --local --local-dir $HOME/src/yt-test-data --answer-store --answer-name=local-parthenon yt.frontends.parthenon

where $HOME/src/yt-test-data (or whatever folder of you choice) contains the data in the zip file (including the folder) -- and eventually data from https://yt-project.org/data/

@Yurlungur
Copy link
Contributor Author

Dataset PR is here: yt-project/website#141

Also, I added a skeleton on how to test the data (currently just checking for the field name). Any creative suggestion on how to test the data itself @Yurlungur ?

Sorry for the delay. Been traveling. I added a check that the cell width in theta is 2pi. (This was being incorrectly overwritten, by the way, which I fixed.) I also added a check for the total mass.

@pgrete
Copy link
Contributor

pgrete commented Oct 5, 2025

@chrishavlin this now looks good to me.
Who can upload the new reference data to the yt website and accept yt-project/website#141 so that the tests can pass?

@chrishavlin
Copy link
Contributor

@pgrete I think we need @Xarthisius to move the new dataset from yt-project/website#141 to where it needs to go... but the test server that runs the full test suite is currently on the fritz, so the full nose test suite will not run at present (right now, the only tests that are running are those that do not require sample datasets). Doesn't hurt to have the dataset in place for when we revamp the test server, but not sure when that will be. In the meantime, I'll double check that the new tests run for me locally right now and we should be good to merge.

Copy link
Contributor

@chrishavlin chrishavlin left a comment

Choose a reason for hiding this comment

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

I did run the existing answer tests locally and confirmed that they passed -- was not able to run the new test due to an error in unpacking the new test file (see yt-project/website#141 (comment) ).

One final minor code suggestion if you want to fix it, but IMO this is good to merge. I'll hit approve once we get the new test file figured out.

chrishavlin
chrishavlin previously approved these changes Oct 7, 2025
Copy link
Contributor

@chrishavlin chrishavlin left a comment

Choose a reason for hiding this comment

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

just ran the new test locally with the updated test file and it passed as expected, so this PR is good to go from my perspective - @Yurlungur , i did add one comment earlier today on an optional minor code suggestion (here: https://github.com/yt-project/yt/pull/5276/files#r2411258480 ), I'll give you a chance to make the change or let me know if you don't want to bother, then we can merge!

@Yurlungur
Copy link
Contributor Author

just ran the new test locally with the updated test file and it passed as expected, so this PR is good to go from my perspective - @Yurlungur , i did add one comment earlier today on an optional minor code suggestion (here: https://github.com/yt-project/yt/pull/5276/files#r2411258480 ), I'll give you a chance to make the change or let me know if you don't want to bother, then we can merge!

Thanks, @chrishavlin sounds good. Suggestion merged!

@chrishavlin
Copy link
Contributor

chrishavlin commented Oct 9, 2025

@Yurlungur -- you'll also have to remove the reference to in the superclass __init__ call (axis_order=axis_order,). The github interface wouldn't let me suggest a code change there since it was out of scope of your changes.

Oh, the pre-commit check actually picked it up: https://results.pre-commit.ci/run/github/88776493/1760031924.mgAcmADwSAq7-ms9whb8BA

@Yurlungur
Copy link
Contributor Author

@Yurlungur -- you'll also have to remove the reference to in the superclass __init__ call (axis_order=axis_order,). The github interface wouldn't let me suggest a code change there since it was out of scope of your changes.

Oh, the pre-commit check actually picked it up: https://results.pre-commit.ci/run/github/88776493/1760031924.mgAcmADwSAq7-ms9whb8BA

Oops... Sorry about that. I failed my reading comprehension test. Fixed.

@chrishavlin
Copy link
Contributor

pre-commit.ci autofix

@chrishavlin chrishavlin enabled auto-merge October 13, 2025 14:04
@chrishavlin chrishavlin disabled auto-merge October 13, 2025 14:04
@chrishavlin
Copy link
Contributor

this is good to merge after tests pass again

@chrishavlin
Copy link
Contributor

just merged with main, should take care of that one failing test and then we can merge!

@chrishavlin chrishavlin merged commit e962538 into yt-project:main Oct 15, 2025
12 of 13 checks passed
@welcome
Copy link

welcome bot commented Oct 15, 2025

Hooray! Congratulations on your first merged pull request! We hope we keep seeing you around! 🎆

@lumberbot-app
Copy link

lumberbot-app bot commented Oct 15, 2025

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout yt-4.4.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 e962538dc02bd1041e7a7fb89957240e79a774f3
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #5276: Fix small bugs/edge cases in the parthenon frontend'
  1. Push to a named branch:
git push YOURFORK yt-4.4.x:auto-backport-of-pr-5276-on-yt-4.4.x
  1. Create a PR against branch yt-4.4.x, I would have named this PR:

"Backport PR #5276 on branch yt-4.4.x (Fix small bugs/edge cases in the parthenon frontend)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

chrishavlin added a commit to chrishavlin/yt that referenced this pull request Oct 15, 2025
…on frontend

Merge pull request yt-project#5276 from Yurlungur/jmm/parthenon-frontend-updates

Fix small bugs/edge cases in the parthenon frontend

(cherry picked from commit e962538)
@Yurlungur Yurlungur deleted the jmm/parthenon-frontend-updates branch October 16, 2025 16:53
@Yurlungur
Copy link
Contributor Author

🎊 Thanks for your feedback and helping pull it all through @chrishavlin @pgrete !

chrishavlin added a commit that referenced this pull request Nov 14, 2025
…on-yt-4.4.x

Backport PR #5276: Fix small bugs/edge cases in the parthenon frontend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants