[yt-users] 1D Profile standard deviation

Stephanie Tonnesen stonnes at gmail.com
Thu Nov 2 18:30:20 PDT 2017


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 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20171102/39418ea5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: yt_diskprofile_oplotdiffrunsnew.py
Type: text/x-python-script
Size: 4531 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20171102/39418ea5/attachment-0001.bin>


More information about the yt-users mailing list