Skip to content

Remove N2 from ATMOSPHERE #339

Merged
rkingsbury merged 16 commits intoKingsburyLab:mainfrom
SuixiongTay:N2_atm_issue
Feb 14, 2026
Merged

Remove N2 from ATMOSPHERE #339
rkingsbury merged 16 commits intoKingsburyLab:mainfrom
SuixiongTay:N2_atm_issue

Conversation

@SuixiongTay
Copy link
Collaborator

@SuixiongTay SuixiongTay commented Feb 11, 2026

Summary

Copy link
Member

@rkingsbury rkingsbury left a comment

Choose a reason for hiding this comment

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

Thank you Shaun!

@rkingsbury rkingsbury added this to the v1.4.0 release milestone Feb 11, 2026
@rkingsbury
Copy link
Member

I see you've got a lot of merge conflicts. One way to solve that, if your local branch has gotten out of sync with main, is to

git rebase -i origin main

which will interactively "replay" your commits on top of an up to date copy of main.

@rkingsbury
Copy link
Member

Regarding the two test failures here:

_____________________________ test_equilibrate_2L ______________________________
[gw3] linux -- Python 3.13.11 /opt/hostedtoolcache/Python/3.13.11/x64/bin/python

    def test_equilibrate_2L():
        solution = Solution({"Cu+2": "1 umol/L", "O-2": "1 umol/L"}, volume="2 L", engine="phreeqc2026")
        solution.equilibrate(atmosphere=True)
>       assert np.isclose(solution.get_total_amount("Cu", "umol").magnitude, 1.9999998687384424)
E       AssertionError: assert np.False_
E        +  where np.False_ = <function isclose at 0x7f408cd303f0>(1.9899095628456385, 1.9999998687384424)
E        +    where <function isclose at 0x7f408cd303f0> = np.isclose
E        +    and   1.9899095628456385 = <Quantity(1.9899095628456385, 'micromole')>.magnitude
E        +      where <Quantity(1.9899095628456385, 'micromole')> = get_total_amount('Cu', 'umol')
E        +        where get_total_amount = <pyEQL.solution.Solution object at 0x7f406582f9b0>.get_total_amount

solution   = <pyEQL.solution.Solution object at 0x7f406582f9b0>

tests/test_engine_phreeqc2026.py:395: AssertionError
__________________________ test_equilibrate_with_atm ___________________________
[gw3] linux -- Python 3.13.11 /opt/hostedtoolcache/Python/3.13.11/x64/bin/python

    def test_equilibrate_with_atm():
        s1 = Solution({}, pH=7.0, volume="1 L", engine="phreeqc2026")
        s1.equilibrate(atmosphere=True)
        # PHREEQCUI final CO2, O2, and N2 concentrations were slightly adjusted for consistency with wrapper outputs
>       assert np.isclose(s1.get_amount("CO2(aq)", "mol/L").magnitude, 1.397209520185121e-05)  # PHREQCUI - 1.389e-05
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError: assert np.False_
E        +  where np.False_ = <function isclose at 0x7f408cd303f0>(1.424944456303147e-05, 1.397209520185121e-05)
E        +    where <function isclose at 0x7f408cd303f0> = np.isclose
E        +    and   1.424944456303147e-05 = <Quantity(1.424944456303147e-05, 'mole / liter')>.magnitude
E        +      where <Quantity(1.424944456303147e-05, 'mole / liter')> = get_amount('CO2(aq)', 'mol/L')
E        +        where get_amount = <pyEQL.solution.Solution object at 0x7f4065048490>.get_amount

s1         = <pyEQL.solution.Solution object at 0x7f4065048490>

tests/test_engine_phreeqc2026.py:427: AssertionError

For the first one, since you are comparing the Cu concentration in micromolar, a much higher tolerance is OK (e.g., atol=0.1). Alternatively, do the comparison in mol and leave the default tolerances.

For the second, make sure you've adjusted the expected (PHREEQCUI) value.

@rkingsbury
Copy link
Member

Fixes #336

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.31%. Comparing base (23fc5fe) to head (5ba25e8).
⚠️ Report is 32 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #339   +/-   ##
=======================================
  Coverage   86.31%   86.31%           
=======================================
  Files          14       14           
  Lines        1856     1856           
  Branches      322      322           
=======================================
  Hits         1602     1602           
  Misses        208      208           
  Partials       46       46           

☔ 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 added the fix Bug Fixes label Feb 14, 2026
@rkingsbury rkingsbury merged commit 2aec6be into KingsburyLab:main Feb 14, 2026
17 checks passed
@SuixiongTay SuixiongTay deleted the N2_atm_issue branch February 14, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect pH from using Solution.equilibrate(atmosphere=True)

2 participants