Skip to content

Add affinity unit conversion function#182

Open
jthorton wants to merge 5 commits intomainfrom
unit_conversions
Open

Add affinity unit conversion function#182
jthorton wants to merge 5 commits intomainfrom
unit_conversions

Conversation

@jthorton
Copy link
Contributor

@jthorton jthorton commented Feb 16, 2026

Description

Fixes #151 by adding an affinity unit conversion function extracted from the PLB. Plan to add tutorials and docs in another PR.

Todos

Notable points that this PR has either accomplished or will accomplish.

  • TODO 1

Questions

  • Question1

Checklist

  • Added a news entry for new features, bug fixes, or other user facing changes.

Status

  • Ready to go

Tips

  • Comment "pre-commit.ci autofix" to have pre-commit.ci atomically format your PR.
    Since this will create a commit, it is best to make this comment when you are finished with your work.

@jthorton
Copy link
Contributor Author

pre-commit.ci autofix

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.62%. Comparing base (f32557d) to head (a3b473f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #182      +/-   ##
==========================================
+ Coverage   96.25%   96.62%   +0.37%     
==========================================
  Files          18       20       +2     
  Lines        1467     1629     +162     
==========================================
+ Hits         1412     1574     +162     
  Misses         55       55              

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

Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

I'll let @hannahbaumann do the approval here - from a quick glance this looks great!

raise ValueError(f"Unknown final_type: {final_type}. Must be one of: {', '.join(valid_types)}")

# store the conversion functions by (original_type, final_type) in a dictionary for easy lookup
converters = {
Copy link
Member

Choose a reason for hiding this comment

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

This is quite nice!

original_type: OBSERVABLE_TYPES,
final_type: OBSERVABLE_TYPES,
uncertainty: None | unit.Quantity = None,
temperature: unit.Quantity = 300.0 * unit.kelvin,
Copy link
Member

Choose a reason for hiding this comment

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

Within openfe we default to 298.15, do we want to use that here or are we better off with the idea that a lot of the experimental measurements are at 300?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add unit conversion utilities

2 participants