<div>Ah, I see why you mean. Changing the name here would change the public-facing API, so I'm not sure there is a quick, easy fix here.</div><div><br></div><div>If you'd like, feel free to open an issue about this so we don't lose track:</div><div><br></div><div><a href="https://bitbucket.org/yt_analysis/yt/issues/new">https://bitbucket.org/yt_analysis/yt/issues/new</a><br></div><div><br><div class="gmail_quote"><div>On Tue, Jan 3, 2017 at 4:43 PM Andrew Cunningham <<a href="mailto:ajcunn@gmail.com">ajcunn@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nathan,<br class="gmail_msg"><br><br class="gmail_msg"><br>Thanks for pointing where to look for the variance computation.  I see in<br class="gmail_msg"><br>the profiles.py you linked to, line 192 in "_finalize_storage"<br class="gmail_msg"><br><br class="gmail_msg"><br>       all_var = np.sqrt(all_var)<br class="gmail_msg"><br><br class="gmail_msg"><br>which later is used to construct "self.variance".  So, after this line,<br class="gmail_msg"><br>"all_var" is really a standard deviation.<br class="gmail_msg"><br><br class="gmail_msg"><br>Consequently, the example in the cookbook is correct.  The variance member<br class="gmail_msg"><br>of the profiles object is really the standard deviation.  There is no<br class="gmail_msg"><br>"bug" in the cookbook example.  Rather, this particular data member in the<br class="gmail_msg"><br>profile object is just misleadingly named.<br class="gmail_msg"><br><br class="gmail_msg"><br>I don't currently have a dev version of yt setup.  I'm more of a humble<br class="gmail_msg"><br>user than agile developer into the yt innards.  I'd be happy to set that<br class="gmail_msg"><br>up and submit a pull request if that would be helpful, but I'm not sure<br class="gmail_msg"><br>what the "right" way to fix this is.<br class="gmail_msg"><br><br class="gmail_msg"><br>One could remove the line:<br class="gmail_msg"><br><br class="gmail_msg"><br>all_var = np.sqrt(all_var)<br class="gmail_msg"><br><br class="gmail_msg"><br>so that the variance member is really the variance and update the cookbook<br class="gmail_msg"><br>example to take the square root inline when making the plot of mean and st<br class="gmail_msg"><br>dev.  Though, that would break user scripts already out in the wild that<br class="gmail_msg"><br>rely on "variance" really being the standard deviation.<br class="gmail_msg"><br><br class="gmail_msg"><br><br class="gmail_msg"><br><br class="gmail_msg"><br><br class="gmail_msg"><br>> Hi Andrew,<br class="gmail_msg"><br>><br class="gmail_msg"><br>> I think the code is simply using the terms "variance" and "standard<br class="gmail_msg"><br>> deviation" interchangeably here.<br class="gmail_msg"><br>><br class="gmail_msg"><br>> You can see how the `variance` array attached to the profile object is<br class="gmail_msg"><br>> calculated here:<br class="gmail_msg"><br>><br class="gmail_msg"><br>> <a href="https://bitbucket.org/yt_analysis/yt/src/09f0ef297d7068078a021fc8290d9e3519baf82d/yt/data_objects/profiles.py?at=yt&fileviewer=file-view-default#profiles.py-183" rel="noreferrer" class="gmail_msg" target="_blank">https://bitbucket.org/yt_analysis/yt/src/09f0ef297d7068078a021fc8290d9e3519baf82d/yt/data_objects/profiles.py?at=yt&fileviewer=file-view-default#profiles.py-183</a><br class="gmail_msg"><br>><br class="gmail_msg"><br>> I haven't looked up the mathematical definitions in detail, but I believe<br class="gmail_msg"><br>> that this is the sample variance at each profile bin (*not* the standard<br class="gmail_msg"><br>> deviation of the mean).<br class="gmail_msg"><br>><br class="gmail_msg"><br>> If you'd like, please feel free to send a pull request to update that<br class="gmail_msg"><br>> cookbook recipe to label the variance with "variance" instead of<br class="gmail_msg"><br>> "standard deviation". The code for the cookbook recipe is located here<br class="gmail_msg"><br>> in the repository:<br class="gmail_msg"><br>><br class="gmail_msg"><br>> <a href="https://bitbucket.org/yt_analysis/yt/src/09f0ef297d7068078a021fc8290d9e3519baf82d/doc/source/cookbook/profile_with_variance.py?at=yt&fileviewer=file-view-default" rel="noreferrer" class="gmail_msg" target="_blank">https://bitbucket.org/yt_analysis/yt/src/09f0ef297d7068078a021fc8290d9e3519baf82d/doc/source/cookbook/profile_with_variance.py?at=yt&fileviewer=file-view-default</a><br class="gmail_msg"><br><br class="gmail_msg"><br><br class="gmail_msg"><br><br class="gmail_msg"><br><br class="gmail_msg"><br><br class="gmail_msg"><br>On Sat, 31 Dec 2016, Andrew Cunningham wrote:<br class="gmail_msg"><br><br class="gmail_msg"><br>> In the following cookbook example:<br class="gmail_msg"><br>><br class="gmail_msg"><br>> <a href="http://yt-project.org/doc/cookbook/simple_plots.html#profiles-with-variance" rel="noreferrer" class="gmail_msg" target="_blank">http://yt-project.org/doc/cookbook/simple_plots.html#profiles-with-variance</a><br class="gmail_msg"><br>> -values<br class="gmail_msg"><br>><br class="gmail_msg"><br>> the variance along the profile is extracted:<br class="gmail_msg"><br>><br class="gmail_msg"><br>> variance = prof.variance['gas', 'velocity_magnitude'].value<br class="gmail_msg"><br>><br class="gmail_msg"><br>> but is then labelled as the standard deviation when the plot is created:<br class="gmail_msg"><br>><br class="gmail_msg"><br>> plt.loglog(radius, variance, label='Standard Deviation')<br class="gmail_msg"><br>><br class="gmail_msg"><br>> So, does "prof.variance" return the standard deviation and not the<br class="gmail_msg"><br>> variance?  Or, is the plot mislabelled?  Should the plot instead be:<br class="gmail_msg"><br>><br class="gmail_msg"><br>> plt.loglog(radius, np.sqrt(variance), label='Standard Deviation')<br class="gmail_msg"><br>><br class="gmail_msg"><br>><br class="gmail_msg"><br>>_______________________________________________<br class="gmail_msg"><br>yt-users mailing list<br class="gmail_msg"><br><a href="mailto:yt-users@lists.spacepope.org" class="gmail_msg" target="_blank">yt-users@lists.spacepope.org</a><br class="gmail_msg"><br><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class="gmail_msg"><br></blockquote></div></div>