in some weird cases (e.g. my battery changed, actually), the polyfit
function will freak out and give a ValueError exception:
Traceback (most recent call last):
File "./src/battery-stats-graph", line 199, in <module>
death = guess_expiry(data[full], data['timestamp'], zero)
File "./src/battery-stats-graph", line 170, in guess_expiry
fit = np.polyfit(data[full], data['timestamp'], 1)
File "/usr/lib/python2.7/dist-packages/numpy/lib/polynomial.py", line 581, in polyfit
c, resids, rank, s = lstsq(lhs, rhs, rcond)
File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 1867, in lstsq
0, work, lwork, iwork, 0)
ValueError: On entry to DLASCL parameter number 4 had an illegal value
we shouldn't completely crash in those cases: if we fail to find a fit
or the data is too much garbage, just output a warning and attempt to
generate the graph anyways
in some weird cases (e.g. my battery changed, actually), the polyfit function will freak out and give a ValueError exception:
we shouldn't completely crash in those cases: if we fail to find a fit or the data is too much garbage, just output a warning and attempt to generate the graph anyways