Skip to content

Commit

Permalink
Updated visualzations for RecipeSteps
Browse files Browse the repository at this point in the history
  • Loading branch information
JMarvi3 committed May 30, 2024
1 parent 91af216 commit 028ec04
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Binary file modified docs/source/images/recipe_steps_visualization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Canonical Workflow

5. Optionally, map ``Container``\ s to particular experiments.

.. note:: By convention, stock solutions should be prepared outside of ``Recipe``\ s (even though ``PyPlate`` allows ``Containers`` to be created inside or outside ``Recipe``\ s.)
.. note:: By convention, stock solutions should be prepared outside of ``Recipe``\ s (even though ``PyPlate`` allows ``Container``\ s to be created inside or outside ``Recipe``\ s.) |br|
Transfers between ``Container``\ s should be done outside of ``Recipe``\ s, but transfers between a ``Container`` and a ``Plate`` or between ``Plate``\ s should be done inside a ``Recipe``.

Quickstart Example, Explained
"""""""""""""""""""""""""""""
Expand Down
15 changes: 7 additions & 8 deletions docs/source/users_guide/visualizations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ All of the above functions can be applied to a slice of a plate.
array([[10.6, 10.6],
[10. , 10. ]])

>>> plate[:2, :2].dataframe(unit='uL')



Recipes
-------
Expand Down Expand Up @@ -123,13 +126,9 @@ Recipe Steps
- When a recipe is baked, all the steps are stored in the `steps` attribute of the recipe.
- Each step has a `visualize` method that can be used to visualize the step, using the same arguments as the `visualize` method of the recipe.

>>> for step in recipe.steps:
display(step.visualize(what=plate2, mode='final', unit='uL'))
>>> for i, step in enumerate(recipe.steps):
print(f"Step: {i+1}")
display(step)

.. image:: /images/recipe_steps_visualization.png

>>> for step in recipe.steps:
print(step.instructions)
Transfer 10 uL from plate1[:] to plate2[:].
Transfer 10 uL from plate2[:] to plate3[:].
Transfer 10 uL from plate3[:] to plate4[:].
:scale: 75 %
7 changes: 5 additions & 2 deletions pyplate/pyplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1713,13 +1713,16 @@ def _repr_html_(self):
if isinstance(destination_visual, pandas.DataFrame):
destination_visual = destination_visual.style

label = "Destination (delta): " if isinstance(self.to[0], Plate) else "Destination: "
label = f"Destination (delta) ({config.volume_display_unit}): " if isinstance(self.to[0], Plate) else "Destination: "
destination_visual.set_caption(label + self.to[0].name)
if source_visual is None:
return self.instructions + '<br/>' + destination_visual.to_html()

source_visual.set_table_attributes("style='display:inline; margin-right:20px'")
source_visual.set_caption(f"Source (initial): {self.frm[0].name}")
if isinstance(self.frm[0], Plate):
source_visual.set_caption(f"Source (initial) ({config.volume_display_unit}): {self.frm[0].name}")
else:
source_visual.set_caption(f"Source (initial): {self.frm[0].name}")
destination_visual.set_table_attributes("style='display:inline'")
return self.instructions + '<br/>' + source_visual.to_html() + destination_visual.to_html()

Expand Down

0 comments on commit 028ec04

Please sign in to comment.