def labels_to_indices(labels, target_labels, variables_name, logger): indices = [] target_labels = numpy.unique(ensure_list(target_labels)) if len(target_labels) > 0: try: indices = labels_to_inds(labels, target_labels) except IndexError: logger.error( "Failed to access indices of %s: %s.\nExisting %s: %s" % (variables_name, target_labels, variables_name, labels)) raise return indices
def labels2inds(all_labels, labels): return labels_to_inds(all_labels, labels)
def get_sensors_inds_by_sensors_labels(self, lbls): # Make sure that the labels are not bipolar: lbls = [label.split("-")[0] for label in ensure_list(lbls)] return labels_to_inds(self._tvb.labels, lbls)
def get_elecs_inds_by_elecs_labels(self, lbls): if self.elec_labels is not None: return labels_to_inds(self.elec_labels, lbls) else: return None
def get_regions_inds_by_labels(self, lbls): return labels_to_inds(self.region_labels, lbls)
def get_elecs_inds_by_elecs_labels(self, lbls): return labels_to_inds(self.elec_labels, lbls)