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

Two program crashes during number exchange #52

Closed dmitrypuzyrev closed 2 years ago

dmitrypuzyrev commented 2 years ago

The GUI crashed twice during number exchange. First time I am not sure what exactly caused it, I think the provided number was less than 12 and the program crashed after one of the "number conflict dialogue" options was selected:

(base) C:\WINDOWS\system32>cd C:\Users\Dmitry\Documents\GitHub\Track_Gui\Python

(base) C:\Users\Dmitry\Documents\GitHub\Track_Gui\Python>python RodTracker.py
Traceback (most recent call last):
  File "C:\Users\Dmitry\Documents\GitHub\Track_Gui\Python\backend\parallelism.py", line 15, in run
    results = self.f()
  File "C:\Users\Dmitry\Documents\GitHub\Track_Gui\Python\backend\data_operations.py", line 198, in change_data
    "particle": 'int'})
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py", line 5796, in astype
    for col_name, col in self.items():
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py", line 1209, in items
    yield k, self._get_item_cache(k)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py", line 3885, in _get_item_cache
    values = self._mgr.iget(loc)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\internals\managers.py", line 981, in iget
    block = self.blocks[self.blknos[i]]
IndexError: tuple index out of range

(base) C:\Users\Dmitry\Documents\GitHub\Track_Gui\Python>

Second time I tried to assign a larger number to the existing rod and the program crashed:

(base) C:\Users\Dmitry\Documents\GitHub\Track_Gui\Python>python RodTracker.py
Traceback (most recent call last):
  File "C:\Users\Dmitry\Documents\GitHub\Track_Gui\Python\ui\mainwindow.py", line 994, in catch_data
    self.update_tree(new_data)
  File "C:\Users\Dmitry\Documents\GitHub\Track_Gui\Python\ui\mainwindow.py", line 342, in update_tree
    "rod_id"]][insert_idx] = "seen" if new_data["seen"] else "unseen"
KeyError: 13
a-niem commented 2 years ago

In the second case the problem is, that the assigned number wasn't present in the data set. So far, there is no mechanism to create this entry, because a ChangedRodNumberAction is used instead of a combination of DeleteRodAction and CreateRodNumberAction.

a-niem commented 2 years ago

The first case seems to be caused by multiple threads executing change_data(...) and therefore are trying to change the same data. This condition can occur when multiple actions are logged.

dmitrypuzyrev commented 2 years ago

In the second case the problem is, that the assigned number wasn't present in the data set. So far, there is no mechanism to create this entry, because a ChangedRodNumberAction is used instead of a combination of DeleteRodAction and CreateRodNumberAction.

You are right, there is not much sense in this operation, but it's easy to mistype while assigning the number. So it would be nice to have an error notification instead of crash :)