juliencegarra / OpenMATB

OpenMATB: A Multi-Attribute Task Battery promoting task customization, software extendability and experiment replicability
Other
43 stars 32 forks source link

Scenario 'basic' is breaking #16

Closed thomakl closed 1 year ago

thomakl commented 1 year ago

Hi,

The scenario 'basic.txt' seems to dislike the scale according to the error :

Traceback (most recent call last):
  File "C:\Users\username\Projets\OpenMATB\main.py", line 77, in <module>
    app.run()
  File "C:\Users\username\Projets\OpenMATB\main.py", line 73, in run
    self.scheduler.run()
  File "C:\Users\username\Projets\OpenMATB\core\scheduler.py", line 260, in run
    self.event_loop.run()
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\app\base.py", line 169, in run
    timeout = self.idle()
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\app\base.py", line 239, in idle
    redraw_all = self.clock.call_scheduled_functions(dt)
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\clock.py", line 255, in call_scheduled_functions
    item.func(dt, *item.args, **item.kwargs)
  File "C:\Users\username\Projets\OpenMATB\core\clock.py", line 25, in advance
    self.tick()
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\clock.py", line 348, in tick
    self.call_scheduled_functions(delta_t)
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\clock.py", line 255, in call_scheduled_functions
    item.func(dt, *item.args, **item.kwargs)
  File "C:\Users\username\Projets\OpenMATB\core\scheduler.py", line 106, in update
    [p.update(self.scenariotime) for p in ap]
  File "C:\Users\username\Projets\OpenMATB\core\scheduler.py", line 106, in <listcomp>
    [p.update(self.scenariotime) for p in ap]
  File "C:\Users\username\Projets\OpenMATB\plugins\abstract.py", line 435, in update
    self.make_slide_graphs()
  File "C:\Users\username\Projets\OpenMATB\plugins\genericscales.py", line 37, in make_slide_graphs
    height_in_prop = (self.question_height_ratio * self.container.h)/all_scales_container.h
ZeroDivisionError: float division by zero

Process finished with exit code 1

Cheers,

benoitvalery commented 1 year ago

The basic.txt scenario is working well on my side. What questionnaire are you using? By default, it is nasatlx_fr.txt, in includes/questionnaires

thomakl commented 1 year ago

Hi, Any of the questionnares are working on my side. Running the program with only one screen doesn't change the error. According to the code, Container(name=fullscreen_reduced, l=0.0, b=432.0, w=1536, h=0.0)

Any thoughts ?

benoitvalery commented 1 year ago

@thomakl, did you change something else in the code? What is the line you mention (Container), where is it in the code? I can’t see any fullscreen_reduced value in the original code.

thomakl commented 1 year ago

Hi, Container(name=fullscreen_reduced, l=0.0, b=432.0, w=1536, h=0.0) is coming from the debug mode. Here is a screenshot attached to understand better. As for my personal code, I did modified some files (communications, tanker, resman) but nothing about the container or the genericscales. 2023-04-06_issue_ #16

The bug comes from the line 41.

benoitvalery commented 1 year ago

The last commit should correct this bug. This was because the code did not take into account the case where only one scale is defined (your case).

thomakl commented 1 year ago

See last commit on "genericscales.py" It seems that the scale_list = [s for s in self.current_slide.split('linesep') if len(s.strip()) > 0] with linesep in Windows doesn't cut the text. According to the file "os.py" the linesep represents "\r\n" however according to the questionnaire (nasatlx_en.txt for instance) it only have the "\n". Replacing the linesep "\r\n" by "\n" does the work.

benoitvalery commented 1 year ago

OK, this is because os is detecting the line separation of your OS (Windows I guess) and that the scenario file you are currently testing was written under Linux (with other linesep), so there is a conflict between a presumed and a real line separation. I suggest to get rid of the linesep guess, to force this to be \n, and to strip the rest of the line (eventually removing a remaining line separation). Look forward for the next commit and tell me what happens for you.

thomakl commented 1 year ago

Perfect. Thank you.