You don't need to put the whole line in math mode, that is part of where you are running into trouble. In particular, you are putting the whole equation inside \mathrm{}, instead of just {Intensity }
. The following would probably be better, and you shouldn't get the extra whitespace at the end:
plt.ylabel('Intensity $(10^{' + str(int(orderMagnitude)) + '})$')