Repository navigation
Fix empty cross sections, anti-aliasing kernel TypeError and About AttributeError - #90
Merged
Merged
Conversation
When an image was added to the plot, or shown again after having been hidden, while a cross-section marker or shape was active, its X/Y cross-section curves stayed empty until the marker was moved: items_changed created the curves after updating the plot, and never computed them. - Create the curves of added or shown again images before updating the plot, then compute these new curves only (unless the auto-refresh mode is disabled), so that the other curves are not computed again - Compute the shade of the curves from the number of visible images, instead of all images (hidden ones included) - Flush the closing of the previous test windows in the tests, which would otherwise hide the cross-section panels Refs #89 Assisted-by: Claude Opus 5.5
The scaling functions require the anti-aliasing kernel to have the data type of the data they scale, which was not the case: - when exporting an image area without the LUT but with the interpolation while the Z-axis log scale was enabled: the raw data was exported with the float64 kernel of its logarithm; - after set_data with data of another type: the kernel kept the former type, so that drawing the image failed (aborting the application with PyQt5), as well as exporting it. Add BaseImageItem._get_interpolation_for, which gives the kernel the data type of the data to be scaled, used by all export_roi implementations, and _sync_interpolation_dtype, which keeps the kernel in the data type of the data drawn, now also called by set_data. Refs #89 Assisted-by: Claude Opus 5.5
plotpy.widgets.about.get_python_libs_info and the plotpy-benchmarks header called guidata.widgets.about.get_python_libs_info, which does not exist (renamed by mistake with the "infos" to "info" renaming of PlotPy's own functions), and raised AttributeError. The benchmark header now uses PlotPy's get_python_libs_info, which also gives the version of PlotPy. Refs #89 Assisted-by: Claude Opus 5.5
…t fixes Refs #89 Assisted-by: Claude Opus 5.5
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
Fixes #89: three independent bugs found while reviewing PlotPy before the 2.12.0 release.
1. Cross sections of images added or shown again
Root cause
BaseCrossSectionPlot.items_changedcreated the cross-section curves of new images afterupdate_plot(refresh=False), and never computed them. With a marker or shape already active, the curves of an image added to the plot stayed empty, and since commit9a221b7(unreleased, curves kept for visible images only) so did the curves of an image shown again (they previously showed the cross section at a former marker position). The shade of the curves was also divided by the number of all images, hidden ones included.Changes
9a221b7is kept), unless the auto-refresh mode is disabled.2. Anti-aliasing kernel data type
Root cause
The C++ scaling functions require the anti-aliasing kernel to have the data type of the data they scale (
TypeError: AA Mask data type must be ...):export_roi(apply_lut=False, apply_interpolation=True)with the Z-axis log scale exported the raw data (e.g.uint16) with thefloat64kernel of its logarithm (already the case in 2.11.1), e.g. with the rectangle snapshot tool;set_datawith data of another type, the kernel kept the former type: drawing the image then failed, which aborts the application with PyQt5 (0xC0000409on Windows), as well as exporting it.Changes
BaseImageItem._get_interpolation_for(data): returns the interpolation with a kernel of the data type ofdata, used by the 4export_roiimplementations (BaseImageItem,ImageItem,XYImageItem,TrImageItem; masked items inherit them).BaseImageItem._sync_interpolation_dtype(): keeps the kernel in the data type of the data drawn; it replaces the inline code ofset_zaxis_log_stateand is now also called byset_data.3.
AttributeErroringet_python_libs_infoRoot cause
The "infos" → "info" renaming of commit
6fc54bd(PlotPy 2.8.0) also renamed the call to guidata'sget_python_libs_infos, which does not exist asget_python_libs_info.Changes
plotpy.widgets.about.get_python_libs_infocallsguidata.widgets.about.get_python_libs_infos.plotpy-benchmarksheader uses PlotPy'sget_python_libs_info(which also gives the PlotPy version).Release notes
Three entries in the 2.12.0 bug fixes.
Tests
test_cross_section_visible_items.py: cross sections of an image shown again (after the marker was moved while it was hidden) and of an added image, and shade ignoring hidden images. A fourth test checks that, with the auto-refresh mode disabled, the curve is only computed on the next refresh (behavior kept).test_image_aa_kernel.py: export with the AA interpolation for 5 image kinds × 4 data types × log scale on/off × LUT on/off, and draw + export afterset_datawith another data type.test_about.py:get_python_libs_info,aboutand the benchmark header.qt_app_contextschedules the closing of all top-level widgets, which otherwise closed the next test's window and hid its cross-section panels.E1101.developwith this branch: image tools and profile tests pass (10 passed).