simulator icon indicating copy to clipboard operation
simulator copied to clipboard

IndexError when it draws in real time

Open cristobalmedinalopez opened this issue 7 years ago • 9 comments

A IndexError occurs randomly in the draw function when it is drawing in real time (while it is simulating). It could be because it reads a new line when the line is not fully written, so it splits something in a wrong way, causing that m doesn't have a correct format (there are missing elements).

Now it is catched, but with no action. Maybe we could repeat the reading of the same line in this case.

cristobalmedinalopez avatar Mar 23 '17 12:03 cristobalmedinalopez

Where have you provided the catching mechanism? I could not find it in the code.

utkarsh858 avatar Feb 16 '18 04:02 utkarsh858

We finally commented the catching part (see simulator.py from line 347 to 363), because we force to sleep for 2 seconds before starting to draw.

cristobalmedinalopez avatar Feb 16 '18 08:02 cristobalmedinalopez

Hey, I did some modifications to the code to correct the problem but I am not able to simulate it to test. By running simulator with drawing_file option nothing shows up. Are there any pre-requisites for running simulation i.e. I am doing something wrong? Or maybe can you test the modified code?

utkarsh858 avatar Feb 16 '18 10:02 utkarsh858

What if you try to run it separately, for example: Simulate it first:

python3 simulator.py run --number-of-monitors 1 --number-of-peers 4 --number-of-rounds 100 --set-of-rules dbs --drawing-log test.draw

And then draw it:

python3 simulator.py draw --drawing-log test.draw

cristobalmedinalopez avatar Feb 16 '18 11:02 cristobalmedinalopez

Does this error happens once in a while? because when I try to draw the simulation in real time without sleeping for 2 seconds, simulation is running in fine without any errors and also I uncommented the catching part(lines 347 to 363).

abhay44 avatar Feb 16 '18 18:02 abhay44

It seems that the simulator does not draw with the matplotlib version 2.2.1. As simulator did not show any graph. This issue #13 also addresses the same. The older versions are also not available on the internet. Maybe will have to build the 1.5.1 version.

utkarsh858 avatar Feb 17 '18 04:02 utkarsh858

@utkarsh858 it works with 2.0.0 version

abhay44 avatar Feb 17 '18 17:02 abhay44

Hey!, when i'm running the simulation in real time, nothing is drawing up but showing Python quit unexpectedly error even though log filed created successfully . Command Used: sachinsingh$ python3 simulator.py run --number-of-monitors 1 --number-of-peers 4 --number-of-rounds 100 --set-of-rules dbs --drawing-log test.draw --gui Even when i'm drawing it directly from the file that i've created from previous step, it is showing nothing but freezed graphs. Command used: python3 simulator.py draw --drawing-log test.draw OS : MacOS Sierra 10.12.6 matplotlib 2.0.0 . What is the problem ?

sachinsngh165 avatar Feb 19 '18 05:02 sachinsngh165

@sachinsngh165, the code which renders the graphics of the simulation does not work properly with the last versions of matplotlib. This is your problem and the title of this issue. Besides, matplotlib seems to be quite slow for plotting large experiments. For this reason, we are searching an alternative for matplotlib.

vicente-gonzalez-ruiz avatar Feb 19 '18 10:02 vicente-gonzalez-ruiz