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

minor bugfix in cholla frontend #4686

Merged
merged 2 commits into from
Oct 26, 2023
Merged

Conversation

mabruzzo
Copy link
Contributor

@mabruzzo mabruzzo commented Oct 5, 2023

PR Summary

Previously, the domain_right_edge attribute of ChollaDataset was initialized by assigning it the values of the "domain" attribute stored in the hdf5 file. This patch adjusts the logic so that the domain_right_edge attribute is now the sum of that array and the array stored in the domain_left_edge attribute.

PR Checklist

Given the simplicity of this fix, I don't really think there's any need for new documentation. Plus adding a test is probably not worth the effort (we would need to either introduce a new cholla dataset OR duplicate and mutate the existing dataset).

Previously, the ``domain_right_edge`` attribute of ``ChollaDataset`` was
initialized by assigning it the values of the ``"domain"`` attribute
stored in the hdf5 file. This patch adjusts the logic so that the
``domain_right_edge`` attribute is now the sum of that array and the
array stored in the ``domain_left_edge`` attribute.
@matthewturk
Copy link
Member

Great catch.

@matthewturk matthewturk requested a review from chummels October 5, 2023 13:16
matthewturk
matthewturk previously approved these changes Oct 5, 2023
@neutrinoceros neutrinoceros added bug code frontends Things related to specific frontends labels Oct 6, 2023
Comment on lines +106 to +108
self.domain_right_edge = self.domain_left_edge + attrs["domain"][:].astype(
"=f8"
)
Copy link
Member

Choose a reason for hiding this comment

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

This is one of the rare cases where black makes things objectively worse looking... here's a possible alternative

Suggested change
self.domain_right_edge = self.domain_left_edge + attrs["domain"][:].astype(
"=f8"
)
dre = attrs["bounds"][:] + attrs["domain"][:]
self.domain_right_edge = dre.astype("=f8")

@neutrinoceros neutrinoceros added this to the 4.3.1 milestone Oct 11, 2023
Copy link
Member

@chummels chummels left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the catch!

@neutrinoceros
Copy link
Member

Ok since Cameron is happy, I think we can ignore my style nit and merge as in. Thanks everyone !

@neutrinoceros neutrinoceros merged commit 8a43695 into yt-project:main Oct 26, 2023
meeseeksmachine pushed a commit to meeseeksmachine/yt that referenced this pull request Oct 26, 2023
@mabruzzo mabruzzo deleted the cholla-bugfix branch October 27, 2023 15:13
@mabruzzo
Copy link
Contributor Author

@neutrinoceros - sorry about not addressing that style change (I agree that your version looks better). The last few weeks have been a little hectic. I may try to implement that change in #4702 (since I'm already touching nearby code)

@neutrinoceros
Copy link
Member

No worries, we use linters and formatters mainly so we can not discuss style nits and focus on what's actually important ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug code frontends Things related to specific frontends
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants