Binning with create_profile
Hello, I'm trying to create a radial profile of the gas density using the create_profile function. Even with the extrema explicitly specified the binning does not take these values. I was wondering whether there was a simple way to work around this? My script and output are bellow: ds = yt.load("DD0077/output_0077") val, loc = ds.find_max('density') sp = ds.sphere(loc, (10.0, 'pc')) rp = yt.create_profile(sp, 'radius', ('gas', 'density'), n_bins= 10, extrema= {'radius':((1e-2, 'pc'), (10.0, 'pc'))}, logs= {'radius':True}) rp.x.in_units('pc')
YTArray([0.01497631, 0.02988167, 0.05962177, 0.11896107, 0.23735854, 0.47359256, 0.94494138, 1.88540592, 3.76187938, 7.50593617]) pc (where 0.01 and 10 are expected to be the first and last values)
Many thanks, Sam Patrick
Hi Sam, I think what you're seeing there are the bin centers. If you check out rp.x_bins, you should get what you expect. Britton On Wed, Jun 19, 2019 at 1:07 PM Sam Patrick via yt-users < yt-users@python.org> wrote:
Hello,
I'm trying to create a radial profile of the gas density using the create_profile function. Even with the extrema explicitly specified the binning does not take these values. I was wondering whether there was a simple way to work around this? My script and output are bellow:
ds = yt.load("DD0077/output_0077") val, loc = ds.find_max('density') sp = ds.sphere(loc, (10.0, 'pc')) rp = yt.create_profile(sp, 'radius', ('gas', 'density'), n_bins= 10, extrema= {'radius':((1e-2, 'pc'), (10.0, 'pc'))}, logs= {'radius':True}) rp.x.in_units('pc')
YTArray([0.01497631, 0.02988167, 0.05962177, 0.11896107, 0.23735854, 0.47359256, 0.94494138, 1.88540592, 3.76187938, 7.50593617]) pc (where 0.01 and 10 are expected to be the first and last values)
Many thanks, Sam Patrick _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
I might be getting some roundoff on my iPhone, but it might be that 1e-2 is the lower boundary of your lowest bin and 10 is the upper boundary of your highest bin. What I think you listed are the centers of your bins (with bins log-spaced). Best, Stephanie On Wed, Jun 19, 2019 at 8:07 AM Sam Patrick via yt-users < yt-users@python.org> wrote:
Hello,
I'm trying to create a radial profile of the gas density using the create_profile function. Even with the extrema explicitly specified the binning does not take these values. I was wondering whether there was a simple way to work around this? My script and output are bellow:
ds = yt.load("DD0077/output_0077") val, loc = ds.find_max('density') sp = ds.sphere(loc, (10.0, 'pc')) rp = yt.create_profile(sp, 'radius', ('gas', 'density'), n_bins= 10, extrema= {'radius':((1e-2, 'pc'), (10.0, 'pc'))}, logs= {'radius':True}) rp.x.in_units('pc')
YTArray([0.01497631, 0.02988167, 0.05962177, 0.11896107, 0.23735854, 0.47359256, 0.94494138, 1.88540592, 3.76187938, 7.50593617]) pc (where 0.01 and 10 are expected to be the first and last values)
Many thanks, Sam Patrick _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
-- -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY stonnes@gmail.com
participants (3)
-
Britton Smith
-
Sam Patrick
-
Stephanie Tonnesen