soft-matter / trackpy

Python particle tracking toolkit
http://soft-matter.github.io/trackpy
Other
445 stars 131 forks source link

TestBrightfieldRing fails on all but Py3.9 NumPy1.19 envs #642

Closed caspervdw closed 3 years ago

caspervdw commented 3 years ago

For example: https://github.com/caspervdw/trackpy/runs/1946300540

On Py3.8 environment, only one error remains.

@rbnvrw Do you have time to take a look?

Tracebacks all look like:

______________ TestLocateBrightfieldRing.test_cluster_more_noisy _______________
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.7/x64/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/runner/work/trackpy/trackpy/trackpy/locate_functions/brightfield_ring.py", line 158, in _get_refined_coords
    result = refine_brightfield_ring(image, radius, positions,
  File "/home/runner/work/trackpy/trackpy/trackpy/refine/brightfield_ring.py", line 55, in refine_brightfield_ring
    result = _refine_brightfield_ring(image, r, coords_df, rad_range=rad_range,
  File "/home/runner/work/trackpy/trackpy/trackpy/refine/brightfield_ring.py", line 122, in _refine_brightfield_ring
    r_dev = _min_edge(intensity, **kwargs)
  File "/home/runner/work/trackpy/trackpy/trackpy/refine/brightfield_ring.py", line 172, in _min_edge
    argmin = np.where(row < min_val)[0]
FloatingPointError: invalid value encountered in less
"""

The above exception was the direct cause of the following exception:

self = <test_brightfield_ring.TestLocateBrightfieldRing testMethod=test_cluster_more_noisy>

    def test_cluster_more_noisy(self):
>       actual, expected = artificial_cluster(self.image_size,
                                              self.n_feat_cluster,
                                              self.radius, noise_level=51,
                                              separation=self.cluster_sep)

trackpy/tests/locate/test_brightfield_ring.py:190: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
trackpy/tests/locate/test_brightfield_ring.py:58: in artificial_cluster
    return draw_artificial_image(shape, pos, radius, noise_level, dip,
trackpy/tests/locate/test_brightfield_ring.py:32: in draw_artificial_image
    result = locate_brightfield_ring(image, diameter, **kwargs)
trackpy/locate_functions/brightfield_ring.py:125: in locate_brightfield_ring
    for result in map_func(_get_refined_coords, [(coords, pos_columns, image, radius, kwargs, has_user_input) for _, coords in coords_df.iterrows()]):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <multiprocessing.pool.IMapIterator object at 0x7f2213001160>
timeout = None

    def next(self, timeout=None):
        with self._cond:
            try:
                item = self._items.popleft()
            except IndexError:
                if self._index == self._length:
                    self._pool = None
                    raise StopIteration from None
                self._cond.wait(timeout)
                try:
                    item = self._items.popleft()
                except IndexError:
                    if self._index == self._length:
                        self._pool = None
                        raise StopIteration from None
                    raise TimeoutError from None

        success, value = item
        if success:
            return value
>       raise value
E       FloatingPointError: invalid value encountered in less

/opt/hostedtoolcache/Python/3.8.7/x64/lib/python3.8/multiprocessing/pool.py:868: FloatingPointError
caspervdw commented 3 years ago

@rbnvrw Do you have time to have a look at the test failures? I want to go forward with a maintenance release, but these failures are holding me back. Please let me know.

rbnvrw commented 3 years ago

Yes, I'll look at it!

rbnvrw commented 3 years ago

Fixed by PR #654