1)
Yes, the single 5D array (called "m") in the script contains mx,my,mz. To pick which magnetic component, it is the 2nd index. 0 for the x-component, 1 for the y, and 2 for z. The 5 indexes are: time (using : tells it you want all of these), the magnetization component, then the z portion of the structure, then y, then x. So it is stacking all of the time components, the y-component (if it is set to 1). So m[:,1,0,:,:] is grabbing all of the snapshots in time, with the y component of the magnetization, the 0th z-layer (indexing in python starts at 0, and there is only a single layer in the z), all the y layers, and all the x layers.
2)
Changing the second index from 2 to 1 should indeed get you the y-component of the magnetization. If that is the only change you made, it should not cause that error by itself. The error is related to some other change.
It would also help to post the entire error, as it is likely happening in the previous line 'm = np.stack([fields[key] for key in sorted(fields.keys())])'. Python gives error messages that lets you trace back to which line caused issues, and the issue likely happened before the script even got to the line 'my = m[:,1,0,:,:]'.
The shape of the input array comes from the OVF data. So for instance, if you have 45 snapshots of a structure that is 32x32x1 cells, the np.stack function will stack 45 arrays of 3x1x32x32, resulting in a single 45x3x1x32x32 array. However, if there is an OVF that doesn't match those sizes for some reasons (say you ran a previous script with a different structure, and didn't clear the output folder. Or you canceled a simulation mid-run), it will give an error. For instance if you had 45 3x1x32x32 arrays, but one left over 3x1x20x20 array from a previous script in the same folder. It won't know what to do with that 3x1x20x20 array to make it stack properly, since it is not the same size as the 3x1x32x32 arrays, and give this error.
You should check the fields variable and see what size each array is (alternatively, just check the OVF files themselves generated by mumax). Somewhere in there, you likely have a bad (mis-sized) OVF file. Most likely, you have a left over OVF sitting in the folder from some other task that is the wrong size. The read_mumax3_ovffiles python script from the colab just grabs all OVFs in a folder based on the OVF filetype, so if you have a leftover OVF from a different sized script in the same folder or something, it will give an error.
For example if you were generating 45 OVF files, but you cancelled it and shortened it to 25 to test faster. The new script will overwrite the first 25 OVFs automatically, but the second 20 old files will just sit in the directory, and still be seen by the rread_mumax3_ovffiles function. And if you cancelled midway through say the 45th run, that 45 OVF file will only be half-full or empty.
Best,
Josh L.