Normalize a Channel, set `null` to 0 and the mag to given value.

        Parameters
        ----------
        mag : float (optional)
            New value of mag. Default is 1.
771415
def normalize(self, mag=1.):
        

        def f(dataset, s, null, mag):
            dataset[s] -= null
            dataset[s] /= mag

        if self.signed:
            mag = self.mag() / mag
        else:
            mag = self.max() / mag
        self.chunkwise(f, null=self.null, mag=mag)
        self._null = 0
167201
def setValue(self, key, value, channel=1):
        
        if channel in self.CHANNELS:
            return self.CHANNELS[channel].setValue(key, value)

        LOG.error("HMDevice.setValue: channel not found %i!" % channel)
515497
private Map.Entry<Variable, ImmutableTerm> applyNullNormalization(
            Map.Entry<Variable, ImmutableTerm> substitutionEntry) {
        ImmutableTerm value = substitutionEntry.getValue();
        if (value instanceof ImmutableFunctionalTerm) {
            ImmutableTerm newValue = normalizeFunctionalTerm((ImmutableFunctionalTerm) value);
            return newValue.equals(value)
                    ? substitutionEntry
                    : new AbstractMap.SimpleEntry<>(substitutionEntry.getKey(), newValue);
        }
        return substitutionEntry;
    }
761549
private void setNormalizedMinValue(double value) {
        normalizedMinValue = Math.max(0d, Math.min(1d, Math.min(value, normalizedMaxValue)));
        invalidate();
    }
618405
def normalize_object_slot(self, value=_nothing, prop=None, obj=None):
        
        if value is not _nothing and hasattr(prop, "compare_as"):
            method, nargs = getattr(prop, "compare_as_info", (False, 1))
            args = []
            if method:
                args.append(obj)
            if nargs:
                args.append(value)
            value = prop.compare_as(*args)
        return self.normalize_slot(value, prop)
982471
def normalize_param(self, slf, args, kwargs):
        """"""
        if self.is_kwarg:
            kwargs = self.normalize_kwarg(slf.request, kwargs)
        else:
            args = self.normalize_arg(slf.request, args)
        return slf, args, kwargs
541799
def convert_float(value, parameter):
    '''
    
    '''
    value = _check_default(value, parameter, ( '', '-', None ))
    if value is None or isinstance(value, float):
        return value
    try:
        return float(value)
    except Exception as e:
        raise ValueError(str(e))
606877
def normalize_value(value):
    
    cast = str
    if six.PY2:
        cast = unicode  # noqa
    return cast(value).lower()
31777
def set(self, param, value):
        
        self._shouldOwn(param)
        try:
            value = param.typeConverter(value)
        except ValueError as e:
            raise ValueError('Invalid param value given for param "%s". %s' % (param.name, e))
        self._paramMap[param] = value
678849
def format_norm(kwargs, current=None):
    
    norm = kwargs.pop('norm', current) or 'linear'
    vmin = kwargs.pop('vmin', None)
    vmax = kwargs.pop('vmax', None)
    clim = kwargs.pop('clim', (vmin, vmax)) or (None, None)
    clip = kwargs.pop('clip', None)

    if norm == 'linear':
        norm = colors.Normalize()
    elif norm == 'log':
        norm = colors.LogNorm()
    elif not isinstance(norm, colors.Normalize):
        raise ValueError("unrecognised value for norm {!r}".format(norm))

    for attr, value in (('vmin', clim[0]), ('vmax', clim[1]), ('clip', clip)):
        if value is not None:
            setattr(norm, attr, value)

    return norm, kwargs
478510
final void normalize() {
        if (intLen == 0) {
            offset = 0;
            return;
        }

        int index = offset;
        if (value[index] != 0)
            return;

        int indexBound = index+intLen;
        do {
            index++;
        } while(index < indexBound && value[index] == 0);

        int numZeros = index - offset;
        intLen -= numZeros;
        offset = (intLen == 0 ?  0 : offset+numZeros);
    }
138937
def normalize(v):
    ''''''
    if 0 == np.linalg.norm(v):
        return v
    return v / np.linalg.norm(v)
234359
public void normalize() {
        double lenSqr = x * x + y * y + z * z;
        double err = lenSqr - 1;
        if (err > (2 * DOUBLE_PREC) || err < -(2 * DOUBLE_PREC)) {
            double len = Math.sqrt(lenSqr);
            x /= len;
            y /= len;
            z /= len;
        }
    }
567939
def mag_field(RAW_IMU, SENSOR_OFFSETS=None, ofs=None):
    ''''''
    mag_x = RAW_IMU.xmag
    mag_y = RAW_IMU.ymag
    mag_z = RAW_IMU.zmag
    if SENSOR_OFFSETS is not None and ofs is not None:
        mag_x += ofs[0] - SENSOR_OFFSETS.mag_ofs_x
        mag_y += ofs[1] - SENSOR_OFFSETS.mag_ofs_y
        mag_z += ofs[2] - SENSOR_OFFSETS.mag_ofs_z
    return sqrt(mag_x**2 + mag_y**2 + mag_z**2)
16027
def _get_philny(self, C, mag):
        
        if mag <= 4.5:
            return C["phi1"]
        elif mag >= 5.5:
            return C["phi2"]
        else:
            return C["phi2"] + (C["phi1"] - C["phi2"]) * (5.5 - mag)
1296272
def append(self, term, type=None, value=None):
        
        term = self._normalize(term)
        type = self._normalize(type)
        self.setdefault(term, (odict(), odict()))[0].push((type, True))
        self.setdefault(type, (odict(), odict()))[1].push((term, True))
        self._values[term] = value
684400
def normalize(x:TensorImage, mean:FloatTensor,std:FloatTensor)->TensorImage:
    ""
    return (x-mean[...,None,None]) / std[...,None,None]