Normalizes area.

    * **value** must be a positive :ref:`type-int-float`.
558659
def normalizeArea(value):
    
    if not isinstance(value, (int, float)):
        raise TypeError("Area must be an instance of :ref:`type-int-float`, "
                        "not %s." % type(value).__name__)
    if value < 0:
        raise ValueError("Area must be a positive :ref:`type-int-float`, "
                         "not %s." % repr(value))
    return float(value)
1335823
def normalize_to_unit_range(values):
    """"""
    if not isinstance(values, np.ndarray) or values.ndim != 1:
        raise ValueError('`values` must be a 1D NumPy array')

    if len(values) < 2:
        raise ValueError('`values` must contain at least two values')

    min_ = np.min(values)
    max_ = np.max(values)
    range_ = max_ - min_

    if range_ == 0:
        raise ValueError('range of `values` is 0 -- cannot normalize')

    return (values - min_) / range_
1165405
def _norm(self, x):
        
        return float(np.sqrt(self.inner(x, x).real))
818633
def _normalize(self):
        
        # Get length
        L = self.norm()
        if not L:
            raise ValueError('Quaternion cannot have 0-length.')
        # Correct
        self.w /= L
        self.x /= L
        self.y /= L
        self.z /= L
541057
def convert_column(self, values):
        """"""
        assert all(values >= 0), 'Cannot normalize a column with negatives'
        total = sum(values)
        if total > 0:
            return values / total
        else:
            return values
273738
private void normalize(DoubleVector v) {
        double magnitude = 0;
        for (int i = 0; i < v.length(); ++i)
            magnitude += Math.pow(v.get(i), 2);
        if (magnitude == 0)
            return;

        magnitude = Math.sqrt(magnitude);
        for (int i = 0; i < v.length(); ++i)
            v.set(i, v.get(i)/magnitude);
    }
1143019
def _norm(self, value):
        
        if isinstance(value, self.valid_types):
            self._byte_value = value * self._unit_value
            self._bit_value = self._byte_value * 8.0
        else:
            raise ValueError("Initialization value '%s' is of an invalid type: %s. "
                             "Must be one of %s" % (
                                 value,
                                 type(value),
                                 ", ".join(str(x) for x in self.valid_types)))
684400
def normalize(x:TensorImage, mean:FloatTensor,std:FloatTensor)->TensorImage:
    ""
    return (x-mean[...,None,None]) / std[...,None,None]
637292
def normalize_field(self, value):
        
        if self.default is not None:
            if value is None or value == '':
                value = self.default
        return value
1235813
def normalize(self, df=None, norm_type='zscore', axis='row', keep_orig=False):
    '''
    
    '''
    normalize_fun.run_norm(self, df, norm_type, axis, keep_orig)
1021948
def area(self, value=None):
        
        mass = vtk.vtkMassProperties()
        mass.SetGlobalWarningDisplay(0)
        mass.SetInputData(self.polydata())
        mass.Update()
        ar = mass.GetSurfaceArea()
        if value is not None:
            if not ar:
                colors.printc("~bomb Area is zero: cannot rescale.", c=1, end="")
                colors.printc(" Consider adding actor.triangle()", c=1)
                return self
            self.scale(value / ar)
            return self
        else:
            return ar
1195239
def strictly_positive_int_or_none(val):
    """"""
    val = positive_int_or_none(val)
    if val is None or val > 0:
        return val
    raise ValueError('"{}" must be strictly positive'.format(val))
896575
@SuppressWarnings("all")
  public void normalize() {
    // Start on samples
    int samplesPerFrame = (int) ((float) getSamplesPerSecond() / (float) getFramesPerSecond());
    setFrames(getFrames() + (int) (getSamples() * (1.0f / samplesPerFrame)));
    setSamples(getSamples() % samplesPerFrame);

    setSeconds(getSeconds() + (int) ((float) getFrames() / getFramesPerSecond()));
    setFrames((int) (getFrames() % getFramesPerSecond()));

    while (getSeconds() >= 60) {
      setSeconds(getSeconds() - 60);
      setMinutes(getMinutes() + 1);
    }
    while (getMinutes() >= 60) {
      setMinutes(getMinutes() - 60);
      setHours(getHours() + 1);
    }
  }
467798
def _normalizeRect(self, x, y, width, height):
        
        x, y = self._normalizePoint(x, y) # inherit _normalizePoint logic

        assert width is None or isinstance(width, _INTTYPES), 'width must be an integer or None, got %s' % repr(width)
        assert height is None or isinstance(height, _INTTYPES), 'height must be an integer or None, got %s' % repr(height)

        # if width or height are None then extend them to the edge
        if width is None:
            width = self.width - x
        elif width < 0: # handle negative numbers
            width += self.width
            width = max(0, width) # a 'too big' negative is clamped zero
        if height is None:
            height = self.height - y
            height = max(0, height)
        elif height < 0:
            height += self.height

        # reduce rect size to bounds
        width = min(width, self.width - x)
        height = min(height, self.height - y)

        return x, y, width, height
1356629
def normalize(X):
        
        a = X.min(axis=0)
        b = X.max(axis=0)
        return (X - a[np.newaxis, :]) / ((b - a)[np.newaxis, :])
662045
public static void normalizeF( DMatrixRMaj A ) {
        double val = normF(A);

        if( val == 0 )
            return;

        int size = A.getNumElements();

        for( int i = 0; i < size; i++) {
            A.div(i , val);
        }
    }
235013
def normalize(value, default=None, type=None, raise_exception=False):
    
    NUMBER_RE = re.compile('^[-+]?(([0-9]+\.?[0-9]*)|([0-9]*\.?[0-9]+))$')
    if type is None and default is None:
        type = unicode_type
    elif type is None:
        type = type_(default)
    if type in str_types:
        if value is not None:
            if isinstance(value, unicode_type):
                return value
            elif py3 and isinstance(value, bytes_type):
                return value.decode('utf-8')
            return unicode_type(value)
        if default is None:
            if raise_exception:
                raise ValidationError('invalid string')
            else:
                return unicode_type()
    elif type in (bool, 'bool', 'boolean'):
        if value is not None:
            value = value.lower().strip()
            if value in ('1', 'true', 'yes', 'on'):
                return True
            elif value in ('0', 'false', 'no', 'off'):
                return False
        if default is None:
            if raise_exception:
                raise ValidationError('invalid boolean')
            else:
                return False
    elif type in (numbers.Number, 'number'):
        if value is not None:
            if value.isdigit():
                return int(value)
            elif NUMBER_RE.match(value):
                return eval(value)
        if default is None:
            if raise_exception:
                raise ValidationError('invalid number')
            else:
                return 0
    elif type in (int, 'int', 'integer'):
        try:
            return int(value)
        except Exception:
            if isinstance(value, basestring_type) and NUMBER_RE.match(value):
                return int(eval(value))
            if default is None:
                if raise_exception:
                    raise ValidationError('invalid number')
                else:
                    return 0
    elif type in (float, 'float'):
        if value is not None and NUMBER_RE.match(value):
            return float(value)
        if default is None:
            if raise_exception:
                raise ValidationError('invalid number')
            else:
                return 0.0
    return default