Skip to content
Snippets Groups Projects
Commit c21c9bd9 authored by Ossi Laine's avatar Ossi Laine
Browse files

Fixed socket connection in embody genration

parent ea9b8649
No related branches found
No related tags found
No related merge requests found
......@@ -950,6 +950,8 @@ def statistics():
questions = question.query.filter_by(experiment_idexperiment=exp_id).all()
pages_and_questions = {}
'''
for p in pages:
questions_list = [(p.idpage, a.idquestion) for a in questions]
pages_and_questions[p.idpage] = questions_list
......@@ -982,6 +984,10 @@ def statistics():
'mean': mean
}
'''
slider_answers = {}
# Background question answers
bg_questions = background_question.query.filter_by(
experiment_idexperiment=exp_id).all()
......
......@@ -183,6 +183,7 @@ def plot_coordinates(coordinates, image_path=DEFAULT_IMAGE_PATH):
# Total amount of points
points_count = len(coordinates['coordinates'])
step = 1
# Load image to a plot
image = mpimg.imread(image_path)
......@@ -213,13 +214,20 @@ def plot_coordinates(coordinates, image_path=DEFAULT_IMAGE_PATH):
ax2.imshow(point, cmap='hot', interpolation='none')
# Try to send progress information to socket.io
if idx == 0:
continue
if round((idx / points_count) * 100) % (step * 5) == 0:
try:
emit('progress', {'done':idx+1/points_count, 'from':points_count})
socketio.sleep(0)
emit('progress', {'done':step * 5, 'from':100})
socketio.sleep(0.05)
except RuntimeError as err:
print(err)
continue
step += 1
image_mask = mpimg.imread(IMAGE_PATH_MASK)
ax2.imshow(image_mask)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment