I've got various 3D arrays that I'm viewing 2D slices of, along either the X, Y or Z axis.
To simplify my code, I would like to have one location of declaring the slice such as
# X View
my_view = [10, :, :]
# Y View
# my_view = [:, 4, :]
# Z View
# my_view = [:, :, 7]
and choose which view to run in my script.
Then the rest of my code can apply the myview slice when visualizing,
plt.plot(my_data[myview])
plt.plot(more_data[myview])
There's no way to "store" the ':' portion of the slice. How would I accomplish this in Python/Numpy?
myview=(4, slice(None), slice(None))etc