Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where violins fail to render with old numpy. #349

Merged
merged 1 commit into from
Jan 12, 2021
Merged

Fix bug where violins fail to render with old numpy. #349

merged 1 commit into from
Jan 12, 2021

Conversation

JS3xton
Copy link
Contributor

@JS3xton JS3xton commented Jan 12, 2021

Violin plots calculate default logicle scale bin edges using an inverse _LogicleTransform(), which itself uses np.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 causes np.interp() to simply return the default left or right 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, and python -m FlowCal.excel_ui -v -p -i experiment.xlsx run correctly in Python 3.8 + Anaconda 2020.07 and Python 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 in Python 3.8 + Anaconda 2020.07 both before and after this fix.)

Violin plots calculate default logicle scale bin edges using
an inverse _LogicleTransform(), which itself uses np.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 causes np.interp() to
simply return the default `left` or `right` value (e.g., max or
min of the scale).
@JS3xton JS3xton merged commit 7244512 into taborlab:develop Jan 12, 2021
@JS3xton JS3xton deleted the fix-violin-logicle-bin-edge-boundary branch January 12, 2021 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant