ANP-Granular / ParticleTracking

Library and GUI for tracking (rod-like) particles on camera images in 2D and 3D
https://particletracking.readthedocs.io/en/latest/
GNU General Public License v3.0
2 stars 2 forks source link

Program crashed #48

Closed dmitrypuzyrev closed 2 years ago

dmitrypuzyrev commented 2 years ago

Most probably division by zero while pruning the rods and then error while converting resulting NAN to integer for plotting

The following error was produced:

C:\Users\Dmitry Puzyrev\Documents\GitHub\Track_Gui\Python\ui\rodimagewidget.py:785: RuntimeWarning: invalid value encountered in true_divide
  rod_direction = rod_direction/np.sqrt(np.sum(rod_direction**2))
Traceback (most recent call last):
  File "C:\Users\Dmitry Puzyrev\Documents\GitHub\Track_Gui\Python\ui\mainwindow.py", line 1194, in <lambda>
    -self._rod_incr, False))
  File "C:\Users\Dmitry Puzyrev\Documents\GitHub\Track_Gui\Python\ui\rodimagewidget.py", line 793, in adjust_rod_length
    self.draw_rods()
  File "C:\Users\Dmitry Puzyrev\Documents\GitHub\Track_Gui\Python\ui\rodimagewidget.py", line 267, in draw_rods
    rod_pos = self.adjust_rod_position(rod)
  File "C:\Users\Dmitry Puzyrev\Documents\GitHub\Track_Gui\Python\ui\rodimagewidget.py", line 833, in adjust_rod_position
    for coord in rod_pos]
  File "C:\Users\Dmitry Puzyrev\Documents\GitHub\Track_Gui\Python\ui\rodimagewidget.py", line 833, in <listcomp>
    for coord in rod_pos]
ValueError: cannot convert float NaN to integer
a-niem commented 2 years ago

The application would break when rods of length 0 are present, while the length of all rods is adjusted. This situation is realized when rods are deleted and therefore replaced by one at [(0,0),(0,0)].

See 514c8c3 for the fix.