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
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)
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?
yt-users mailing list -- email@example.com
To unsubscribe send an email to