Skip to content

feat: DBA simulator dialog and save-data-template action#29

Open
ahmadomira wants to merge 1 commit into
mainfrom
feat/dba-simulator-and-save-template
Open

feat: DBA simulator dialog and save-data-template action#29
ahmadomira wants to merge 1 commit into
mainfrom
feat/dba-simulator-and-save-template

Conversation

@ahmadomira

@ahmadomira ahmadomira commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Bundles two gui/main_window.py-only conveniences (Package C).

#23 — built-in DBA forward-simulation dialog

A DBA Simulator dialog (new gui/dialogs/simulator_dialog.py), launched from a new toolbar button and the Tools menu. Parameter inputs — Ka, I0, I_dye_free, I_dye_bound, [Host]₀, [Dye]₀, plus a Host→Dye / Dye→Host direction toggle — drive a live PyQtGraph titration curve. The curve is computed by the shared, tested core/models/equilibrium.py dba_signal.

#24 — "Save Data Template…" action

A Save Data Template… action (Import dropdown + File menu) that writes a small example input file via a new core/io/template.py helper. .txt → tab-separated repeated-header (var⇥signal) blocks; .csv → long-format concentration,signal,replica. Headers match exactly what core/io readers expect, and the emitted file round-trips through load_measurements. Assay-agnostic — it shows the format, not any binding model.

Tests

  • tests/unit/gui/test_simulator_dialog.py — curve equals dba_signal for the widgets' values, mode switch retargets the titrant/fixed species, live update on parameter change, and a model-agnostic monotonicity check.
  • tests/unit/test_io_template.py.txt/.csv templates round-trip through the real readers with the expected shape and values.

uv run pytest -k "simulator or template or io" → 155 passed, 3 skipped. uv run ruff check / ruff format clean.

Closes #23
Closes #24

Adds two main-window entry points that lower the barrier to using the app:

- A DBA Simulator dialog (toolbar + Tools menu) for experiment design —
  parameters drive a live PyQtGraph titration curve computed by the shared
  core.models.equilibrium.dba_signal, so no forward-model math is duplicated.
- A "Save Data Template…" action that emits an example input file the
  existing readers accept, so users can format their data by example.

Closes #23
Closes #24
Copilot AI review requested due to automatic review settings June 25, 2026 15:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two user-facing conveniences to the GUI: a modeless DBA forward-simulation dialog (live PyQtGraph titration curve driven by core.models.equilibrium.dba_signal) and a “Save Data Template…” action that writes an example CSV/TXT file that round-trips through the real core.io.load_measurements readers.

Changes:

  • Add SimulatorDialog (DBA simulator) and wire it into the main window via toolbar + Tools menu action.
  • Add write_data_template() helper and wire it into the main window via Import dropdown + File menu action.
  • Add unit tests covering simulator wiring and template round-trip behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
gui/main_window.py Adds actions/menu wiring for DBA Simulator dialog and Save Data Template flow.
gui/dialogs/simulator_dialog.py Implements the modeless DBA simulator UI and live curve computation via dba_signal.
core/io/template.py Implements CSV/TXT example template generator intended to round-trip through existing readers.
tests/unit/gui/test_simulator_dialog.py Validates simulator widget→model wiring, mode behavior, and live updates.
tests/unit/test_io_template.py Validates template output round-trips through load_measurements for both formats.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

for label, _mode, _x_species in _MODES:
self._mode.addItem(label)

self._ka = self._spin(0.0, 1e12, 0, 5e5, ' M⁻¹')
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.

feat: "Save data template" action emitting an example input file feat: built-in DBA forward-simulation dialog

2 participants