Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting x,y,z, mean through a 3D data array

Suppose I have an array which is NxNxN and I want to create an averaged array which stacks each direction. x-y (averaged over z), x-z (averaged over y), y-z (averaged over x)

For x-y I would do:

np.mean(data,axis=1, dtype=np.float64)

Do I simply use axis=1 [or 2 or 3] to stack it in each direction?

like image 511
Griff Avatar asked Nov 12 '22 02:11

Griff


1 Answers

If your NxNxN array is a numpy.ndarray:

xy = NNN.mean(axis=2)
xz = NNN.mean(axis=1)
yz = NNN.mean(axis=0)
like image 163
Saullo G. P. Castro Avatar answered Nov 15 '22 10:11

Saullo G. P. Castro