Measuring direction or magnitude of magnetic fields or magnetic flux