Open jisuoqing opened 5 years ago
This is the kind of stuff that I really miss right now in yt, I'd be interested in making this a thing.
Unfortunately this is a lot less trivial than calling np.average
but I think the machinery is already present in yt.ProjectionPlot
.
We could build a ds.add_average_fields()
method by imitating the logic in ds.add_gradient_fields()
. Ideally the new method would also accept an arbitrary axis as an argument (just like ProjectionPlot
!), though it may not be necessary for a first version.
It would be nice to obtain some averaged field along one axis only via a derived field.
Say, if the simulation data has field
field[x,y,z]
, then create the new derived field of the average alongz
axis:new_field = np.average(field, axis=2)[...,None]
.This is particularly useful for computing fluctuations relative some mean background in plane-parallel or non-axisymmetric components, etc.