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

BUG: Off-axis projections of filtered gas particles are not scaled correctly #4075

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

jzuhone
Copy link
Contributor

@jzuhone jzuhone commented Aug 12, 2022

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 the smoothing_length, which is always code_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

  • New features are documented, with docstrings and narrative docs
  • Adds a test for any bugs fixed. Adds tests for new features.

@jzuhone jzuhone added the bug label Aug 12, 2022
@neutrinoceros
Copy link
Member

I don't know why mypy suddenly started reporting these issues but they are definitely not caused by your PR, and solved in #4074

@neutrinoceros neutrinoceros merged commit ab09cf8 into yt-project:main Aug 12, 2022
@jzuhone jzuhone deleted the fix_oap branch November 7, 2022 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants