Closed wsdewitt closed 2 years ago
h/t to @willdumm, who guessed this is probably due to the global change in numpy numerical error handling that occurs at module level in gctree.branching_processes
: https://github.com/matsengrp/gctree/blob/28390fb87512b0535e4ea04399e78e8a10f22899/gctree/branching_processes.py#L38
Indeed, if I replace import gctree
with np.seterr(all="raise")
I get the same FloatingPointError
.
We should remove this global np.seterr
, and instead wrap numerical code in the np.errstate
context manager to avoid these pesky side effects.
That’s good to know about! It looks like a function wrapper is also provided that does the same thing, if that seems like it makes sense. I’ll think carefully about which code needs errors turned on.
Certain matplotlib calls—seemingly specific to computing log-scales axes—fail after importing gctree, even without any calls to the gctree package.
The following MWE has been demonstrated on ARM Mac, Intel Mac, and x86_64 Linux.
Plot a log-scaled color bar before gctree import:
Plot a log-scaled color bar after gctree import:
Same color bar command as above:
Conda environment