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:

https://bitbucket.org/yt_analysis/yt/src/09f0ef297d7068078a021fc8290d9e3519baf82d/yt/data_objects/profiles.py?at=yt&fileviewer=file-view-default#profiles.py-183

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 repository:

https://bitbucket.org/yt_analysis/yt/src/09f0ef297d7068078a021fc8290d9e3519baf82d/doc/source/cookbook/profile_with_variance.py?at=yt&fileviewer=file-view-default

On Sun, Jan 1, 2017 at 8:30 AM Andrew Cunningham <ajcunn@gmail.com> wrote:
In the following cookbook example:
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@lists.spacepope.org

http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org