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

[FIX] Correctly normalize off-axis projections for octree datasets #5077

Merged
merged 4 commits into from
Dec 6, 2024

Conversation

cphyc
Copy link
Member

@cphyc cphyc commented Dec 6, 2024

PR Summary

Fixes #5071.

PR Checklist

  • Adds a test for any bugs fixed. Adds tests for new features.

@cphyc
Copy link
Member Author

cphyc commented Dec 6, 2024

With the code from #5071 (adapted so that the same colorbar is used):

On-axis Off-axis Relative difference
1 2 3

The results are now unbiased (within a few percent) and show only minor deviations (at cell edges, as one would expect due to the projection strategy).

@cphyc cphyc added bug viz: 2D backport-stable on-merge: backport to stable labels Dec 6, 2024
@neutrinoceros
Copy link
Member

@cphyc we haven't been backporting anything to the "stable" branch for years at this point, and backport- labels are not necessary with proper milestoning :)

@neutrinoceros neutrinoceros removed the backport-stable on-merge: backport to stable label Dec 6, 2024
@neutrinoceros neutrinoceros added this to the 4.4.1 milestone Dec 6, 2024
@cphyc
Copy link
Member Author

cphyc commented Dec 6, 2024

Oopsy sorry! I keep on forgetting how the labels work :)

chrishavlin
chrishavlin previously approved these changes Dec 6, 2024
Copy link
Contributor

@chrishavlin chrishavlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! glad this turned out to be a relatively small fix!

@@ -483,6 +485,10 @@ def temp_weightfield(field, data):
Nx=resolution[0],
Ny=resolution[1],
)
# Note: since dx was divided by wmax, we need to rescale by it
projected_weighted_qty *= wmax.d / np.sqrt(3)
projected_weight *= wmax.d / np.sqrt(3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah! that explains the mostly constant factor that values were off by! nice catch.

yt/visualization/tests/test_offaxisprojection.py Outdated Show resolved Hide resolved
Co-authored-by: Chris Havlin <[email protected]>
@chrishavlin chrishavlin merged commit a9a56b7 into yt-project:main Dec 6, 2024
13 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/yt that referenced this pull request Dec 6, 2024
@cphyc cphyc deleted the fix/5071 branch December 9, 2024 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Off-axis projections and on-axis projections differ for oct-based datasets
3 participants