SELECT_ALL=("SELECT coordinates from embody_answer")
SELECT_BY_EXP_ID='select coordinates from embody_answer as em JOIN (SELECT idanswer_set FROM answer_set as a JOIN experiment as e ON a.experiment_idexperiment=e.idexperiment AND e.idexperiment=%s) as ida ON em.answer_set_idanswer_set=ida.idanswer_set'
exp_id=2
cursor.execute(SELECT_BY_EXP_ID,(exp_id,))
# Init coordinate arrays
x=[]
y=[]
# Loop through all of the saved coordinates and push them to coordinates arrays
forcoordinateincursor:
coordinates=json.loads(coordinate[0])
x.extend(coordinates['x'])
y.extend(coordinates['y'])
defmap_coordinates(a,b):
return[a,b]
coordinates=list(map(map_coordinates,x,y))
# Plot coordinates as points
plt.subplot2grid((2,2),(0,0))
plt.title("raw points")
plt.plot(x,y,'ro',alpha=0.2)
plt.imshow(image)
plt.grid(True)
# Draw circles from coordinates (imshow don't need interpolation)