-
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
Updates to the _parse_parameter_file function following PR 4470 #4605
Updates to the _parse_parameter_file function following PR 4470 #4605
Conversation
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.
just a small comment. I'll review properly tomorrow,
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.
actually I don't have other comments, LGTM
Co-authored-by: Clément Robert <[email protected]>
3bc804b
I guess my question is if this is now in line with PR #4470, then it seems like we should have done this first and then tried to find a way for the GIZMO frontend's method to call this one as |
So it seems like PR #4470 went through because of changes in the Gizmo frontend, but do we know that equivalent changes occurred in the underlying Gadget code as well? My concern is that this might break how we're loading in Gadget cosmological simulations, since we're no longer assuming |
I don't know of any changes to the Gadget frontend, but my understanding is that nothing here should change the logic of how the parameter file is parsed. For example, the # previous version of the code
try:
self.current_redshift = hvals["Redshift"]
except KeyError:
# Probably not a cosmological dataset, we should just set
# z = 0 and let the user know
self.current_redshift = 0.0
only_on_root(mylog.info, "Redshift is not set in Header. Assuming z=0.") and then # Previous version (with info statement removed for clarity)
if self.omega_lambda == 0.0:
### ... Not cosmological ...
self.cosmological_simulation = 0
self.current_redshift = 0.0 ### This is set to 0, even if it wasn't before Please feel free to correct me though and, of course, I have no idea if the previous logic is correct. To @jzuhone 's point, I believe you are correct. In hindsight, I think the Gizmo frontend could call |
self.omega_matter = 1.0 # Just in case somebody asks for it. | ||
self.omega_matter = 0.0 # Just in case somebody asks for it. |
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.
Why change this to 0.0, instead if 1.0? This would imply there's nothing in the volume.
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.
From @neutrinoceros
non-cosmological datasets normally have omega_matter set to 0.0. Is there a reason not to follow the convention here ?
in PR #4470
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.
Ok, so it was changed for consistency with other frontends? That's ok, but maybe warrants changing the comment from 'Just incase somebody asks for it' to 'Changed to 0.0 for consistency with non-cosmological frontends' in case somebody comes looking?
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.
Fair point. The comment was actually left unchanged from the previous code (and I believe is just referencing that omega_matter is being set, not necessarily it's value), I had only changed the numerical value here.
I've added your comment, though I left the original as well, since it does describe why omega_matter is being set at all.
PR Summary
This change updates the
_parse_parameter_file
function in the Gadget frontend to match the changes developed in PR #4470. In summary:I've left the for/else structure in, since in #4470 I just removed it (didn't need to support Gadget-2 format for Gizmo files) and so haven't fully thought of what the replacement should look like.
PR Checklist
I believe this neither adds new features, nor fixes any bugs, and is more of a code cleanup than anything else.