diff --git a/README.md b/README.md index ae44fd5b3ce7154fc5a82cd7513d839b5cd1e84b..76f229a2844c874cd666a459fca0db5a50b942d6 100644 --- a/README.md +++ b/README.md @@ -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* diff --git a/ipi_extract.py b/ipi_extract.py index 079a050473b1c2ab38e485f80d34d2c838738fbf..02babc224454ad081215db77bf56e03d9792d692 100644 --- a/ipi_extract.py +++ b/ipi_extract.py @@ -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)