Updated local bat - #223
Closed
q24609962-svg wants to merge 16 commits into
Closed
Conversation
Global GUI stylesheet: I updated src/GUI/code/main.py to enforce clear, readable colors across all GUI windows (including CV/CA/LSV creators, experiment list, and port dropdown). Key addition (already in your file now): app = QApplication(sys.argv)
Created a new app_setup.py file to centralize the creation of the QApplication and enforce a consistent stylesheet for readable text and background colors. Updated main.py to utilize this new function, streamlining the application setup process. Added a test for the stylesheet to ensure it sets readable colors across GUI components.
Updated the test file to skip tests if PySide6 is not available, ensuring compatibility and preventing import errors. This change enhances the robustness of the test suite when running in environments without PySide6.
…entiostat into newpullrequest
Problem
Testing and learning the code requires a physical JUAMI potentiostat connected via USB. This makes it hard to run experiments, develop new features, or onboard new users without hardware.
Solution
Added a software simulator that mocks the Arduino pin I/O, allowing all three experiment types (CV, LSV, CA) to run without hardware.
Changes
New files:
- src/pytentiostat/simulator.py: SimulatedPotentiostat class that mimics pyFirmata pin behavior (d9 PWM output, a0/a2 analog reads). Generates realistic
signals: tanh-based I-V curves for LSV/CV, exponential current decay for CA, with configurable noise and auto-scaled current limits. - tests/test_simulator.py: 11 tests covering simulator unit behavior and full integration tests for all three experiment types.
Modified files:
- src/pytentiostat/routines.py: startup_routine() accepts simulate flag; when True, returns simulated pin objects instead of connecting to hardware.
- src/pytentiostat/main.py : Reads PYTENTIOSTAT_SIMULATE env var to enable simulation mode. Added experiment-type switching menu after each run (LSV/CV/CA) so
users can try all experiments in one session.
- src/pytentiostat/operator.py: Fixed UnboundLocalError in CA experiments where normalized_start was undefined (bug present in hardware mode too).
- src/pytentiostat/config_reader.py: Falls back to the bundled config.yml when no config file exists in the current directory (only when no explicit path was
provided).
Usage
# Windows PowerShell
$env:PYTENTIOSTAT_SIMULATE="1"; python -m pytentiostat.main
# Linux/macOS
PYTENTIOSTAT_SIMULATE=1 python -m pytentiostat.main
Test plan
- python -m pytest tests/test_simulator.py -v , all 11 tests pass
- python -m pytest tests/ --ignore=tests/test_routines.py -v ,full suite passes
- Run simulation interactively and verify distinct plots for CV, LSV, and CA
- Verify existing hardware workflow is unaffected (no env var set)
Member
|
Thanks for this @q24609962-svg it is appreciated. I have a few comments:
Thanks so much for hte contributions we really appreciate them! |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tiostat into pullrequest3
Closed
Member
|
closing as replaced by #226 |
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.
closes #209
Changed: