Closed rbnvrw closed 3 years ago
Thanks @rbnvrw. All tests pass, but there is a weird segfault right at the end of the pytest (so after everything passes).
This might have to do with the interpreter closing down, maybe something is deallocated that is already deallocated. I have no clue were to start looking. As this is probably unrelated to this PR, I'll just rerun the tests and see how reproducible this is.
Hmm OK weird.. I have no experience with GitHub actions, so I'm not sure where it could be coming from.. it is only for one (Pip / Python 3.7) so maybe there is something wrong in the environment config there?
My first guess would be an incompatibility between specific versions of some compiled packages and/or the python interpreter. But we have many of them, it will be hard to find. Best chance is trying to reproduce the exact environment (so on a linux machine).
Still, this PR seems all right, so, this can be merged.
This commit does a few things:
min_percentile
kwarg to refine/brightfield_ring.py_min_edge()
. Before, I just usednp.nanmin()
there, this was changed tonp.nanpercentile(arr, 5)
because that worked better for experimental data. In the tests however, the edge is very sharp and therefore it would sometimes fail. With this new kwarg, users can define the threshold based on their use case._min_edge()
to get rid of the for loop and only use array operations.np.errstate(invalid='ignore')
to allow comparison to np.nan in refine/brightfield_ring.py_min_edge()
, these are filtered out later. Also suppress warnings on allNaN
slices there, this is OK because those are rows for which a minimum could not be found, these are handled later in the same function.This fixes the tests that failed in issue #642, that were apparently caused by a different default value for the numpy error state (related to point 3 above).