diff --git a/app/experiment/views.py b/app/experiment/views.py index d365138eb3100a8687975007133c03b8dedf8c81..46d148c0e0561adadcc26c7ed69208b05dc894a2 100644 --- a/app/experiment/views.py +++ b/app/experiment/views.py @@ -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 @@ -979,9 +981,13 @@ def statistics(): # slider_answers['mean'] = get_mean_from_slider_answers(slider_answers) slider_answers = { - 'mean': mean + 'mean': mean } + ''' + + slider_answers = {} + # Background question answers bg_questions = background_question.query.filter_by( experiment_idexperiment=exp_id).all() diff --git a/embody_plot.py b/embody_plot.py index cd74f0b8a84e6deab8a57eaab6073a2c4a896955..169587bc34272d2f219323006a76058e81779dc0 100644 --- a/embody_plot.py +++ b/embody_plot.py @@ -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) @@ -205,21 +206,28 @@ def plot_coordinates(coordinates, image_path=DEFAULT_IMAGE_PATH): for idx, point in enumerate(coordinates["coordinates"]): try: - frame[int(point[1]), int(point[0])] = 1 + frame[int(point[1]), int(point[0])] = 1 except IndexError as err: - app.logger.info(err) + app.logger.info(err) point = ndimage.gaussian_filter(frame, sigma=5) ax2.imshow(point, cmap='hot', interpolation='none') # Try to send progress information to socket.io - try: - emit('progress', {'done':idx+1/points_count, 'from':points_count}) - socketio.sleep(0) - except RuntimeError as err: - print(err) + + if idx == 0: continue + if round((idx / points_count) * 100) % (step * 5) == 0: + try: + 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)