-
Notifications
You must be signed in to change notification settings - Fork 179
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
refactor(api): add pipette misc functions to protocol_api #2713
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes explicitly called out, but also we need to significantly rework the way transfers work. The code is a bit of a nightmare right now. We should make state more centralized and explicit, and we should take the time now to think about making multichannel transfers better and how to handle 384-plates. This may include changing the labware spec.
One thing we can do for testing that I think will help a deal is
- Change the robot singleton to write out all "atomic" ops (aspirate, dispense, move, mix, blowout, airgap, pick up, drop tip) to a log in a machine parseable fashion
- Make our contexts do the same
- write some protocols that do transfers and execute them on both and make sure they match (except for any behavioral bugs we find and fix).
a508f5f
to
00f175c
Compare
Codecov Report
@@ Coverage Diff @@
## edge #2713 +/- ##
==========================================
+ Coverage 51.68% 54.01% +2.33%
==========================================
Files 662 667 +5
Lines 18922 20471 +1549
==========================================
+ Hits 9779 11058 +1279
- Misses 9143 9413 +270
Continue to review full report at Codecov.
|
a6faae0
to
07c62ea
Compare
ed09408
to
99d7d5c
Compare
99d7d5c
to
ffa8909
Compare
… TransferPlan Class. Closes #2242
ffa8909
to
0cfecf8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nitpicks around documentation, old code, and some parameter types and verification but on the whole this looks really good!
@@ -596,31 +595,210 @@ def mix(self, | |||
volume: float = None, | |||
location: Well = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment calls out location
as being able to take either a well or position relative to a well (so, a Location
), and I think that's how it should be. We should change location
here to take basically the same thing as aspirate
.
@@ -596,31 +595,210 @@ def mix(self, | |||
volume: float = None, | |||
location: Well = None, | |||
rate: float = 1.0) -> 'InstrumentContext': | |||
raise NotImplementedError | |||
""" | |||
Mix a volume of liquid (uL) using this pipette. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this docstring isn't formatted for sphinx. The generated documentation therefore doesn't really work.
volume: float, | ||
source: Well, | ||
dest: Well, | ||
volume: Union[float, Sequence[float]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documenting extensive **kwargs
parameters appears to be a thing for which there's not really a specific best practice in Sphinx, but the way this docstring is defined doesn't render very well.
I'd suggest we do one of
- Continue the way this works, with the params documented nested under the
kwargs
entry in the params list - Explicitly reference TransferOptions if possible (may not be possible since some kwargs are interpreted here)
- Add another section called
Additional Options
or something and call out individual options there, basically hand formatting it to match the look of the autodoc-generated rst (per this SO answer
Whatever we go with, we should probably use a raw rst list since the way it is right now actually has all the kwarg keys on the same indent level as the kwargs
callout, doesn't have them quoted, and has a line break in between the key, the type, and the description.
|
||
def _plan_transfer(self): | ||
""" | ||
Source/ Dest: Multiple sources to multiple destinations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is private and the module is private too, but still the docstring should be informative and well formatted. It looks like some stuff here is outdated and some stuff isn't - we should just take a pass and make sure it's accurate and understandable by other devs, and format it as rst in case we ever generate docs from it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you point to which stuff looks outdated? Maybe I am missing something or I made a mistake in writing a method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
touch_tip
on troughs doesn't quite work right because of another length vs width issue.
We have pretty consistently defined overallLength
to be the longer of the outer dimensions and overallWidth
to be the shorter of the outer dimensions of a labware, which means length=x span and width=y span. The trough's well definitions follow this also. Unfortunately, Well._from_center_cartesian
doesn't, and thinks that length
corresponds with y
and width
corresponds with x
. So we'll need to change those back.
Mix, blowout, and airgap seem to work though. |
…e & other minor corrections
changed kwargs docs, functools.wraps invocation, fixed multichannel transfer bug, fixed _from_center_cartesian bug, added code to use new location types for transfer functions in commands.py and session.py
…tichannel transfers
Docs look good, functionality looks good. Touch tip on troughs is definitely weird but I think that's out of scope because it's certainly touching all 4 walls correctly, the question is just "is that actually a useful thing to do". |
…. added test for transfer optio
Found a bug in |
raise NotImplementedError | ||
# source: Union[Well, List[Well], List[List[Well]]], | ||
# dest: Union[Well, List[Well], List[List[Well]]], | ||
# TODO: Reach consensus on kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these TODOs resolved?
.. Dispense air gap -> ...* | ||
|
||
""" | ||
# TODO: decide whether default disposal vol for distribute should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TODO still relevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛬
Closes #2242
overview
This PR adds the following pipette functions to protocol_api:
touch_tip()
mix()
blow_out()
return_tip()
air_gap()
distribute()
consolidate()
transfer()
Adds a TransferPlan Class which will be used by
distribute()
,consolidate()
andtransfer()
above.The transfer actions are and the sequence of these actions is subject to change. New features of the transfer plan include ability to specify options/args of different pipette actions (eg. you can now specify location, presses and increment args of
'pick_up_tip()
).Features/ Bugs that will be addressed in the next PR:
review requests
I have tried to keep the methods true to their original behavior in the old api but have modified the args in cases where a
Placeable
was used before. This restricts the possible location arguments, e.g, in case oftouch_tip(loc)
which will now only accept a Well as a valid location. Please review these changes for any issues.Test on a robot: run protocols in the app with the new protocol api flag set. Here are two protocols for reference
papi_instr_ctx_protocols.zip
And an example test if you want to test individual functions in shell:
Add transfer options (you can borrow some options from tests) and test them on a robot