
Hi yt-users!
I am trying to make a profile plot of the standard deviation of the gas density of a galaxy for a few outputs. I *think* I am closely following the cookbook example:
http://yt-project.org/doc/cookbook/simple_plots.html?highlight=profileplot%2...
but am getting an error:
AttributeError: 'Profile1D' object has no attribute 'standard_deviation'
Here is a code snippet, and I will attach the whole ugly script in case I missed anything that someone needs to see (ignore the strange indents below, cut and paste does not love me):
ds = yt.load("/data001/stonnes/"+loopfile[i]+"/DD"+loop[i]+"/"+loopfile[i]+loop[i]) disk1 = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(2,"kpc")) disk = disk1.cut_region(["obj['Metal_Density']/obj['density'] > 0.05"])
prof = yt.create_profile(disk, 'radius',('gas','density'), n_bins=52, units={'radius':'kpc'}, weight_field='ones', extrema={'radius':((0.0,'kpc'),(40.0,'kpc'))}, )
radius = prof.x mean = prof['gas','density'] std = prof.standard_deviation['gas','density']
plt.semilogy(radius,mean,color=cols[i],linewidth=lw[i],linestyle=linest[i],label=looptext[i]) plt.ylim(1e-27,1e-21) plt.xlabel('r (kpc)') plt.ylabel(r'density (g/cm$^3$)') plt.legend()
I am using yt version 3.4-dev, and the line that gets the error is:
std = prof.standard_deviation['gas','density']
Any help is much appreciated! Thanks, Stephanie -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY
stonnes@gmail.com

Hi Stephanie,
The `standard_deviation` attribute was added late during the 3.4 development cycle, in May. You say you're running 3.4-dev, so it's possible you're running a version from before we added that. See:
https://github.com/yt-project/yt/pull/1372
If you update yt to version 3.4.0 (the current stable release) or update to the latest development version of yt (3.5dev) the issue you're running into should go away.
-Nathan
On Thu, Nov 2, 2017 at 8:30 PM, Stephanie Tonnesen stonnes@gmail.com wrote:
Hi yt-users!
I am trying to make a profile plot of the standard deviation of the gas density of a galaxy for a few outputs. I *think* I am closely following the cookbook example:
http://yt-project.org/doc/cookbook/simple_plots.html? highlight=profileplot%20standard%20deviation
but am getting an error:
AttributeError: 'Profile1D' object has no attribute 'standard_deviation'
Here is a code snippet, and I will attach the whole ugly script in case I missed anything that someone needs to see (ignore the strange indents below, cut and paste does not love me):
ds = yt.load("/data001/stonnes/"+loopfile[i]+"/DD"+loop[i]+"/"+ loopfile[i]+loop[i]) disk1 = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(2,"kpc")) disk = disk1.cut_region(["obj['Metal_Density']/obj['density'] > 0.05"])
prof = yt.create_profile(disk, 'radius',('gas','density'), n_bins=52, units={'radius':'kpc'}, weight_field='ones', extrema={'radius':((0.0,'kpc'),(40.0,'kpc'))}, ) radius = prof.x mean = prof['gas','density'] std = prof.standard_deviation['gas','density'] plt.semilogy(radius,mean,color=cols[i],linewidth=lw[i],
linestyle=linest[i],label=looptext[i]) plt.ylim(1e-27,1e-21) plt.xlabel('r (kpc)') plt.ylabel(r'density (g/cm$^3$)') plt.legend()
I am using yt version 3.4-dev, and the line that gets the error is:
std = prof.standard_deviation['gas','density']
Any help is much appreciated! Thanks, Stephanie -- Dr. Stephanie Tonnesen Associate Research Scientist CCA, Flatiron Institute New York, NY
stonnes@gmail.com
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
Nathan Goldbaum
-
Stephanie Tonnesen