Normalize the values of the counts for a 2D histogram.

        This normalizes the values of a numpy array to the range 0-255.

        :param counts: a NumPy array which is to be rescaled.
        :param type: either 'bw' or 'reverse_bw'.
429298
def _normalize_histogram2d(self, counts, type):
        
        counts = (255 * (counts - np.nanmin(counts)) /
                  (np.nanmax(counts) - np.nanmin(counts)))

        if type == 'reverse_bw':
            counts = 255 - counts

        return counts.astype(np.uint8)
1085155
def log_normalize(data):
    
    if sp.issparse(data):
        data = data.copy()
        data.data = np.log2(data.data + 1)
        return data

    return np.log2(data.astype(np.float64) + 1)
895731
def normalize_to_range(
    values,
    minimum = 0.0,
    maximum = 1.0
    ):

    

    normalized_values = []
    minimum_value = min(values)
    maximum_value = max(values)
    for value in values:
        numerator = value - minimum_value
        denominator = maximum_value - minimum_value
        value_normalized = (maximum - minimum) * numerator/denominator + minimum
        normalized_values.append(value_normalized)
    return normalized_values
858902
def normalize(data):
    
    out_data = data.copy()

    for i, sample in enumerate(out_data):
        out_data[i] /= sum(out_data[i])

    return out_data
811507
public static float[] normalize (int[] values)
    {
        // Allocate storage for the normalized array
        float[] normalized = new float[values.length];

        // Determine the minimum and maximum
        int min = getMinValue(values);
        int max = getMaxValue(values);
        int spread = max - min;

        // If there is no spread, return a flat normalization
        if (spread == 0) {
            Arrays.fill(normalized, 1f);
            return normalized;
        }

        // Normalize each value in the input array
        for (int i = 0; i < values.length; i++) {
            normalized[i] = (values[i] - min) / (float) spread;
        }
        return normalized;
    }
118979
def expanded_counts_map(self):
        
        if self.hpx._ipix is None:
            return self.counts

        output = np.zeros(
            (self.counts.shape[0], self.hpx._maxpix), self.counts.dtype)
        for i in range(self.counts.shape[0]):
            output[i][self.hpx._ipix] = self.counts[i]
        return output
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)
802836
private void normalizeL2(double[] scores) {
		double square_sum = 0.0;
		for (int i = 0; i < scores.length; i++) {
			square_sum += (scores[i] * scores[i]);
		}
		double norm = Math.sqrt(square_sum);
		if (norm != 0)
			for (int i = 0; i < scores.length; i++) {
				scores[i] = scores[i] / norm;
			}
	}
272158
def normalise(v):
    

    vn = np.sqrt(np.sum(v**2, 0))
    vn[vn == 0] = 1.0
    return np.asarray(v / vn, dtype=v.dtype)
1241014
def normalize_bins(self, inplace: bool = False) -> "HistogramCollection":
        
        col = self if inplace else self.copy()
        sums = self.sum().frequencies
        for h in col.histograms:
            h.set_dtype(float)
            h._frequencies /= sums
            h._errors2 /= sums ** 2  # TODO: Does this make sense?
        return col
1056182
def score_counts(counts)
      if counts.count > 0
        _num = counts.map { |x| x.obp }
        _num.percentile(90)
      else
        0.01
      end
    end
677131
def count(self, axis='major'):
        
        i = self._get_axis_number(axis)

        values = self.values
        mask = np.isfinite(values)
        result = mask.sum(axis=i, dtype='int64')

        return self._wrap_result(result, axis)
136610
def init_counts(self, counts_len):
        '''
        '''
        assert self._data and counts_len and self.counts_len == 0
        self.counts_len = counts_len
        self._init_counts()

        results = decode(self._data, payload_header_size, addressof(self.counts),
                         counts_len, self.word_size)
        # no longer needed
        self._data = None
        return results
926545
def normalize(self, axis):
        """"""
        axis = self.get_axis_number(axis)
        sum_along_axis = np.sum(self.histogram, axis=axis)
        # Don't do anything for subspaces without any entries -- this avoids nans everywhere
        sum_along_axis[sum_along_axis == 0] = 1
        hist = self.histogram / sum_along_axis[self._simsalabim_slice(axis)]
        return Histdd.from_histogram(hist,
                                     bin_edges=self.bin_edges,
                                     axis_names=self.axis_names)
234912
public static void normalize(double[] doubles) {

    double sum = 0;
    for (int i = 0; i < doubles.length; i++) {
      sum += doubles[i];
    }
    normalize(doubles, sum);
  }
11411
def ranges(self):
        """"""
        bucket_fns = {
            'boolean': linear_buckets,
            'flag': linear_buckets,
            'count': linear_buckets,
            'enumerated': linear_buckets,
            'categorical': linear_buckets,
            'linear': linear_buckets,
            'exponential': exponential_buckets,
        }

        if self._kind not in bucket_fns:
            raise ParserError('Unknown kind "%s" for histogram "%s".' % (self._kind, self._name))

        fn = bucket_fns[self._kind]
        return fn(self.low(), self.high(), self.n_buckets())
1118919
def normalize(self):
    
    max_abs = max(self.table, key=abs)
    if max_abs == 0:
      raise ValueError("Can't normalize zeros")
    return self / max_abs