<div dir="ltr">Hi Junhwan,<div><br></div><div>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.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 14, 2015 at 5:00 PM, Junhwan Choi (최준환) <span dir="ltr"><<a href="mailto:choi.junhwan@gmail.com" target="_blank">choi.junhwan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear yt users and developers,<br>
<br>
I get an error while I try to make a  radial-averaged  profile using yt.<br>
In order to compute the profile I wrote the following script:<br>
===================================<br>
import matplotlib as matplotlib<br>
matplotlib.use('Agg')<br>
import yt<br>
import yt.units as units<br>
import numpy as np<br>
import matplotlib.pyplot as plt<br>
<br>
def _radiuspc(field, data):<br>
    return data[('radius')].in_units('pc')<br>
yt.add_field('radiuspc', function=_radiuspc, units="pc")<br>
<br>
rmax = 1000<br>
Nbin = 50<br>
ds = yt.load("../DD0099/DD0099")<br>
ds.index<br>
ad= ds.all_data()<br>
<br>
center = ds.find_max("density")[1]<br>
my_sphere = ds.sphere("center", (rmax, "pc"))<br>
<br>
rmin = max([0.1,2.0*ds.index.get_smallest_dx().in_units('pc')])<br>
profile = yt.BinnedProfile1D(my_sphere, Nbin, 'radius', rmin,<br>
rmax*units.pc, log_space=True, end_collect=False)<br>
profile.add_fields(('gas','density'), weight='cell_volume')<br>
<br>
plt.plot(na.log10(profile['radius']), na.log10(profile['density']))<br>
plt.savefig('ProfGasDensity')<br>
===================================<br>
<br>
And, I get an following error to compute the density profile<br>
…….<br>
yt : [INFO     ] 2015-12-14 17:54:21,484 Max Value is 5.46111e-09 at<br>
0.5093630427891190 0.4991425970893048 0.5065899804849306<br>
Traceback (most recent call last):<br>
  File "test_prof.py", line 26, in <module><br>
    profile.add_fields(('gas','density'), weight='cell_volume')<br>
  File "/home/jhchoi/common-anaconda/src/yt/yt/data_objects/profiles.py",<br>
line 117, in add_fields<br>
    self["%s_std" % field] = np.sqrt(std_data[field])<br>
TypeError: not all arguments converted during string formatting<br>
<br>
Could anyone inform me how to resolve this error?<br>
<br>
Thank you in advance,<br>
Junhwan<br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote></div><br></div>