yt-project/website

Creating 1D Profile gives nans and zeros

stonnes opened this issue · 7 comments

I can try and create a 1D profile using two methods. The first gives me a nice profile, the second gives me nans for the radius and 0s for the density. I have attached the two python scripts labeled fail and succeed using the IsolatedGalaxy data set.

yt_diskprofile_oplotdiffruns_fail.txt
yt_diskprofile_oplotdiffruns_succeed.txt

This occurs because you attempt to use log axes in your plot, however you start your radius at 0!

You can fix this by either setting:

extrema = dict(radius(1, 40)) # or some other nonzero value

or

logs=dict(radius=False)

as you have done before in your yt.create_profile function.

Thanks! I actually call plt.semilogy specifically so that radius is on a linear axis, but apparently that doesn't matter for the yt.create_profile function. It still seems strange to me that having one value of 0 in radius makes everything zero or nan, but your fix works! Thanks again.

I'm reopening this. We should either print an error message or warning or just do the right thing.

Why was this issue opened at the website repo? I guess it's too late to move it.

Oh, it was definitely reported to the wrong issue tracker. I'm going to reopen at the correct one. @stonnes for future reference, you want to use https://github.com/yt-project/yt/issues/new when filing issues for the yt python package. This issue tracker is for the yt website.

Ah, thanks for letting me know about the bad link in the documentation. I've issued a PR with a fix: yt-project/yt#1615