A total niggle, but if the line below this is all that's required is the `sqrt` then we could use `import math` here, since as far as I can see we don't need to allow for any array processing capability.  Of course it hardly matters at all since almost certainly `numpy` is already imported!  But I'm on a boring bus journey and feeling OCD so I'm going to change this...