Nitpick: I don't think there's any need for a separate variable here, particularly one declared in the style of a constant. Or, why not just move it to the top of the module with the other constants? It's up to you, I'm not terribly worried about it.

Also, it would be good to see a comment here explaining _why_ we chose the magic number `1e-5`, instead of `1-e1`, `1e-7`, etc.