Commit 8f22b7d1 authored by ferrari's avatar ferrari
Browse files

Make annotated clicks black

parent b66c0d27
......@@ -46,6 +46,7 @@ Clicking on the sound signal will select the click that will be analysed. The cl
The click will then be displayed in one of the 3 groups of plots selected by the radio button bellow them.
While hovering above the signal, the cursor will have the color of the selected group.
Clicking on a new click will change the click to be analysed. An already analysed click can be clicked again.
Unselected clicks will be black if any fields have been annotated, and purple otherwise.
*Note that a click can be assigned to two groups of plots. This currently cause desyncs in the display of the annotation.
In future an update, this might either be fixed, or the possibilities of selecting the same click for multiple groups will be removed*
......
......@@ -287,7 +287,10 @@ class Callback(object):
pos = int(FSSR*event.xdata)
mpos = np.argmax(self.song_resample[max(pos-int(FSSR*FSPK),0):pos+int(FSSR*FSPK)]) + max(pos-int(FSSR*FSPK),0)
if self.curr_ind[self.curr] is not None:
self.scat._facecolors[self.curr_ind[self.curr]] = [0.7, 0.2, 0.5, 1]
if np.all(np.isnan(list(self.df[self.offset[self.curr_ind[self.curr], 0]].values()))):
self.scat._facecolors[self.curr_ind[self.curr]] = [0.7, 0.2, 0.5, 1]
else:
self.scat._facecolors[self.curr_ind[self.curr]] = [0, 0, 0, 1]
if mpos/FSSR not in self.offset[:,0]:
self.offset = np.concatenate([self.offset, [[mpos/FSSR, self.song_resample[mpos]]]], axis=0)
self.scat.set_offsets(self.offset)
......@@ -722,7 +725,11 @@ def main(args):
ref_dict['callback'].offset = np.tile(np.array(list(ref_dict['callback'].df.keys()))[:, np.newaxis], (1,2))
ref_dict['callback'].offset[:, 1] = ref_dict['callback'].song_resample[(ref_dict['callback'].offset[:, 1] * FSSR).astype(int)]
ref_dict['callback'].scat.set_offsets(ref_dict['callback'].offset)
ref_dict['callback'].scat.set_color(np.array(len(ref_dict['callback'].offset)*[[0.7, 0.2, 0.5, 1]]))
colors = np.array(len(ref_dict['callback'].offset)*[[0.7, 0.2, 0.5, 1]])
for i, p in enumerate(ref_dict['callback'].offset[:, 0]):
if not np.all(np.isnan(list(ref_dict['callback'].df[p].values()))):
colors[i] = [0, 0, 0, 1]
ref_dict['callback'].scat.set_color(colors)
plt.draw()
plt.pause(0.2)
ref_dict['fig'].set_constrained_layout(False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment