Get a ConvBPDNMask class from a label string.
323613
def cbpdnmsk_class_label_lookup(label):
    """"""

    clsmod = {'admm': admm_cbpdn.ConvBPDNMaskDcpl,
              'fista': fista_cbpdn.ConvBPDNMask}
    if label in clsmod:
        return clsmod[label]
    else:
        raise ValueError('Unknown ConvBPDNMask solver method %s' % label)
287530
public static String getLabel(Class<?> clazz, String label) {
		Language language=getThreadLocalLanguage(null);
		
		if (language==null){
			return label;
		} else {
			return getLabel(language, clazz.getName(), label);
		}
	}
1191376
def _get_regex_pattern(label):
    
    parts = _split_by_punctuation.split(label)

    for index, part in enumerate(parts):
        if index % 2 == 0:
            # Word
            if not parts[index].isdigit() and len(parts[index]) > 1:
                parts[index] = _convert_word(parts[index])
        else:
            # Punctuation
            if not parts[index + 1]:
                # The separator is not followed by another word. Treat
                # it as a symbol.
                parts[index] = _convert_punctuation(
                    parts[index],
                    current_app.config["CLASSIFIER_SYMBOLS"]
                )
            else:
                parts[index] = _convert_punctuation(
                    parts[index],
                    current_app.config["CLASSIFIER_SEPARATORS"]
                )

    return "".join(parts)
93425
def resolve(self, lineno):
        
        if not self.defined:
            error(lineno, "Undeclared label '%s'" % self.name)

        if isinstance(self.value, Expr):
            return self.value.eval()

        return self.value
295612
def get_variant_label(v_conf):
    
    if v_conf['MAX_SIZE'][0] is None:
        return 'h{}'.format(v_conf['MAX_SIZE'][1])
    if v_conf['MAX_SIZE'][1] is None:
        return 'w{}'.format(v_conf['MAX_SIZE'][0])
    return '{}x{}'.format(*v_conf['MAX_SIZE'])
845007
def netmask(mask):
    '''
    
    '''
    if not isinstance(mask, string_types):
        return False

    octets = mask.split('.')
    if not len(octets) == 4:
        return False

    return ipv4_addr(mask) and octets == sorted(octets, reverse=True)
800525
def get_label_map(opts):
    '''  '''
    results = {}
    try:
        for entry in os.scandir(diskdir):
            target = normpath(join(diskdir, os.readlink(entry.path)))
            decoded_name = entry.name.encode('utf8').decode('unicode_escape')
            results[target] = decoded_name
        if opts.debug:
            print('\n\nlabel_map:', results)
    except FileNotFoundError:
        pass
    return results
519696
def get_region_mask(z, delta, xy=None):
    """"""

    if xy is None:
        ix, iy = np.unravel_index(np.argmax(z), z.shape)
    else:
        ix, iy = xy

    mz = (z > z[ix, iy] - delta)
    labels = label(mz)[0]
    mz &= labels == labels[ix, iy]
    return mz
808997
def get_filename_filled_with_checked_labels(self, labels=None):
        
        if labels is None:
            labels = self.slab_wg.action_check_slab_ui()
        string_labels = imma.get_nlabels(slab=self.slab_wg.slab, labels=labels, return_mode="str")
        filename = self.vtk_file.format(
            "-".join(string_labels))
        return filename
1335063
def _encode_label(label):
    """"""
    if isinstance(label, tuple):
        return [_encode_label(v) for v in label]
    return label
387196
def iMath_propagate_labels_through_mask(image, labels, stopping_value=100, propagation_method=0):
    
    return iMath(image, 'PropagateLabelsThroughMask', labels, stopping_value, propagation_method)
497253
def CRPS(label, pred):
    
    for i in range(pred.shape[0]):
        for j in range(pred.shape[1] - 1):
            if pred[i, j] > pred[i, j + 1]:
                pred[i, j + 1] = pred[i, j]
    return np.sum(np.square(label - pred)) / label.size
90994
def get_symbol(num_classes=1000, **kwargs):
    
    data = mx.symbol.Variable(name="data")
    label = mx.symbol.Variable(name="label")

    # group 1
    conv1_1 = mx.symbol.Convolution(
        data=data, kernel=(3, 3), pad=(1, 1), num_filter=64, name="conv1_1")
    relu1_1 = mx.symbol.Activation(data=conv1_1, act_type="relu", name="relu1_1")
    conv1_2 = mx.symbol.Convolution(
        data=relu1_1, kernel=(3, 3), pad=(1, 1), num_filter=64, name="conv1_2")
    relu1_2 = mx.symbol.Activation(data=conv1_2, act_type="relu", name="relu1_2")
    pool1 = mx.symbol.Pooling(
        data=relu1_2, pool_type="max", kernel=(2, 2), stride=(2, 2), name="pool1")
    # group 2
    conv2_1 = mx.symbol.Convolution(
        data=pool1, kernel=(3, 3), pad=(1, 1), num_filter=128, name="conv2_1")
    relu2_1 = mx.symbol.Activation(data=conv2_1, act_type="relu", name="relu2_1")
    conv2_2 = mx.symbol.Convolution(
        data=relu2_1, kernel=(3, 3), pad=(1, 1), num_filter=128, name="conv2_2")
    relu2_2 = mx.symbol.Activation(data=conv2_2, act_type="relu", name="relu2_2")
    pool2 = mx.symbol.Pooling(
        data=relu2_2, pool_type="max", kernel=(2, 2), stride=(2, 2), name="pool2")
    # group 3
    conv3_1 = mx.symbol.Convolution(
        data=pool2, kernel=(3, 3), pad=(1, 1), num_filter=256, name="conv3_1")
    relu3_1 = mx.symbol.Activation(data=conv3_1, act_type="relu", name="relu3_1")
    conv3_2 = mx.symbol.Convolution(
        data=relu3_1, kernel=(3, 3), pad=(1, 1), num_filter=256, name="conv3_2")
    relu3_2 = mx.symbol.Activation(data=conv3_2, act_type="relu", name="relu3_2")
    conv3_3 = mx.symbol.Convolution(
        data=relu3_2, kernel=(3, 3), pad=(1, 1), num_filter=256, name="conv3_3")
    relu3_3 = mx.symbol.Activation(data=conv3_3, act_type="relu", name="relu3_3")
    pool3 = mx.symbol.Pooling(
        data=relu3_3, pool_type="max", kernel=(2, 2), stride=(2, 2), \
        pooling_convention="full", name="pool3")
    # group 4
    conv4_1 = mx.symbol.Convolution(
        data=pool3, kernel=(3, 3), pad=(1, 1), num_filter=512, name="conv4_1")
    relu4_1 = mx.symbol.Activation(data=conv4_1, act_type="relu", name="relu4_1")
    conv4_2 = mx.symbol.Convolution(
        data=relu4_1, kernel=(3, 3), pad=(1, 1), num_filter=512, name="conv4_2")
    relu4_2 = mx.symbol.Activation(data=conv4_2, act_type="relu", name="relu4_2")
    conv4_3 = mx.symbol.Convolution(
        data=relu4_2, kernel=(3, 3), pad=(1, 1), num_filter=512, name="conv4_3")
    relu4_3 = mx.symbol.Activation(data=conv4_3, act_type="relu", name="relu4_3")
    pool4 = mx.symbol.Pooling(
        data=relu4_3, pool_type="max", kernel=(2, 2), stride=(2, 2), name="pool4")
    # group 5
    conv5_1 = mx.symbol.Convolution(
        data=pool4, kernel=(3, 3), pad=(1, 1), num_filter=512, name="conv5_1")
    relu5_1 = mx.symbol.Activation(data=conv5_1, act_type="relu", name="relu5_1")
    conv5_2 = mx.symbol.Convolution(
        data=relu5_1, kernel=(3, 3), pad=(1, 1), num_filter=512, name="conv5_2")
    relu5_2 = mx.symbol.Activation(data=conv5_2, act_type="relu", name="relu5_2")
    conv5_3 = mx.symbol.Convolution(
        data=relu5_2, kernel=(3, 3), pad=(1, 1), num_filter=512, name="conv5_3")
    relu5_3 = mx.symbol.Activation(data=conv5_3, act_type="relu", name="relu5_3")
    pool5 = mx.symbol.Pooling(
        data=relu5_3, pool_type="max", kernel=(3, 3), stride=(1, 1),
        pad=(1,1), name="pool5")
    # group 6
    conv6 = mx.symbol.Convolution(
        data=pool5, kernel=(3, 3), pad=(6, 6), dilate=(6, 6),
        num_filter=1024, name="fc6")
    relu6 = mx.symbol.Activation(data=conv6, act_type="relu", name="relu6")
    # drop6 = mx.symbol.Dropout(data=relu6, p=0.5, name="drop6")
    # group 7
    conv7 = mx.symbol.Convolution(
        data=relu6, kernel=(1, 1), pad=(0, 0), num_filter=1024, name="fc7")
    relu7 = mx.symbol.Activation(data=conv7, act_type="relu", name="relu7")
    # drop7 = mx.symbol.Dropout(data=relu7, p=0.5, name="drop7")

    gpool = mx.symbol.Pooling(data=relu7, pool_type='avg', kernel=(7, 7),
        global_pool=True, name='global_pool')
    conv8 = mx.symbol.Convolution(data=gpool, num_filter=num_classes, kernel=(1, 1),
        name='fc8')
    flat = mx.symbol.Flatten(data=conv8)
    softmax = mx.symbol.SoftmaxOutput(data=flat, name='softmax')
    return softmax
108981
def get_label_mapping(train_labels):
    
    sorted_labels = np.sort(np.unique(train_labels))
    label_mapping = {}
    for i, label in enumerate(sorted_labels):
        label_mapping[label] = i
    logging.info('Label mapping:%s', format(label_mapping))
    return label_mapping
1328290
private String[] getMarkType(String label) {
		String[] types = new String[2];

		if(NoSegLabel){
			types[0] = "";
			types[1] = label;
			return types;
		}

		int idx = label.indexOf('-');
		if(idx!=-1){
			types[0] = label.substring(0,idx);
			types[1] = label.substring(idx+1);
		}else{
			types[0] = label;
			types[1] = "";
		}

		return types;
	}
8584
def _unused_label(self, label):
        """"""
        original = label
        existing = self.labels
        i = 2
        while label in existing:
            label = '{}_{}'.format(original, i)
            i += 1
        return label
930705
def get_mask(cls, azim):
        

        if cls.mask is None:
            raise ValueError("No mask defined for the station {}".format(cls.name))

        azim %= 2 * np.pi

        if azim in cls.mask[0, :]:
            return cls.mask[1, np.where(azim == cls.mask[0, :])[0][0]]

        for next_i, mask_azim in enumerate(cls.mask[0, :]):
            if mask_azim > azim:
                break
        else:
            next_i = 0

        x0, y0 = cls.mask[:, next_i - 1]
        x1, y1 = cls.mask[:, next_i]

        if next_i - 1 == -1:
            x0 = 0

        return y0 + (y1 - y0) * (azim - x0) / (x1 - x0)