[yt-users] variance versus standard deviation

Nathan Goldbaum nathan12343 at gmail.com
Sun Jan 1 07:50:49 PST 2017

Hi Andrew,

I think the code is simply using the terms "variance" and "standard
deviation" interchangeably here.

You can see how the `variance` array attached to the profile object is
calculated here:


I haven't looked up the mathematical definitions in detail, but I believe
that this is the sample variance at each profile bin (*not* the standard
deviation of the mean).

If you'd like, please feel free to send a pull request to update that
cookbook recipe to label the variance with "variance" instead of "standard
deviation". The code for the cookbook recipe is located here in the


On Sun, Jan 1, 2017 at 8:30 AM Andrew Cunningham <ajcunn at gmail.com> wrote:

> In the following cookbook example:
> http://yt-project.org/doc/cookbook/simple_plots.html#
> profiles-with-variance-values
> the variance along the profile is extracted:
> variance = prof.variance['gas', 'velocity_magnitude'].value
> but is then labelled as the standard deviation when the plot is created:
> plt.loglog(radius, variance, label='Standard Deviation')
> So, does "prof.variance" return the standard deviation and not the
> variance?  Or, is the plot mislabelled?  Should the plot instead be:
> plt.loglog(radius, np.sqrt(variance), label='Standard Deviation')
> _______________________________________________
> 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/20170101/602bbfc9/attachment.htm>

More information about the yt-users mailing list