Return the mass weighted average location.

        Args:
            None

        Returns:
            :class:`numpy.ndarray`:
428431
def get_barycenter(self):
        
        try:
            mass = self['mass'].values
        except KeyError:
            mass = self.add_data('mass')['mass'].values
        pos = self.loc[:, ['x', 'y', 'z']].values
        return (pos * mass[:, None]).sum(axis=0) / self.get_total_mass()
507500
def mean_curve(values, weights=None):
    
    if weights is None:
        weights = [1. / len(values)] * len(values)
    if not isinstance(values, numpy.ndarray):
        values = numpy.array(values)
    return numpy.average(values, axis=0, weights=weights)
852556
def mean(self, axis=0, *args, **kwargs):
        
        nv.validate_mean(args, kwargs)
        valid_vals = self._valid_sp_values
        sp_sum = valid_vals.sum()
        ct = len(valid_vals)

        if self._null_fill_value:
            return sp_sum / ct
        else:
            nsparse = self.sp_index.ngaps
            return (sp_sum + self.fill_value * nsparse) / (ct + nsparse)
151170
def get_weight(self):
        
        if self.weight is None:
            self.weight = self.get_field('weight')
        return self.weight
525547
def weighted_std(values, weights):
    
    average = np.average(values, weights=weights)
    variance = np.average((values-average)**2, weights=weights)
    return np.sqrt(variance)
1107433
def get_average(self, field=None):
        

        if not field:
            raise AttributeError("Please provide field to apply aggregation to!")
        agg = A("avg", field=field)
        self.aggregations['avg_' + field] = agg
        return self
1138665
def _compute_ymean(self, **kwargs):
        """"""
        y = np.asarray(kwargs.get('y', self.y))
        dy = np.asarray(kwargs.get('dy', self.dy))

        if dy.size == 1:
            return np.mean(y)
        else:
            return np.average(y, weights=1 / dy ** 2)
471693
def weighted_counts(self):
        
        if not self.is_weighted:
            return self.unweighted_counts
        return _WeightedCountMeasure(self._cube_dict, self._all_dimensions)
171097
def load_average(self):
        
        with io.open(self.load_average_file, 'r') as f:
            file_columns = f.readline().strip().split()
            return float(file_columns[self._load_average_file_column])
1219800
def get(self):
        
        if self.num is None:
            if self.num_inst == 0:
                return (self.name, float('nan'))
            else:
                return (self.name, self.sum_metric / self.num_inst)
        else:
            names = ['%s'%(self.name[i]) for i in range(self.num)]
            values = [x / y if y != 0 else float('nan') \
                for x, y in zip(self.sum_metric, self.num_inst)]
            return (names, values)
727358
def averages(self):
        
        if not self.mesh._compute_at_vertices:
            return None

        return np.mean(self.vertices_per_triangle, axis=1)
751978
def get_maxweight(self, weight, concurrent_tasks, minweight=MINWEIGHT):
        
        totweight = self.get_weight(weight)
        ct = concurrent_tasks or 1
        mw = math.ceil(totweight / ct)
        return max(mw, minweight)
1318470
def _get_mass_by_index(self, index):
        
        if hasattr(index, '__iter__'):
            return sum([self.masses[i] for i in index])
        else:
            return self.masses[index]
953771
def median(self, default=None):
        
        return numpy.asscalar(numpy.median(self.values)) if self.values else default
469101
def get_samples(self, n):
        

        normalized_w = self.weights / np.sum(self.weights)
        get_rand_index = st.rv_discrete(values=(range(self.N),
                                        normalized_w)).rvs(size=n)
        samples = np.zeros(n)
        k = 0
        j = 0
        while (k < n):
            i = get_rand_index[j]
            j = j + 1
            if (j == n):
                get_rand_index = st.rv_discrete(values=(range(self.N),
                                                normalized_w)).rvs(size=n)
                j = 0
            v = np.random.normal(loc=self.points[i], scale=self.sigma[i])
            if (v > self.max_limit or v < self.min_limit):
                continue
            else:
                samples[k] = v
                k = k + 1
                if (k == n):
                    break
        return samples
1370211
def _raw_weights(self):
        
        if self._debug:
            return np.array([[],[],[],[]])

        if not self._running:
            raise ValueError('Weight sensor is not running!')
        if len(self._weight_buffers) == 0:
            time.sleep(0.3)
            if len(self._weight_buffers) == 0:
                raise ValueError('Weight sensor is not retrieving data!')
        weights = np.array(self._weight_buffers)
        return weights
517990
def _cost_method(self, *args, **kwargs):
        

        cost_val = np.sum(np.abs(self.weights * self._linear.op(args[0])))

        if 'verbose' in kwargs and kwargs['verbose']:
            print(' - L1 NORM (X):', cost_val)

        return cost_val