-
Notifications
You must be signed in to change notification settings - Fork 271
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
[BUG] Allow smoothing of derived SPH fields onto covering grids #4431
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.
So I am OK with this, and I think it's OK to go in as-is, but I did have two requests that might help future maintainers.
@@ -950,6 +950,28 @@ def _fill_particles(self, part): | |||
for p in part: | |||
self[p] = self._data_source[p] | |||
|
|||
def _check_sph_type(self, fi): |
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.
Can we change fi
to finfo
for this function?
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.
Done
ptype = field[0] | ||
else: | ||
if fi.name[0] not in sph_ptypes and fi.name[0] != "gas": | ||
raise_error = True |
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.
I know I should be able to figure this out, but the nested logic is not super easy to follow. Can we put in a comment a 'truth table' or something to show the cases we're evaluating here?
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.
Done
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Co-authored-by: Clément Robert <cr52@protonmail.com>
I think this should be ready to go now. |
PR Summary
The following script fails on
main
:with this error:
It appears that derived fields were not supported for this operation. This PR addresses this issue by making extra checks to determine if a field is either an SPH on-disk field, derived field, or a particle filter type of an SPH field.
However, in order to avoid many more onerous code changes, I had to provide for the creation of fields such as
("gas", "particle_position")
,("gas", "particle_mass")
, and("gas","particle_position_[xyz]")
, which currently do not exist because the SPH position fields are aliased to("gas", "[xyz]")
and the mass field is aliased to("gas", "mass")
. Happy to discuss if this doesn't feel right to anyone.PR Checklist