I have data in an hdf5 file that I have converted into a numpy array of shape (57, 90, 128).
Here's the 3D array labelled x:
[[[41.9384 41.272415 40.617287 ... 48.844627 49.244698 49.661514]
[41.397217 40.723698 40.063335 ... 48.1394 48.545223 48.967934]
[40.870575 40.188343 39.519466 ... 47.44466 47.85631 48.28499 ]
...
[43.442932 42.55078 41.66337 ... 37.415535 38.148727 38.89263 ]
[43.761475 42.87579 41.994297 ... 37.902004 38.627724 39.36299 ]
[44.100094 43.220413 42.346016 ... 38.408096 39.12455 39.85264 ]]
[[41.44701 40.775562 40.11295 ... 48.26646 48.67123 49.092865]
[40.900696 40.22024 39.55203 ... 47.552746 47.963478 48.39122 ]
[40.371548 39.68155 39.004093 ... 46.849396 47.26618 47.700108]
...
[43.12938 42.23068 41.33658 ... 36.93269 37.674095 38.426914]
[43.450195 42.558193 41.671036 ... 37.426445 38.15917 38.90268 ]
[43.791267 42.906277 42.025517 ... 37.938747 38.66349 39.397842]]
[[40.97391 40.294678 39.6272 ... 47.702103 48.111572 48.53802 ]
[40.42128 39.73272 39.057457 ... 46.979904 47.395554 47.82832 ]
[39.885853 39.188004 38.50331 ... 46.26794 46.68986 47.12904 ]
...
[42.836636 41.931736 41.0312 ... 36.469273 37.219494 37.981075]
[43.159603 42.26154 41.3681 ... 36.969868 37.709877 38.46132 ]
[43.50288 42.611694 41.72538 ... 37.488487 38.218582 38.96034 ]]
...
[[42.853973 42.278515 41.718906 ... 46.573013 46.990417 47.425053]
[42.302387 41.719414 41.152294 ... 45.83322 46.25723 46.69862 ]
[41.767265 41.176807 40.6022 ... 45.10336 45.53409 45.982346]
...
[34.871326 34.024693 33.186466 ... 38.512096 39.27535 40.047714]
[35.281048 34.44434 33.61643 ... 38.854664 39.616066 40.38247 ]
[35.71375 34.887276 34.069973 ... 39.219414 39.978626 40.73876 ]]
[[43.45026 42.882713 42.330997 ... 47.10841 47.521156 47.951035]
[42.906254 42.3315 41.77259 ... 46.377068 46.7962 47.232605]
[42.37867 41.796745 41.223293 ... 45.655804 46.08143 46.524467]
...
[35.227253 34.389256 33.560005 ... 39.06131 39.82936 40.59552 ]
[35.632935 34.80457 33.985306 ... 39.3989 40.16079 40.925377]
[36.061474 35.243042 34.434063 ... 39.75842 40.513924 41.276577]]
[[44.061012 43.501347 42.957485 ... 47.65862 48.066692 48.49178 ]
[43.52455 42.95454 42.393147 ... 46.93576 47.35 47.7814 ]
[42.98583 42.401543 41.83282 ... 46.223125 46.643623 47.08143 ]
...
[35.607372 34.778408 33.95852 ... 39.617744 40.382706 41.15282 ]
[36.00883 35.18919 34.378963 ... 39.950607 40.70939 41.47392 ]
[36.43301 35.622997 34.82272 ... 40.305264 41.057575 41.816097]]]
To better visualise this array I have created a plot:
plt.rcParams["figure.figsize"] = [18.00, 14.50]
plt.rcParams["figure.autolayout"] = True
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
data = sdf
z, x, y = data.nonzero()
ax.scatter(x, y, z, c=z, alpha=1)
ax.plot(x, y, z, label='3D Array of Shape: (57, 90, 128)')
ax.legend(fontsize=25)
ax.set_xlabel('$Rows$', fontsize=20)
ax.set_ylabel('$Columns$', fontsize=20)
ax.set_zlabel('$Order layers$', fontsize=20)
plt.show()
My question is that can we understand this data structure to be (in this case) 57 matrices of shape (90, 128) stacked on top of each other?
For example;
i. Selects the second layer and all the rows and columns of that matrix?
x[1, :, :]
ii. Selects all the layers and the second row and all the columns?
x[:, 1, :]
iii. Selects all the layers and all the rows and the second column?
x[:, :, 1]
iv. Selects the first and second layers and the third and fourth rows and the fifth and sixth columns?
x[0:2, 3:5, 5:7]
Thanks in advance:)
