-
Notifications
You must be signed in to change notification settings - Fork 274
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: fixes for Hammer-Aitoff projection (r-normal) 2D viz in spherical geometries #3628
BUG: fixes for Hammer-Aitoff projection (r-normal) 2D viz in spherical geometries #3628
Conversation
8043d88
to
b6be079
Compare
Also fixes a bug that I unfortunately didn't see in #3532: x and y axis labels in r-normal plots were not only incorrectly typeset, they were also exchanged. |
So while I'm at it I figured I might as well give a shot at fixing #3610 and made some progress there import yt
ds = yt.load_sample("KeplerianDisk")
p = yt.SlicePlot(ds, "r", "density")
p.save(f"/tmp/disk_slice_r.png", mpl_kwargs=dict(bbox_inches="tight")) There are still a couple issues, but I was able to
remaining issues:
So I still want to fix 1) here, but I may reserve 2) for a different PR |
I think I'm getting there, but I need to carefully read the pixelizer code to finish my generalisation |
@neutrinoceros could you expand on the "obviously"? I'm not sure I understand specifically what you mean. |
Let me rephrase this more carefully: I've been simplifying the math locally (not pushed yet) but so far I'm still stuck with the visual offset shown above |
Currently the routine is hitting the right amount of pixels and the end product it very close to what I expect, but something about coordinate transformations seems to be off. Any help / insight would be greatly appreciated, I haven't been able to make any significant progress for a couple hours now. |
So while this fixes the viz for the Athena++ |
I think this is definitely the more correct approach, but I am vaguely left
wishing we had a better way to display so we could have something more
terse.
…On Fri, Oct 29, 2021 at 4:11 PM Clément Robert ***@***.***> wrote:
So while I'm at it I figured I might as well give a shot at fixing #3610
<#3610> and made some progress
there
rerunning the demo script I wrote in a comment (#3610 (comment)
<#3610 (comment)>)
import yt
ds = yt.load_sample("KeplerianDisk")p = yt.SlicePlot(ds, "r", "density")p.save(f"/tmp/disk_slice_r.png")
I'm now getting this:
[image: disk_slice_r]
<https://user-images.githubusercontent.com/14075922/139501566-a452a727-1a9c-4cb8-b831-d9f7e60f0cdc.png>
There are still a couple issues, but I was able to
- fix axes labels
- ... including units (none ! that's a new special case)
- compute the edges and center of the image correctly
remaining issues:
1. whitespace on the top and bottom of the image should be much
thiner. This is a bug in the pixelizer itself that I think was coded with
only full spherical domains in mind.
2. the colormap label incorrectly uses code-units (sigh... this bug is
never going away, is it ?)
So I still want to fix 1) here, but I may reserve 2) for a different PR
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3628 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVXOZC5EE6GQTKLN6ZOSTUJML2PANCNFSM5G7WCJRA>
.
|
Me too, but there's too much going on, so I'm focusing on making it work for now. |
Update:
import yt
ds = yt.load_sample("bw_spherical_2d", unit_system="code")
# using the aspect argument only to limit the height of the second image
# improvement is underway in https://github.com/yt-project/yt/pull/3633
p = yt.SlicePlot(ds, "r", "density", aspect=0.5)
p.save(f"/tmp/test.png") main branch: so I think what's happening is an unfortunate side effect of the default "origin" argument in SlicePlot which doesn't plays well here because we can't simply translate the frame as we do in cartesian. I haven't looked into how to test hunch this properly, but I know that the bounds are correctly computed in |
The one failing test is checking reproducibility of the FRB for basic pixelization calls. It can be visually reproduced with import yt
ds = yt.testing.fake_amr_ds(geometry="spherical")
p = yt.SlicePlot(ds, "r", "Density")
p.save("/tmp/") main branchthis branchSo the result is indeed different, but I believe that it's more correct with this branch: Aitoff coordinates range from -1 to +1 in both directions, so with the default aspect ratio (1), projecting a complete sphere should produce a disk, not an ellipse. |
74a98ef
to
9694bcd
Compare
I found some more inconsistencies, this is getting back to the shop. |
9694bcd
to
c7d2177
Compare
@matthewturk can I bump answers here ? it's fine if you want to have a deeper look at the code first, just please let me know |
do it!
…On Fri, Nov 19, 2021 at 12:55 PM Clément Robert ***@***.***> wrote:
@matthewturk <https://github.com/matthewturk> can I bump answers here ?
it's fine if you want to have a deeper look at the code first, just please
let me know
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3628 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVXO74YHU3NKTWNZKLB6LUM2MR7ANCNFSM5G7WCJRA>
.
|
Ah, the report is gone, so I'll rebase first and bump tomorrow. Switching to draft again. |
…nates (fix axis labels/bounds, generalize+simplify pixelizer routine, clarify notations)
1f8e3f7
to
a3a0f2f
Compare
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.
The changes inside the pixelizer (specifically reversing the order, etc) are a bit confusing to me, but I see that the resultant images are OK, so I don't object.
np.float64_t[:] dtheta, | ||
np.float64_t[:] phi, | ||
np.float64_t[:] dphi, | ||
def pixelize_aitoff(np.float64_t[:] azimuth, |
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'm pretty ambivalent about the idea of changing all the notation in here, but I suppose it does make things clearer.
dphi_p = dphi[fi] | ||
Lambda_p = (azimuth[fi] + azimuth_offset) - PI | ||
dLambda_p = dazimuth[fi] | ||
btheta_p = PI/2.0 - (colatitude[fi] + colatitude_offset) |
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 you spare a moment to explain why this is different now? It's the reverse of before, yes?
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.
yes. AFAICT, everywhere in the code base, we denote the colatitude "theta". As the name suggests, colatitude is the complementary angle to latitude (so lat + coat = PI/2). On the main branch, the angle that's noted phi
here effectively is the opposite of latitude. So I'm changing the name to btheta
to reflect that it's neither the azimuth (phi) nor the colatitude (theta), and I'm changing its sign because... that's just a bug (I discovered it in testing when I saw a sphere being displayed upside down, with the north emisphere on the bottom half).
Co-authored-by: Matthew Turk <matthewturk@gmail.com>
Something went terribly wrong in the docs build but I don't believe it's reproducible |
Read too fast, this is perfectly reproducible indeed, but I'm still surprised that we're only seeing this now
|
This error is absolutely mysterious to me. |
Have you tried to reproduce it locally with current |
I did try
but this seems even more broken on my machine (I get stuck in a loop of error messages where processes fail to spawn because of some race condition ? and it didn't get better after I required a single process instead of 6 or replaced |
Next time, don't try to run everything. Run the thing that fails. E.g. in the traceback I posted (#3690 (comment)) it sufficient to do:
to easily hit that error. |
Thank you, dully noted. |
@yt-fido test this please |
@matthewturk should this go in ? |
…(r-normal) 2D viz in spherical geometries
…8-on-yt-4.0.x Backport PR #3628 on branch yt-4.0.x (BUG: fixes for Hammer-Aitoff projection (r-normal) 2D viz in spherical geometries)
PR Summary
This is a jab at the first item in #1796
Spherical geometries need more work but this is a first step to improve maintainability.
Right now, the defintions of "theta" and "phi" are misaligned between the aitoff pixelizer and the rest of the code base.
Fortunately, the latter is correct (aligned with most common notations AFAIC), while the former isn't user facing so it's an easy fix.
edit: this now completes the 3rd item of #1796