Skip to content
Snippets Groups Projects
Commit 8f22b7d1 authored by ferrari's avatar ferrari
Browse files

Make annotated clicks black

parent b66c0d27
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,7 @@ Clicking on the sound signal will select the click that will be analysed. The cl ...@@ -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. 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. 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. 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. *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* 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): ...@@ -287,7 +287,10 @@ class Callback(object):
pos = int(FSSR*event.xdata) 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) 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: if self.curr_ind[self.curr] is not None:
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] 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]: if mpos/FSSR not in self.offset[:,0]:
self.offset = np.concatenate([self.offset, [[mpos/FSSR, self.song_resample[mpos]]]], axis=0) self.offset = np.concatenate([self.offset, [[mpos/FSSR, self.song_resample[mpos]]]], axis=0)
self.scat.set_offsets(self.offset) self.scat.set_offsets(self.offset)
...@@ -722,7 +725,11 @@ def main(args): ...@@ -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 = 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'].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_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.draw()
plt.pause(0.2) plt.pause(0.2)
ref_dict['fig'].set_constrained_layout(False) ref_dict['fig'].set_constrained_layout(False)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment