removing empty bins from radial profiles
Hi all, I am calculating radial profiles with BinnedProfile1D, where the profile values happen to be zero in a few bins. This causes interruptions in the graphs when I plot the the profiles with pylab.loglog. I don't want to make the bins broader. So I would like to get rid of the empty bins (i.e., bins with zero values) by removing them from the profile lists or somehow tell the loglog function of pylab to ignore all zero values. Unfortunately, I have found a solution either way. Can anyone help? Wolfram
Hi Wolfram, All profiles have a supplemental field called "UsedBins" which is a boolean field. It's True wherever the bin has been touched, and False wherever it hasn't. You could use something like numpy's masked arrays to handle this, but it could also just be as simple as: u = prof["UsedBins"] pyplot.loglog(prof["Density"][u], prof["Temperature"][u]) for the same effect. Hope that helps! -Matt On Fri, Aug 31, 2012 at 8:57 AM, Wolfram Schmidt <schmidt@astro.physik.uni-goettingen.de> wrote:
Hi all,
I am calculating radial profiles with BinnedProfile1D, where the profile values happen to be zero in a few bins. This causes interruptions in the graphs when I plot the the profiles with pylab.loglog. I don't want to make the bins broader. So I would like to get rid of the empty bins (i.e., bins with zero values) by removing them from the profile lists or somehow tell the loglog function of pylab to ignore all zero values. Unfortunately, I have found a solution either way.
Can anyone help?
Wolfram _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
One thing I have used is the combination of "plot" and "set_yscale" in this way: plot(x,y..) set_xscale("log") set_yscale("symlog") The "symlog" should get you the behavior that you want. On Aug 31, 2012, at 9:23 AM, Matthew Turk wrote:
Hi Wolfram,
All profiles have a supplemental field called "UsedBins" which is a boolean field. It's True wherever the bin has been touched, and False wherever it hasn't. You could use something like numpy's masked arrays to handle this, but it could also just be as simple as:
u = prof["UsedBins"] pyplot.loglog(prof["Density"][u], prof["Temperature"][u])
for the same effect.
Hope that helps!
-Matt
On Fri, Aug 31, 2012 at 8:57 AM, Wolfram Schmidt <schmidt@astro.physik.uni-goettingen.de> wrote:
Hi all,
I am calculating radial profiles with BinnedProfile1D, where the profile values happen to be zero in a few bins. This causes interruptions in the graphs when I plot the the profiles with pylab.loglog. I don't want to make the bins broader. So I would like to get rid of the empty bins (i.e., bins with zero values) by removing them from the profile lists or somehow tell the loglog function of pylab to ignore all zero values. Unfortunately, I have found a solution either way.
Can anyone help?
Wolfram _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
participants (3)
-
John ZuHone
-
Matthew Turk
-
Wolfram Schmidt