ShowPDF widget: interactive tool for PDF analysis#1
Draft
ehrhardtkm wants to merge 5 commits into
Draft
Conversation
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.
What problem this PR addresses
ShowPDFis an interactive widget for the PDF pipeline. PDF analysis has several parameters (masking, k-range, window, damping), where finding optimal values for each depends on seeing the resulting G(r) curve and taking round trips through notebook cells to retune each one is slow. ShowPDF wrapsPairDistributionFunctionfromquantem.diffractionand lets the user explore those parameters with live feedback.Layout:
I(k) + B(k)(radial mean with fitted background), windowedF(k), andG(r), plus the parameter controls.Changing either the selected scan region in the left panel or the parameter controls in the right panel trigger fast recomputation.
This PR is intended to build off of a separate PR, which will add elliptical/pixel calibration methods. The base is set to this calibration branch for now so that the diff only shows the widget files. Technically, the widget functions don't directly interact with the calibration files at all, so it can be tested and reviewed without issue.
New files in this PR:
widget/src/quantem/widget/showpdf.py— the Python widget class (state, traits, recompute orchestration).widget/js/showpdf/index.tsx— the React frontend, built into a single ES module via the existingwidget/scripts/build.mjspipeline.widget/src/quantem/widget/detector.py— small helpers for BF disk detection and BF/ADF/HAADF virtual image computation on the nav panel; the algorithm matchesShow4DSTEM.auto_detect_center.widget/src/quantem/widget/__init__.pyandwidget/scripts/build.mjs— two-line exports / build registration.ShowPDF follows the same patterns already used by
Show2DandShow4DSTEMin this package: shared imports fromfigure,colormaps,stats,format; no separate CSS file; no tool-parity registry. Avoids adding new infrastructure.To use:
For local dev:
In notebook:
Example notebook:
What should the reviewer(s) do
This is a draft until the calibration PR merges and I update the base. Reviewing now is welcome, though, since the widget code itself is independent of other ongoing work.
ShowPDF, an interactiveanywidget-based widget for the PDF pipeline. The motivation is that PDF analysis has several parameters (masking, k-range, window, damping) where the right choice depends on seeing the resulting G(r) curve — round-tripping through notebook cells to retune each one is slow. ShowPDF wrapsPairDistributionFunctionfromquantem.diffractionand lets the user explore those parameters with live feedback.