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: method='sum' does not work for off-axis projections #5106

Open
chrishavlin opened this issue Jan 30, 2025 · 3 comments
Open

BUG: method='sum' does not work for off-axis projections #5106

chrishavlin opened this issue Jan 30, 2025 · 3 comments

Comments

@chrishavlin
Copy link
Contributor

The off-axis projections don't really work with method='sum':

import yt 
from yt.testing import fake_amr_ds

ds = fake_amr_ds()

field = ('index', 'ones')
p = yt.OffAxisProjectionPlot(ds, [0., 0., 1], field, method='sum', width = 2., buff_size=(400,400))
p.set_log(field, False)
p.save('/var/tmp/method_sum_offaxis_but_aligned.png')

Image

This should return the same as the axis-aligned version

p = yt.ProjectionPlot(ds, 'z', field, method='sum', width = 2., buff_size=(400,400))
p.set_log(field, False)
p.save('/var/tmp/method_sum_axis_aligned.png')

Image

Note that this isn't a high priority since method='sum' is not usually the correct choice for analysis... but it would have been useful for some tests that I was writing.

@chrishavlin
Copy link
Contributor Author

i did look very briefly at the reason -- and it's because the volume rendering sampling methods used for off-axis projections always integrate (multiply by path length in the intersected element), they're just not set up for simply summing. Which is fine, it's OK for this to not work I think since as I said it's probably only really useful for tests that aren't really physical (but we may want to mention it in the documentation).

@cphyc
Copy link
Member

cphyc commented Jan 30, 2025

Could you check for octree datasets?

@chrishavlin
Copy link
Contributor Author

chrishavlin commented Jan 30, 2025

sure, will do! i only looked at the standard gridded dataset (which end up using the KDTree volume sampler). definitely worth trying an octree ds too, will let you know how it goes when i get to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants