Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding convert_water_mm_to_moles and calculate_water_molar_volume #400

Merged
merged 3 commits into from
Jan 29, 2025

Conversation

davidorme
Copy link
Collaborator

Description

This PR:

  • Adds convert_water_mm_to_moles as the reciprocal of convert_water_moles_to_mm
  • Adds calculate_water_molar_volume which otherwise is duplicate within those two functions.
  • Adds tests - simple benchmarks for all three functions against real world approximate values and then extends the existing tests to check that the round trip through both functions works as expected.

Fixes #399

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@davidorme davidorme linked an issue Jan 27, 2025 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.48%. Comparing base (56ccf57) to head (ba35d89).
Report is 43 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #400      +/-   ##
===========================================
+ Coverage    96.27%   96.48%   +0.20%     
===========================================
  Files           34       35       +1     
  Lines         2659     2730      +71     
===========================================
+ Hits          2560     2634      +74     
+ Misses          99       96       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@MarionBWeinzierl MarionBWeinzierl left a comment

Choose a reason for hiding this comment

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

LGTM, just one question about tolerances in the tests

assert_allclose(
calculate_water_molar_volume(tc=0, patm=101325),
CoreConst.k_water_molmass,
atol=0.01,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason you are using atol here and rtol elsewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No 😄

@davidorme davidorme merged commit 87a9032 into develop Jan 29, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add convert_water_mm_to_moles
3 participants