BUG: Off-axis projections of filtered gas particles are not scaled correctly #4075
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
I discovered that off-axis projections of filtered gas particles have incorrect scaling. This can be seen clearly in the following notebook:
https://gist.github.com/f97283ce13c4850e31f4b0715f31202f
where the colorbar ranges for the on-axis and off-axis projection should be the same (same axis, different methods), but they are not. The difference arises because the off-axis projection code for SPH particles scales by the units of the
smoothing_length
field to compute the path length, and this is done incorrectly for filtered particles. The reason for this is because the projection calculation is done in code units, and for non-filtered gas particles the path length scaling is done in the units of thesmoothing_length
, which is alwayscode_length
. However, for filtered gas particles, the smoothing length is in default units of cm (or whatever the unit system happens to be).The solution is to simply assume that the unit for the path length scaling will always be
code_length
, since the calculation above it of the projection is explicitly carried out in code units.PR Checklist