The edge of a magnet works like a guitar fret: a string pressed near the edge sounds different, with a richer set of overtones. Magnetic waves in a thin strip of nickel and iron behave in much the same way.
Inside a piece of diamond hides a tiny defect — a nitrogen atom next to a vacancy. This defect catches magnetic fields like an antenna catches radio waves and responds with flashes of light. Such sensors already measure temperature inside living cells and find defects in microchips.