carsonfarmer / streamhist

Streaming approximate histograms with Python.
41 stars 14 forks source link

quantiles() nondeterministic exception #9

Closed belm0 closed 4 years ago

belm0 commented 5 years ago

Unhandled exception seen in tests and real world use:

======================================================================
ERROR: streamhist.test.test_histogram.test_median_mean
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/.../python3.7/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "streamhist/streamhist/test/test_histogram.py", line 97, in test_median_mean
    assert about(h.median(), 0, 0.05)
  File "streamhist/streamhist/histogram.py", line 164, in median
    return self.quantiles(0.5)[0]
  File "streamhist/streamhist/histogram.py", line 407, in quantiles
    qq = _compute_quantile(target_sum, bin_i, bin_i1, prev_sum+1)
  File "streamhist/streamhist/histogram.py", line 462, in _compute_quantile
    u = (bin_i.value + (bin_i1.value - bin_i.value) * z)
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
carsonfarmer commented 4 years ago

Fixed with #11 (thank you!)