@check_empty
    def mom2(self):
        """
        Intensity-weighted coordinate dispersion. Pixel units.
        """
        loop = self._iter_slice_index()
        val, loc = next(loop)

        val = np.maximum(val, 0)
        w, x, x2 = val, val * loc, val * loc * loc
        for val, loc in loop:
            val = np.maximum(val, 0)
            w += val
            x += loc * val
            x2 += loc ** 2 * val

        return self._finalize(np.sqrt(x2 / w - (x / w) ** 2))
dataset/ETHPy150Open glue-viz/glue/glue/core/aggregate.py/Aggregate.mom2/original