Skip to content

alkalinity: add definition based on weak acids and bases - #398

Merged
rkingsbury merged 13 commits into
KingsburyLab:mainfrom
SuixiongTay:shaun/alkalinity
May 28, 2026
Merged

alkalinity: add definition based on weak acids and bases#398
rkingsbury merged 13 commits into
KingsburyLab:mainfrom
SuixiongTay:shaun/alkalinity

Conversation

@SuixiongTay

@SuixiongTay SuixiongTay commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Added additional acid and bases including:

  • Carbonate species: [HCO3-], [CO3-2]
  • Phosphorus species: [HPO4−2], [PO4−3], [H2PO4-]
  • Sulfur species: [HS−], [S2−], [HSO4-]
  • Others: H3SiO4[-1], B(OH)4[-1]

This PR addresses #299 .

Todos

  • numerical efficiency improvements (requires discussion)

@codecov

codecov Bot commented May 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.24%. Comparing base (63f4566) to head (27cd1fc).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #398      +/-   ##
==========================================
+ Coverage   86.21%   86.24%   +0.02%     
==========================================
  Files          14       14              
  Lines        1842     1846       +4     
  Branches      319      320       +1     
==========================================
+ Hits         1588     1592       +4     
  Misses        209      209              
  Partials       45       45              

☔ View full report in Codecov by Sentry.
📢 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.

@SuixiongTay
SuixiongTay marked this pull request as ready for review May 14, 2026 13:04
@SuixiongTay
SuixiongTay marked this pull request as draft May 14, 2026 15:23
@SuixiongTay SuixiongTay changed the title Include acid and bases in solution [WIP] Include acid and bases in solution May 14, 2026
@SuixiongTay SuixiongTay changed the title [WIP] Include acid and bases in solution Include acid and bases in solution May 15, 2026
@SuixiongTay
SuixiongTay marked this pull request as ready for review May 15, 2026 16:42
@SuixiongTay

Copy link
Copy Markdown
Collaborator Author

Hi @rkingsbury , this branch is ready for review. I realized there is a docs error in the CI and had submitted another PR to address that in #401. Thanks!

@rkingsbury rkingsbury left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice contribution @SuixiongTay , thank you! See comments.

In addition to what you have here, please add a test case or two to the existing test_alkalinity_hardness method. These cases should not use equilibrate. Rather, just define some solutions with known compositions (ideally, use one that contains weak acid species other than carbonate) and test the returned value against your manually calculated one.

Comment thread tests/test_engine_phreeqc2026.py Outdated
Comment thread tests/test_engine_phreeqc.py Outdated
Comment thread src/pyEQL/solution.py Outdated
Comment thread src/pyEQL/solution.py Outdated
Comment thread src/pyEQL/solution.py Outdated
Comment thread src/pyEQL/solution.py Outdated
Comment thread src/pyEQL/solution.py Outdated
Comment thread src/pyEQL/solution.py Outdated
Comment thread src/pyEQL/solution.py Outdated
Comment thread src/pyEQL/solution.py Outdated
@SuixiongTay
SuixiongTay requested a review from rkingsbury May 27, 2026 14:26
@SuixiongTay

Copy link
Copy Markdown
Collaborator Author

Hi @rkingsbury , the PR has been updated and is ready for your review. Thanks!

rkingsbury
rkingsbury previously approved these changes May 28, 2026

@rkingsbury rkingsbury left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good @SuixiongTay . Ready to merge after a few small text edits.

Comment thread tests/test_engine_phreeqc2026.py Outdated
Comment thread tests/test_engine_phreeqc.py Outdated
Comment thread src/pyEQL/solution.py Outdated
Comment thread src/pyEQL/solution.py Outdated
@rkingsbury rkingsbury changed the title Include acid and bases in solution alkalinity: add definition based on weak acids and bases May 28, 2026
@rkingsbury
rkingsbury merged commit 9bffbe7 into KingsburyLab:main May 28, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants