Skip to content

equilibrate: modify total conc check for missing elements#352

Merged
rkingsbury merged 2 commits intomainfrom
rk/eqmissing
Feb 14, 2026
Merged

equilibrate: modify total conc check for missing elements#352
rkingsbury merged 2 commits intomainfrom
rk/eqmissing

Conversation

@rkingsbury
Copy link
Member

Summary

This PR slightly modifies the logic used to detect whether PHREEQC has discarded an element. The previous logic compared the original total element concentration with the one returned by PHREEQC, and if the two differed by more than a low tolerance, pyEQL would assume that the element had been dropped and add back in the entire original concentration, as discovered by @vineetbansal in #329 .

Although the bug has already been fixed in #351 , this PR goes a step further to check only whether the "new" total concentration (i.e., that returned by PHREEQC) is greater than zero. If it is, that indicates that PHREEQC is "aware" of the element in question and has retained it.

We retain an error message that will be thrown if the original and new total concentrations differ by more than 5%. This really should never happen, but had this error message been present in previous versions of equilibrate, it would have caught #329 and brought it to the user's attention.

@rkingsbury rkingsbury changed the title equilibrate: modify total conc check equilibrate: modify total conc check for missing elements Feb 14, 2026
@rkingsbury
Copy link
Member Author

(Note to self, the USGS link https://www.usgs.gov/software/phreeqc-version-3 is timing out during the docs linkcheck. I think that's temporary and on their server side so I'm ignoring)

@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.53%. Comparing base (806b876) to head (12fa836).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #352      +/-   ##
==========================================
+ Coverage   85.36%   85.53%   +0.17%     
==========================================
  Files          14       14              
  Lines        1858     1860       +2     
  Branches      322      323       +1     
==========================================
+ Hits         1586     1591       +5     
+ Misses        226      224       -2     
+ Partials       46       45       -1     

☔ 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.

@rkingsbury rkingsbury merged commit 139316c into main Feb 14, 2026
16 of 18 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.

1 participant