[yt-users] Radial-averaged Profile error

Nathan Goldbaum nathan12343 at gmail.com
Mon Dec 14 15:08:43 PST 2015


Hi Junhwan,

Which yt version is this? If it's yt-3 or newer, you should probably be
using Profile1D instead of BinnedProfile1D. The latter was deprecated and
will be removed in yt 3.3.

On Mon, Dec 14, 2015 at 5:00 PM, Junhwan Choi (최준환) <choi.junhwan at gmail.com>
wrote:

> Dear yt users and developers,
>
> I get an error while I try to make a  radial-averaged  profile using yt.
> In order to compute the profile I wrote the following script:
> ===================================
> import matplotlib as matplotlib
> matplotlib.use('Agg')
> import yt
> import yt.units as units
> import numpy as np
> import matplotlib.pyplot as plt
>
> def _radiuspc(field, data):
>     return data[('radius')].in_units('pc')
> yt.add_field('radiuspc', function=_radiuspc, units="pc")
>
> rmax = 1000
> Nbin = 50
> ds = yt.load("../DD0099/DD0099")
> ds.index
> ad= ds.all_data()
>
> center = ds.find_max("density")[1]
> my_sphere = ds.sphere("center", (rmax, "pc"))
>
> rmin = max([0.1,2.0*ds.index.get_smallest_dx().in_units('pc')])
> profile = yt.BinnedProfile1D(my_sphere, Nbin, 'radius', rmin,
> rmax*units.pc, log_space=True, end_collect=False)
> profile.add_fields(('gas','density'), weight='cell_volume')
>
> plt.plot(na.log10(profile['radius']), na.log10(profile['density']))
> plt.savefig('ProfGasDensity')
> ===================================
>
> And, I get an following error to compute the density profile
> …….
> yt : [INFO     ] 2015-12-14 17:54:21,484 Max Value is 5.46111e-09 at
> 0.5093630427891190 0.4991425970893048 0.5065899804849306
> Traceback (most recent call last):
>   File "test_prof.py", line 26, in <module>
>     profile.add_fields(('gas','density'), weight='cell_volume')
>   File "/home/jhchoi/common-anaconda/src/yt/yt/data_objects/profiles.py",
> line 117, in add_fields
>     self["%s_std" % field] = np.sqrt(std_data[field])
> TypeError: not all arguments converted during string formatting
>
> Could anyone inform me how to resolve this error?
>
> Thank you in advance,
> Junhwan
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20151214/6f8afc2b/attachment.htm>


More information about the yt-users mailing list