Manual reduction UI#981
Merged
Merged
Conversation
Convert the manual_reduction UI to the Model-View-Presenter structure used by peak_fitting and the other PyRS UIs, dissolving the EventHandler glue class. - manual_reduction_model.py: ManualReductionModel(QObject) composes the existing ReductionController (kept in pyrs_api.py, still used directly by integration tests) and adds the failureMsg signal. - manual_reduction_crtl.py: ManualReductionCrtl presenter; plotting methods take the target plot widget as a parameter (mirrors peak_fitting) and raise RuntimeError for the view to surface. - manual_reduction_viewer.py: ManualReductionViewer(QMainWindow) keeps manualreductionwindow.ui, the widget promotions and all signal wiring; absorbs the browse dialogs, default-file widget-state toggles, run-number handling and reduce orchestration that were in EventHandler. - manualreductionwindow.py: thin backward-compat shim (ManualReductionWindow builds the triple) so the existing UI test still constructs it as before. - start.py: standalone launcher; pyrs_main builds the MVP triple. - Delete event_handler.py (fully dissolved). pyrs_api.py is unchanged. Tests: tests/ui/test_manual_reduction.py (exact plot label + data limits), test_pyrslauncher.py and integration/test_manual_reduction_ui.py all pass; ruff check + format clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Allow the manual-reduction run-number box to accept a run-number specification with inclusive dash ranges and/or comma-separated runs (e.g. "938-940,945") to reduce several NeXus files in one action, and add a "Run" dropdown to select which reduced run to view. - manual_reduction_model.py: add parse_run_numbers() (inclusive dash ranges + comma lists) and is_run_specification() (distinguish a run spec from a file path); track reduced workspaces by label and add reduce_runs()/set_current_run(). - pyrs_api.py: add ReductionController.set_current_workspace() so the model can switch the active workspace between reduced runs. - manual_reduction_crtl.py: reduce() now takes a list of (label, nexus_file) jobs and returns the reduced labels; add select_run(label) -> sub_runs. - manual_reduction_viewer.py: build jobs from the input box (run spec -> one job per run via get_nexus_file; otherwise a single NeXus path, preserving existing behavior), populate the new comboBox_runs, and switch the sub-run combo + plots when the selected run changes. - manualreductionwindow.ui: add the "Run" label + comboBox_runs next to Sub-Runs. A single NeXus file path still reduces exactly one file (existing UI tests pass). Run-number batch uses get_nexus_file (analysis-cluster lookup), so it is covered offline only by parser unit tests (tests/ui/test_manual_reduction_runspec.py); the single-file flow is covered by the existing UI tests. ruff check + format clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Covers parse_run_numbers/is_run_specification logic and the full reduce_runs path against real HB2B data from IPTS-22731. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
Author
|
closes issue #928 |
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.
Short description of the changes:
Long description of the changes:
Check list for the pull request
Check list for the reviewer
Manual test for the reviewer
References