Closed chongxi closed 6 years ago
That is because the order of electrodes in the view and grp_idx is different. Add edge finding:
def grp_2_edges(self, grp_dict):
_grp_idx = []
for grp_id, grp in grp_dict.items():
_grp = np.array([np.where(self.electrode_id==i)[0] for i in grp]).squeeze()
_grp_idx.append(_grp)
# print _grp
if grp_id == 0:
edges = np.array([i for i in comb(_grp, 2)])
else:
edges = np.vstack((edges, np.array([i for i in comb(_grp, 2)])))
# print edges
return edges, _grp_idx
self.edges, self.grp_idx = self.grp_2_edges(prb.grp_dict)
when selected:
def select(self, group_id):
if hasattr(self.prb, 'grp_dict'):
self.electrode_edge.color[:] = np.ones((self.electrode_pos.shape[0], 4))*0.5
self.electrode_edge.color[self.grp_idx[group_id],:] = np.array([1,0,0,0.5])
self.update()