Return a human-readable representation of the Cannon label vector.
        
        label_vector should be [[(1,2), (2,1)], [(1,3)]] etc.
554951
def _repr_label_vector(self, label_vector):
        

        string = ["1"]
        for cross_terms in label_vector:
            sub_string = []
            for index, order in cross_terms:
                _ = self.grid_points.dtype.names[index]
                if order > 1:
                    sub_string.append("{0}^{1}".format(_, order))
                else:
                    sub_string.append(_)
            string.append(" * ".join(sub_string))
        return " + ".join(string)
925196
def index_labels_to_array(labels, dtype=None):
    
    if isinstance(labels, (str, tuple)):
        labels = [labels]

    if not isinstance(labels, (list, np.ndarray)):
        try:
            labels = list(labels)
        except TypeError:  # non-iterable
            labels = [labels]

    labels = asarray_tuplesafe(labels, dtype=dtype)

    return labels
121629
def inherited_labels(cls):
        
        return [scls.__label__ for scls in cls.mro()
                if hasattr(scls, '__label__') and not hasattr(
                scls, '__abstract_node__')]
891029
def createLabels2D(self):
        
        logger.debug("  Creating 2D labels...")
        self.zmax = np.argmax(self.values,axis=1)
        self.vmax = self.values[np.arange(len(self.pixels),dtype=int),self.zmax]

        kwargs=dict(pixels=self.pixels,values=self.vmax,nside=self.nside,
                    threshold=self.threshold,xsize=self.xsize)
        labels,nlabels = CandidateSearch.labelHealpix(**kwargs)
        self.nlabels = nlabels
        self.labels = np.repeat(labels,len(self.distances)).reshape(len(labels),len(self.distances))
        return self.labels, self.nlabels
674471
def extract_labels(filename):
    """"""
    with gzip.open(filename) as bytestream:
        magic = _read32(bytestream)
        if magic != 2049:
            raise ValueError(
                'Invalid magic number %d in MNIST label file: %s' %
                (magic, filename))
        num_items = _read32(bytestream)
        buf = bytestream.read(num_items)
        labels = numpy.frombuffer(buf, dtype=numpy.uint8)
        return labels
862451
def label(self):
        """"""
        if not self.desc:
            return "%.3fs" % self.timestamp
        return "%s (%.3fs)" % (self.desc, self.timestamp)
99901
def p_label_line_co(p):
    
    lbl = make_label(p[1], p.lineno(1))
    p[0] = make_block(lbl, p[2]) if len(p) == 3 else lbl
857750
def node_labels(self):
        """"""
        assert list(self.node_indices)[0] == 0
        labels = list("m{}".format(i) for i in self.node_indices)
        return NodeLabels(labels, self.node_indices)
899650
def labelset_heads(self, label):
        
        _eps = self._eps
        _vars = self._vars
        _hcons = self._hcons
        nodeids = {nodeid: _eps[nodeid][3].get(IVARG_ROLE, None)
                for nodeid in _vars[label]['refs']['LBL']}
        if len(nodeids) <= 1:
            return list(nodeids)

        scope_sets = {}
        for nid in nodeids:
            scope_sets[nid] = _ivs_in_scope(nid, _eps, _vars, _hcons)

        out = {}
        for n in nodeids:
            out[n] = 0
            for role, val in _eps[n][3].items():
                if role == IVARG_ROLE or role == CONSTARG_ROLE:
                    continue
                elif any(val in s for n2, s in scope_sets.items() if n2 != n):
                    out[n] += 1

        candidates = [n for n, out_deg in out.items() if out_deg == 0]
        rank = {}
        for n in candidates:
            iv = nodeids[n]
            pred = _eps[n][1]
            if iv in _vars and self.nodeid(iv, quantifier=True) is not None:
                rank[n] = 0
            elif pred.is_quantifier():
                rank[n] = 0
            elif pred.type == Pred.ABSTRACT:
                rank[n] = 2
            else:
                rank[n] = 1

        return sorted(candidates, key=lambda n: rank[n])
583137
def msg_(self, label, *msg):
        
        txt = self._unpack_msg(*msg)
        return "[" + label + "] " + txt
1368180
def pprint_label(self):
        ""
        unit = ('' if self.unit is None
                else type(self.unit)(self.unit_format).format(unit=self.unit))
        return bytes_to_unicode(self.label) + bytes_to_unicode(unit)
788152
def _get_label(placeholder, label_mapping, label_i):
    
    if placeholder in label_mapping:
        return label_mapping[placeholder], label_mapping, label_i

    new_target = Label("{}{}".format(placeholder.prefix, label_i))
    label_i += 1
    label_mapping[placeholder] = new_target
    return new_target, label_mapping, label_i
1095428
def labels(self, text=None, coordinates=None, colorlist=None, sizes=None, fonts=None, opacity=1.0):
        ''''''
        if coordinates is None:
            coordinates=self.coordinates
        l=len(coordinates)
        if text is None:
            if len(self.topology.get('atom_types'))==l:
                text=[self.topology['atom_types'][i]+str(i+1) for i in range(l)]
            else:
                text=[str(i+1) for i in range(l)]

        text_representation = self.add_representation('text', {'coordinates':   coordinates,
                                                               'text':        text,
                                                               'colors':      colorlist,
                                                               'sizes':       sizes,
                                                               'fonts':       fonts,
                                                               'opacity':     opacity})
        def update(self=self, text_representation=text_representation):
            self.update_representation(text_representation, {'coordinates': coordinates})

        self.update_callbacks.append(update)
1044506
def labels(self, include_missing=False, include_transforms_for_dims=False):
        
        return [
            dim.labels(include_missing, include_transforms_for_dims)
            for dim in self.dimensions
        ]
378613
def labels(self):
        
        return [
            name for name in os.listdir(self.root)
            if os.path.isdir(os.path.join(self.root, name))
        ]
520364
def get_safe_seaborn_labels(dfr, labels):
    """"""
    if labels is not None:
        return [labels.get(i, i) for i in dfr.index]
    return [i for i in dfr.index]
167849
def flatten_probas(probas, labels, ignore=None):
    
    B, C, H, W = probas.size()
    probas = probas.permute(0, 2, 3, 1).contiguous().view(-1, C)  # B * H * W, C = P, C
    labels = labels.view(-1)
    if ignore is None:
        return probas, labels
    valid = (labels != ignore)
    vprobas = probas[valid.nonzero().squeeze()]
    vlabels = labels[valid]
    return vprobas, vlabels