def vector_sum(self, d):
    '\n        Return the vector sum of the distribution as a tuple (magnitude, avgbinnum).\n\n        Each bin contributes a vector of length equal to its value, at\n        a direction corresponding to the bin number.  Specifically,\n        the total bin number range is mapped into a direction range\n        [0,2pi].\n\n        For a cyclic distribution, the avgbinnum will be a continuous\n        measure analogous to the max_value_bin() of the distribution.\n        But this quantity has more precision than max_value_bin()\n        because it is computed from the entire distribution instead of\n        just the peak bin.  However, it is likely to be useful only\n        for uniform or very dense sampling; with sparse, non-uniform\n        sampling the estimates will be biased significantly by the\n        particular samples chosen.\n\n        The avgbinnum is not meaningful when the magnitude is 0,\n        because a zero-length vector has no direction.  To find out\n        whether such cases occurred, you can compare the value of\n        undefined_vals before and after a series of calls to this\n        function.\n        \n        This is a slow algorithm and should only be used if the\n        contents of the distribution have been changed by the statistical \n        function.\n        If not, then the cached value in the distribution should be used.\n\n        '
    h = d.data()
    theta = calc_theta(np.array(list(h.keys())), d.axis_range)
    return d._fast_vector_sum(list(h.values()), theta)
Return the vector sum of the distribution as a tuple (magnitude, avgbinnum).

Each bin contributes a vector of length equal to its value, at
a direction corresponding to the bin number.  Specifically,
the total bin number range is mapped into a direction range
[0,2pi].

For a cyclic distribution, the avgbinnum will be a continuous
measure analogous to the max_value_bin() of the distribution.
But this quantity has more precision than max_value_bin()
because it is computed from the entire distribution instead of
just the peak bin.  However, it is likely to be useful only
for uniform or very dense sampling; with sparse, non-uniform
sampling the estimates will be biased significantly by the
particular samples chosen.

The avgbinnum is not meaningful when the magnitude is 0,
because a zero-length vector has no direction.  To find out
whether such cases occurred, you can compare the value of
undefined_vals before and after a series of calls to this
function.

This is a slow algorithm and should only be used if the
contents of the distribution have been changed by the statistical 
function.
If not, then the cached value in the distribution should be used.
def vector_sum(self, d):
    '\n        Return the vector sum of the distribution as a tuple (magnitude, avgbinnum).\n\n        Each bin contributes a vector of length equal to its value, at\n        a direction corresponding to the bin number.  Specifically,\n        the total bin number range is mapped into a direction range\n        [0,2pi].\n\n        For a cyclic distribution, the avgbinnum will be a continuous\n        measure analogous to the max_value_bin() of the distribution.\n        But this quantity has more precision than max_value_bin()\n        because it is computed from the entire distribution instead of\n        just the peak bin.  However, it is likely to be useful only\n        for uniform or very dense sampling; with sparse, non-uniform\n        sampling the estimates will be biased significantly by the\n        particular samples chosen.\n\n        The avgbinnum is not meaningful when the magnitude is 0,\n        because a zero-length vector has no direction.  To find out\n        whether such cases occurred, you can compare the value of\n        undefined_vals before and after a series of calls to this\n        function.\n        \n        This is a slow algorithm and should only be used if the\n        contents of the distribution have been changed by the statistical \n        function.\n        If not, then the cached value in the distribution should be used.\n\n        '
    h = d.data()
    theta = calc_theta(np.array(list(h.keys())), d.axis_range)
    return d._fast_vector_sum(list(h.values()), theta)