Skip to content

enh: expert settings for keyword arguments in the GUI (#12) - #25

Merged
paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:gui-expert-kwargs
Nov 26, 2026
Merged

paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:gui-expert-kwargs

Conversation

@paulmueller-agent

Copy link
Copy Markdown

Closes #12.

Changes

Expert settings in the GUI

  • New menu "Settings → Expert settings..." opens ExpertSettingsDialog (chipstream/gui/dlg_expert.py). It has one text field per pipeline step: background computation (sparsemed), segmentation, feature extraction, and gating. Users enter KEY=VALUE arguments there, one per line, as with -kb/-ks/-kf/-kg of chipstream-cli. Empty lines and lines starting with # are ignored; "Reset" clears all fields.
  • The arguments override the settings of the main window (e.g. thresh=-4 overrides the threshold spin box). Segmentation arguments for mask post-processing (clear_border, fill_holes, closing_disk) go into kwargs_mask.
  • Clicking OK validates the arguments for the currently selected segmenter; invalid arguments show a warning and keep the dialog open. At run time they are validated again for the segmenter selected then. If they are invalid (e.g. model_file=... while thresholding is selected), the run does not start and an error message is shown.
  • While expert settings are active, an orange warning "⚠ Expert settings active (Settings → Expert settings)" is shown in the status bar; its tooltip lists the arguments. This is the warning in the regular UI the issue asks for.
  • The expert settings are kept for the session only (not stored in the settings file), so that nobody runs a pipeline with forgotten expert settings after a restart.
  • offset_correction can now be set in the expert settings. Until now, the job manager always overwrote it with the automatic flickering detection; it now only detects flickering if offset_correction is not given (the main window no longer passes the default value).

Refactoring

  • The KEY=VALUE parsing from fix: malformed -ks/-kb/-kf/-kg arguments caused tracebacks #16 moved from chipstream/cli/cli_valid.py to the new module chipstream/kwargs_parse.py, which does not depend on click (the GUI can be installed without the cli extra). It raises KeywordArgumentError (a ValueError with the option name). cli_valid keeps its function names and wraps them, converting KeywordArgumentError to click.BadParameter, so the CLI messages are unchanged.

Tests

  • test_gui_expert_kwargs_job_kwargs: all four steps end up in the job kwargs and override the main window; the warning is shown/hidden; without expert settings, offset_correction is not passed.
  • test_gui_expert_kwargs_invalid: invalid arguments for the selected segmenter show an error and do not start the run.
  • test_gui_expert_kwargs_dialog: the dialog keeps invalid input open, ignores comments and empty lines, and returns the arguments.
  • test_gui_expert_kwargs_run: a full run uses the expert settings (thresh:t=-4:cle=1^f=1^clo=3, legacy:b=1^h=0^v=1, o=1).

The first three fail on main and pass with the change. The CLI tests (-k "kwargs or invalid or parse", 38 tests), test_gui_manager.py, test_gui_correct_offset[True/False], test_gui_basic, test_gui_sys_usage and test_gui_segm_torch_model_remove pass.

Lint

lint-compare against main: ruff 0 → 0, pyright 1.1.408 0 → 0, flake8 clean.

🤖 Generated with Claude Code

- "Settings -> Expert settings..." opens a dialog where users can enter
  additional `KEY=VALUE` keyword arguments (one per line) for
  background computation, segmentation, feature extraction and gating,
  as with `-kb`/`-ks`/`-kf`/`-kg` of `chipstream-cli`. They override
  the settings of the main window and are kept for the session only.
- The dialog validates the arguments for the selected segmenter when
  OK is clicked; invalid arguments for the segmenter selected at run
  time prevent the run with an error message.
- A warning in the status bar is shown while expert settings are
  active (tooltip lists them).
- The job manager only detects flickering (offset correction) if
  `offset_correction` is not set explicitly.
- ref: the `KEY=VALUE` parsing moved from `chipstream.cli.cli_valid` to
  the click-free module `chipstream.kwargs_parse`; `cli_valid` wraps
  it and converts `KeywordArgumentError` to `click.BadParameter`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.14563% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.95%. Comparing base (5045ff0) to head (a9a40a1).

Files with missing lines Patch % Lines
chipstream/gui/main_window.py 87.23% 6 Missing ⚠️
chipstream/gui/dlg_expert.py 95.83% 2 Missing ⚠️
chipstream/kwargs_parse.py 97.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #25      +/-   ##
==========================================
+ Coverage   78.72%   79.95%   +1.22%     
==========================================
  Files          21       23       +2     
  Lines        1485     1611     +126     
==========================================
+ Hits         1169     1288     +119     
- Misses        316      323       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paulmueller
paulmueller merged commit 2a6989a into DC-analysis:main Nov 26, 2026
8 checks passed
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.

Expert settings to add additional keyword arguments for segmentation and feature extraction

2 participants