-
Notifications
You must be signed in to change notification settings - Fork 280
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
Conversation
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.
Great catch. |
self.domain_right_edge = self.domain_left_edge + attrs["domain"][:].astype( | ||
"=f8" | ||
) |
There was a problem hiding this comment.
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
self.domain_right_edge = self.domain_left_edge + attrs["domain"][:].astype( | |
"=f8" | |
) | |
dre = attrs["bounds"][:] + attrs["domain"][:] | |
self.domain_right_edge = dre.astype("=f8") |
There was a problem hiding this 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!
Ok since Cameron is happy, I think we can ignore my style nit and merge as in. Thanks everyone ! |
@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) |
No worries, we use linters and formatters mainly so we can not discuss style nits and focus on what's actually important ;-) |
PR Summary
Previously, the
domain_right_edge
attribute ofChollaDataset
was initialized by assigning it the values of the"domain"
attribute stored in the hdf5 file. This patch adjusts the logic so that thedomain_right_edge
attribute is now the sum of that array and the array stored in thedomain_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).