示例#1
0
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
示例#2
0
 def labels2inds(all_labels, labels):
     return labels_to_inds(all_labels, labels)
示例#3
0
 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)
示例#4
0
 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
示例#5
0
 def get_regions_inds_by_labels(self, lbls):
     return labels_to_inds(self.region_labels, lbls)
示例#6
0
 def get_elecs_inds_by_elecs_labels(self, lbls):
     return labels_to_inds(self.elec_labels, lbls)