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

feat(api): inner well geometry unit tests #17082

Open
wants to merge 19 commits into
base: edge
Choose a base branch
from

Conversation

caila-marashaj
Copy link
Contributor

@caila-marashaj caila-marashaj commented Dec 10, 2024

Overview

This pr resolves the geometry calculations pertaining to liquid tracking. It updates a lot of the inner well geometry definitions according to the hardware team's measurements, and includes some math and logic fixes.

Frustum Whoopsie

One notable math fix is that the first time height_to_volume_circular or volume_to_height_circular are called for a given well, we'll now generate a table in shared-data containing the volume calculated at every height within the well at a 0.005 mm interval. We did this because the inverse function of the polynomial relationship (only for circular frusta) we came up with was shown to have an exponential increase in error with respect to height that peaked at the middle of each well segment.

image

To clarify, finding the volume from the height within a conical frustum works reliably well. This is because the relationship between height and volume takes the following shape:
Volume = a * target_height^3 + b * target_height^2 + c * target_height, where a, b, and c are found from the heights and radii of the top and bottom faces.

This makes finding the volume only a matter of addition and multiplication, but finding the height from some arbitrary volume to require an estimation of the roots of a third-degree polynomial. So, the solution here is just to avoid using that estimation and rely on a set number of the more reliable volume calculations that are done all at once.

For whatever reason, this was only a problem when calculating heights in circular, and not rectangular, frusta, so we left the rectangular math as is.

Changelog

  • aforementioned restructuring of the circular height and volume calculations
  • add unit tests that compare our calculations with the measured values from the hardware team laid out in this doc
  • updates to inner well geometry definitions according to hardware's measurements

@ryanthecoder ryanthecoder force-pushed the well-geometry-unit-tests branch from a3440a9 to 9a0eaf5 Compare December 18, 2024 15:18
@caila-marashaj caila-marashaj force-pushed the well-geometry-unit-tests branch from 998393f to 11ee5b7 Compare January 6, 2025 15:41
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 23.52941% with 13 lines in your changes missing coverage. Please review.

Project coverage is 73.82%. Comparing base (906d841) to head (a255168).
Report is 89 commits behind head on edge.

Files with missing lines Patch % Lines
...pentrons_shared_data/labware/labware_definition.py 23.52% 13 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             edge   #17082       +/-   ##
===========================================
- Coverage   92.43%   73.82%   -18.62%     
===========================================
  Files          77       43       -34     
  Lines        1283     3301     +2018     
===========================================
+ Hits         1186     2437     +1251     
- Misses         97      864      +767     
Flag Coverage Δ
g-code-testing ?
shared-data 73.82% <23.52%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...pentrons_shared_data/labware/labware_definition.py 78.00% <23.52%> (ø)

... and 119 files with indirect coverage changes

@caila-marashaj caila-marashaj marked this pull request as ready for review January 6, 2025 21:51
@caila-marashaj caila-marashaj requested review from a team as code owners January 6, 2025 21:51
@caila-marashaj caila-marashaj force-pushed the well-geometry-unit-tests branch from 5f9a620 to 98ea908 Compare January 6, 2025 22:46
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.

2 participants