Fix crashes on modern NumPy/Matplotlib and low logging-rate logs#58
Open
deliphop wants to merge 1 commit into
Open
Fix crashes on modern NumPy/Matplotlib and low logging-rate logs#58deliphop wants to merge 1 commit into
deliphop wants to merge 1 commit into
Conversation
The project pins numpy 1.11/scipy 1.0/matplotlib 2.0 (2017-2018 era) but those versions have no wheels for current Python, so this fixes compatibility with recent releases instead: - np.histogram/histogram2d: normed= was removed, use density= - hist2d(): bin count must be an int, not a float from Python 3 division - pcolormesh(): explicit shading= is now required; one call mixed bin edges with sample centers across axes, which newer Matplotlib rejects outright (fixed by aligning the smaller axis to centers) - plt.cm.get_cmap() was removed, use plt.colormaps[...] - get_shared_x_axes().join(...) was removed, use ax.sharex(...) Also fixes two crashes specific to logs recorded at a low effective rate (e.g. FCs logging to internal flash with blackbox_rate 1/4, rather than a full-rate SD card log): - winstacker(): the window count formula can overrun the data array by a few samples on the last window when flen isn't a clean multiple of shift*superpos, producing a ragged array and crashing np.array(). Now clamps the window count to what actually fits. - plot_all_noise(): sparse analysis windows can leave NaN in the noise spectra, which crashes the LogNorm colorbar. NaNs are now sanitized to 0 before computing color limits, which correctly falls through to the existing "no data" default range.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The project pins numpy 1.11/scipy 1.0/matplotlib 2.0 (2017-2018 era), which have no wheels for current Python, so this fixes compatibility with recent releases instead:
np.histogram/histogram2d:normed=was removed, usedensity=hist2d(): bin count must be an int, not a float from Python 3 divisionpcolormesh(): explicitshading=is now required; one call mixed bin edges with sample centers across axes, which newer Matplotlib rejects outright (fixed by aligning the smaller axis to centers)plt.cm.get_cmap()was removed, useplt.colormaps[...]get_shared_x_axes().join(...)was removed, useax.sharex(...)Also fixes two crashes specific to logs recorded at a low effective rate (e.g. FCs logging to internal flash with
blackbox_rate 1/4, rather than a full-rate SD card log):winstacker(): the window count formula can overrun the data array by a few samples on the last window whenflenisn't a clean multiple ofshift*superpos, producing a ragged array and crashingnp.array(). Now clamps the window count to what actually fits.plot_all_noise(): sparse analysis windows can leave NaN in the noise spectra, which crashes the LogNorm colorbar. NaNs are now sanitized to 0 before computing color limits, which correctly falls through to the existing "no data" default range.Test plan
good_tune.BBL/stock_tune.BFLexample logs — PID response and noise plots generate correctlyblackbox_rate 1/4on internal flash (126 Hz effective rate, 75% frame decimation) — previously crashed on both fixed issues, now completes and produces sane plots