Fix bug where violins fail to render with old numpy. #349
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.
Violin plots calculate default logicle scale bin edges using an inverse
_LogicleTransform()
, which itself usesnp.interp()
. Before numpy v1.15.0,np.interp()
behaves differently with empty masked array inputs, which the inverse_LogicleTransform()
may provide by default if transform values are outside its range. This fix deactivates the masking of values outside the transform range in the violin plot functions, which causesnp.interp()
to simply return the defaultleft
orright
value (e.g., max or min of the scale).All unit tests pass and
examples/analyze_no_mef.py
,examples/analyze_mef.py
,examples/analyze_excel_ui.py
, andpython -m FlowCal.excel_ui -v -p -i experiment.xlsx
run correctly inPython 3.8 + Anaconda 2020.07
andPython 2.7 + Anaconda 5.2.0
. The empty list test scripts from #348 also run correctly in both environments.Before this fix, some plots from the plot violin stress test scripts (listed in #335) failed to render in
Python 2.7 + Anaconda 5.2.0
. After this fix, all plots render as expected. (All plots rendered correctly inPython 3.8 + Anaconda 2020.07
both before and after this fix.)