Skip to content

Manual reduction UI#981

Merged
fanchercm merged 3 commits into
nextfrom
manual_reduction_UI
Jun 10, 2026
Merged

Manual reduction UI#981
fanchercm merged 3 commits into
nextfrom
manual_reduction_UI

Conversation

@fanchercm

Copy link
Copy Markdown
Collaborator

Short description of the changes:

Long description of the changes:

Check list for the pull request

  • I have read the [CONTRIBUTING]
  • I have read the [CODE_OF_CONDUCT]
  • I have added tests for my changes
  • I have updated the documentation accordingly

Check list for the reviewer

  • I have read the [CONTRIBUTING]
  • I have verified the proposed changes
  • best software practices
    • all internal functions have an underbar, as is python standard
    • clearly named variables (better to be verbose in variable names)
    • code comments explaining the intent of code blocks
  • All the tests are passing
  • The documentation is up to date
  • code comments added when explaining intent

Manual test for the reviewer

References

fanchercm and others added 3 commits June 10, 2026 10:32
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>
@fanchercm

Copy link
Copy Markdown
Collaborator Author

closes issue #928

@fanchercm fanchercm merged commit 531d47e into next Jun 10, 2026
9 checks passed
@fanchercm fanchercm deleted the manual_reduction_UI branch June 10, 2026 18:02
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.

1 participant