Hi Salome,

To add to what Suoqing said, the profile objects will also calculate the variance. So if you do:

p = yt.create_profile(...)

You can then do:

print (p.variance)

Britton

On Sat, Apr 11, 2020 at 12:09 PM Ji, Suoqing <suoqing@caltech.edu> wrote:

Hi Salome,_______________________________________________

You can do variance with yt. For any field x, you can make compute two profiles (weighted by cell-volume so you get the mean value) for x and x^2 separately, then the variance of x = <x^2> - <x>^2, where “<>” denotes the mean values computed in the profiles.

For median values, as far as I’m concerned, 1D profile in yt does not give you this option. But you can easily use binned_statistic in scipy:

and in your case, it would be something like

ad = ds.all_data()… = binned_statistic(ad[“density”].v.ravel(), ad[“temperature”].v.ravel(), statistic=‘median', bins=your_bin_number)

Best wishes,

—

Suoqing Ji

Sherman Fairchild Fellow

TAPIR & Walter Burke Institute for Theoretical Physics

California Institute of Technology

http://www.tapir.caltech.edu/~suoqing

On Apr 11, 2020, at 1:34 AM, Salome Mtchedlidze <salomchedlidze@gmail.com> wrote:

Hello everyone,

As far as I understand when yt makes 1D profile e.g. temperature vs density, the temperature is summed up within the bins and currently, there is no possibility to profile not the sums but the variance or median of the binned field, right?

Or is there a possibility to export this data before yt sums up field values in the bins?

Thanks,

Salome

_______________________________________________

yt-users mailing list -- yt-users@python.org

To unsubscribe send an email to yt-users-leave@python.org

yt-users mailing list -- yt-users@python.org

To unsubscribe send an email to yt-users-leave@python.org