diff --git a/README.md b/README.md
index fc49124..4178486 100644
--- a/README.md
+++ b/README.md
@@ -75,11 +75,21 @@ nimbus.move_plate(plate="sample_plate", to="plate_carrier-4")
```
What is fitted to each robot is the worktable file's `equipment`, because IvoryOS reads a deck's
-instruments once, when it starts: on a Flex or OT-2 the pipette on each mount; on a STAR or Prep which
-parts it has (`{"pipettes": true, "head96": true, "iswap": true, ...}`). Simulated, it is what the
-simulator has (on a STAR, PyLabRobot's recording of that frame; `{"head384": true}` picks the
-384-head recording). A real robot is asked once when the file does not say, and the answer is
-written to the file; each time it is set up, what it reports is checked against the file.
+instruments once, when it starts: on a Flex or OT-2 the pipette on each mount; on a STAR how many
+channels and which parts it has (`{"channels": 8, "head96": true, "iswap": true, ...}`); on a Prep
+which parts it has. A real robot is asked once when the file does not say, and the answer is written
+to the file; each time it is set up, what it reports is checked against the file.
+
+Simulated, an Opentrons robot has whatever pipettes the file says. A simulated STAR is PyLabRobot's
+recording of that frame (8 channels, a 96-head, an iSWAP, CoRe grippers, an autoload) changed to
+what the file says, so a dry run matches the STAR it stands in for: 2, 4 or 8 channels on a STARlet
+and 2, 4, 8, 12 or 16 on a STAR or STARplus (PyLabRobot's simulator cannot model one), a 96-head, a
+384-head (STAR and STARlet) or none, and the iSWAP and autoload (not on a STARplus, whose recording
+has none) or not. A simulated Prep is PyLabRobot's recording of one, as it is.
+
+A STAR's or a Prep's channels and heads are built into it, so a real one's are shown and not changed;
+an Opentrons pipette is swapped by hand, so a real Flex's or OT-2's are changed in the file (or the
+Labware panel) when the pipette on the robot is.
Each robot module keeps a `SKIPPED` table of the PyLabRobot methods it cannot offer as a step, and
why: an argument of a type a form cannot fill (a callback, a colour) with no default.
@@ -330,17 +340,22 @@ in a deck file (or `ivoryos_edge.run(__name__, plugins=[plr_ivoryos.labware_view
beside every page. **Edit layout** changes the worktable file as you go, with nothing to confirm.
It shows the layout and the labware to place; the rest is under **⋯**, and **?** explains it all:
-- on a Flex, what is mounted (**⋯ → Pipettes and gripper…**): the pipette on each mount or the
- 96-channel head, the gripper, the trash slot; on a robot with several worktables (a STAR,
- STARlet or STARplus, an EVO 100, 150 or 200), which one (**⋯ → Robot…**);
+- what is fitted, named in the panel's header: click it (or **⋯ → Equipment…**). A Flex: the
+ pipette on each mount or the 96-channel head, the gripper, the trash slot. An OT-2: the pipette on
+ each mount. A simulated STAR: its channels, head, iSWAP and autoload. A real STAR, and a Prep, show
+ theirs. On a robot with several worktables (a STAR, STARlet or STARplus, an EVO 100, 150 or 200),
+ which one is there too;
- drag labware from PyLabRobot's catalogue (the robot's own tip racks and carriers, and any plate,
- reservoir or tube rack) onto an empty slot or carrier position; drag what is there to move it,
- × to take it off, rename it in the list;
+ reservoir or tube rack) onto an empty slot or carrier position; drag what is there, by any part
+ of it, to move it, × to take it off, rename it in the list;
- click a plate or reservoir, pick wells, and **Fill** them with a liquid and a volume: the
`liquids` a run starts from;
- **⋯ → Import a layout…** takes a worktable file you already have; the one it replaces is kept as
`worktable.before-import.json`.
+Outside **Edit layout**, click any labware to look closer: then each well or tip says what it holds
+as the pointer passes over it (**Whole worktable**, or Escape, goes back).
+
Steps offer added, removed or renamed labware, and changed equipment, once the deck restarts (the
panel offers the restart). Moving labware, filling wells, and going back to the worktable the deck
started with need no restart. The panel is the only part of this package that imports IvoryOS, and
@@ -419,6 +434,15 @@ IvoryOS desktop app's decks do) uses the same plr-ivoryos and PyLabRobot.
so steps are ordinary synchronous calls, from IvoryOS or plain Python. The robot connects at the
first step, so a deck starts with the robot switched off.
+### Not released yet
+
+- **What is fitted, from the Labware panel, on every robot**: click it in the panel's header. An
+ OT-2's mounts can be changed now (before, only a Flex's); a simulated STAR has the channels (2 to
+ 16), head, iSWAP and autoload its file says, instead of always PyLabRobot's recording; a real STAR
+ and a Prep show theirs.
+- In the panel, labware is dragged by any part of it, wells and tips included, and clicked anywhere
+ to look closer; then each well or tip says what it holds as the pointer passes over it.
+
### What changed in 1.0.0b3 (still on PyLabRobot 1.0.0b1)
- **Devices** ([Devices](#devices)): every device the 0.2 line had, on PyLabRobot 1.0.0b1, so they
diff --git a/plr_ivoryos/hamilton/prep.py b/plr_ivoryos/hamilton/prep.py
index 621bc91..6fc36e3 100644
--- a/plr_ivoryos/hamilton/prep.py
+++ b/plr_ivoryos/hamilton/prep.py
@@ -14,7 +14,7 @@
of a Prep has fitted (two channels, an 8-channel head, a heater shaker).
"""
-from typing import Any, Dict, Optional
+from typing import Any, Dict, List, Optional
from pylabrobot.hamilton.prep.device import Prep as plr_Prep, PrepDevice
from pylabrobot.hamilton.prep.driver.features.core_grippers import CoreGrippers
@@ -25,7 +25,7 @@
from plr_ivoryos import bridge
from plr_ivoryos.async_bridge import run_async
-from plr_ivoryos.robot import WorktableRobot, part_class
+from plr_ivoryos.robot import WorktableRobot, part_class, toggle
from plr_ivoryos.wells import Labware, Site
PARTS = ("pipettes", "head8", "core_grippers", "heater_shaker", "lights")
@@ -147,6 +147,17 @@ def stop(self) -> None:
def _deck_extras(self) -> dict:
return {"equipment": {part: True for part, on in self.equipment.items() if on}}
+ def _equipment_fields(self) -> List[dict]:
+ now = self.equipment
+ return [toggle(part, label, now.get(part)) for part, label in (
+ ("pipettes", "Channels"), ("head8", "8-channel head"), ("core_grippers", "CoRe grippers"),
+ ("heater_shaker", "Heater shaker"), ("lights", "Lights"))]
+
+ def _equipment_fixed(self) -> Optional[str]:
+ if self._simulated:
+ return "As PyLabRobot's recording of a Prep has it."
+ return "As the Prep reported it: what is built into it is not changed here."
+
def worktable_deck():
from plr_ivoryos import worktable
diff --git a/plr_ivoryos/hamilton/star.py b/plr_ivoryos/hamilton/star.py
index 18d3df4..2ab510e 100644
--- a/plr_ivoryos/hamilton/star.py
+++ b/plr_ivoryos/hamilton/star.py
@@ -15,16 +15,21 @@
Which frame it is (STARlet, STAR, STARplus) is the worktable file's `deck_type`, and what is fitted
is its `equipment`, because IvoryOS reads a deck's instruments once, when it starts, and PyLabRobot
-only learns what is fitted once it connects. Simulated, what is fitted is what PyLabRobot's
-recording of that frame has (8 channels, a 96-head, an iSWAP, CoRe grippers, an autoload; say
-`"head384": true` for the 384-head recording). A real STAR is asked once, when the file does not
-say, and the answer is written to the file; each time it is set up, what it reports is checked
-against the file.
+only learns what is fitted once it connects. A STAR's channels and heads are built into it, so a
+real STAR is asked once, when the file does not say, and the answer is written to the file; each
+time it is set up, what it reports is checked against the file. Simulated, the STAR is PyLabRobot's
+recording of that frame (8 channels, a 96-head, an iSWAP, CoRe grippers, an autoload), changed to
+have what the file says: how many channels (CHANNELS), a 96-head, a 384-head or none, an iSWAP or
+not, an autoload or not (`simulated_configuration`), so a dry run matches the STAR it stands in for.
`simulated=True` is PyLabRobot's own STAR simulator (`STARSimulationDriver`): every command is
checked and answered as the firmware would, with PyLabRobot's tip and volume tracking.
"""
+import hashlib
+import json
+import os
+import tempfile
from typing import Any, Dict, List, Optional
from pylabrobot.hamilton.star.device import (RECORDING_STAR, RECORDING_STAR_HEAD384, RECORDING_STARLET,
@@ -41,7 +46,7 @@
from plr_ivoryos import bridge, worktable
from plr_ivoryos.async_bridge import run_async
-from plr_ivoryos.robot import WorktableRobot, part_class
+from plr_ivoryos.robot import WorktableRobot, choice, part_class, toggle
from plr_ivoryos.wells import Labware, Site
# deck_type -> (PyLabRobot's frame, its recording, its recording with a 384-head)
@@ -54,23 +59,100 @@
# What can be fitted to a STAR, by PyLabRobot's attribute for it.
PARTS = ("pipettes", "head96", "head384", "iswap", "core_grippers", "autoload")
+# How many channels a simulated STAR can have, by frame: what the frames are built with.
+# PyLabRobot's simulator cannot model a single channel.
+CHANNELS = {"STARLetDeck": (2, 4, 8), "STARDeck": (2, 4, 8, 12, 16), "STARPlusDeck": (2, 4, 8, 12, 16)}
+
def check_equipment(equipment: Dict[str, Any]) -> Dict[str, Any]:
- """`equipment` as the worktable file keeps it ({"pipettes": true, "head96": true, ...}), or
- ValueError saying what is wrong with it."""
+ """`equipment` as the worktable file keeps it ({"channels": 8, "head96": true, ...}), or
+ ValueError saying what is wrong with it. `channels` decides `pipettes` (and the CoRe
+ grippers, which two channels carry) when it is given."""
if not isinstance(equipment, dict):
- raise ValueError('equipment is {"pipettes": true, "head96": true, "iswap": true, ...}')
- unknown = sorted(set(equipment) - set(PARTS))
+ raise ValueError('equipment is {"channels": 8, "head96": true, "iswap": true, ...}')
+ unknown = sorted(set(equipment) - set(PARTS) - {"channels"})
if unknown:
- raise ValueError(f"'{unknown[0]}' is not something fitted to a STAR: {', '.join(PARTS)}.")
- out = {part: bool(equipment.get(part, False)) for part in PARTS}
+ raise ValueError(f"'{unknown[0]}' is not something fitted to a STAR: channels, {', '.join(PARTS)}.")
+ out = {part: _yes(equipment.get(part, False)) for part in PARTS}
+ if equipment.get("channels") is not None:
+ try:
+ number = float(equipment["channels"])
+ except (TypeError, ValueError):
+ raise ValueError(f"channels is a number of channels, not '{equipment['channels']}'.") from None
+ if number != int(number) or not 0 <= number <= 16:
+ raise ValueError(f"A STAR has 0 to 16 channels, not {equipment['channels']}.")
+ channels = int(number)
+ out.update(channels=channels, pipettes=channels > 0, core_grippers=channels >= 2)
if out["head96"] and out["head384"]:
raise ValueError("A STAR has a 96-head or a 384-head, not both.")
return out
+def _yes(value: Any) -> bool:
+ return value.strip().lower() in ("true", "yes", "on", "1") if isinstance(value, str) else bool(value)
+
+
def _fitted(device) -> Dict[str, Any]:
- return {part: getattr(device, part, None) is not None for part in PARTS}
+ fitted = {part: getattr(device, part, None) is not None for part in PARTS}
+ fitted["channels"] = device.pipettes.num_channels if fitted["pipettes"] else 0
+ return fitted
+
+
+def _recording(kind: str, head384: bool = False) -> dict:
+ frame, recording, recording384 = FRAMES[kind]
+ if head384 and recording384 is None:
+ raise ValueError(f"PyLabRobot has no recording of a {worktable.DECKS.get(kind, kind)} with a 384-head "
+ "to simulate.")
+ with open(recording384 if head384 else recording) as f:
+ return json.load(f)
+
+
+def recorded_equipment(kind: str, head384: bool = False) -> Dict[str, Any]:
+ """What PyLabRobot's recording of a frame has fitted."""
+ device = _recording(kind, head384)["device"]
+ arm = device.get("left_arm") or {}
+ return check_equipment({"channels": device.get("num_pip_channels", 0), "head96": arm.get("head96_installed"),
+ "head384": arm.get("head384_installed"), "iswap": arm.get("iswap_installed"),
+ "autoload": device.get("autoload_installed")})
+
+
+def simulated_configuration(kind: str, equipment: Dict[str, Any]) -> str:
+ """PyLabRobot's recording of the frame, changed to have what `equipment` says is fitted: the
+ path of a configuration for PyLabRobot's simulator (`declared_configuration_json`). The 384-head
+ one is PyLabRobot's own recording; channels, a head, the iSWAP and the autoload are taken away
+ or the channels counted again, the way PyLabRobot derived its other recordings from one."""
+ recorded = _recording(kind, bool(equipment.get("head384")))
+ device, arm = recorded["device"], recorded["device"]["left_arm"]
+ held = recorded["arms"]["left"]
+ channels = int(equipment.get("channels", device["num_pip_channels"]))
+ if channels < 2:
+ raise ValueError("PyLabRobot's STAR simulator needs at least two channels.")
+ device["num_pip_channels"] = channels
+ recorded_channels = held["pipettes"]["channels"]
+ held["pipettes"]["channels"] = [dict(recorded_channels[i % len(recorded_channels)]) for i in range(channels)]
+ if not equipment.get("head96") and not equipment.get("head384"):
+ for head in ("head96", "head384"):
+ held.pop(head, None)
+ arm[f"{head}_installed"] = device[f"{head}_installed"] = False
+ if not equipment.get("iswap"):
+ held.pop("iswap", None)
+ arm["iswap_installed"] = device["kb_iswap_installed"] = False
+ elif "iswap" not in held:
+ raise ValueError(f"PyLabRobot's recording of a {worktable.DECKS.get(kind, kind)} has no iSWAP to simulate.")
+ if not equipment.get("autoload"):
+ recorded.pop("autoload", None)
+ device["autoload_installed"] = False
+ elif not recorded.get("autoload"):
+ raise ValueError(f"PyLabRobot's recording of a {worktable.DECKS.get(kind, kind)} has no autoload to simulate.")
+ text = json.dumps(recorded, sort_keys=True)
+ folder = os.path.join(tempfile.gettempdir(), "plr-ivoryos-star")
+ os.makedirs(folder, exist_ok=True)
+ path = os.path.join(folder, hashlib.sha256(text.encode()).hexdigest()[:16] + ".json")
+ if not os.path.exists(path):
+ with open(path + ".part", "w") as f:
+ f.write(text)
+ os.replace(path + ".part", path)
+ return path
class STAR(WorktableRobot):
@@ -78,13 +160,13 @@ class STAR(WorktableRobot):
names and wells; each fitted thing (channels, 96- or 384-head, iSWAP, CoRe grippers, autoload) is
an instrument of its own (`__ivoryos_instruments__`).
- simulated PyLabRobot's STAR simulator, with the fitted things its recording of the frame has
+ simulated PyLabRobot's STAR simulator, with what the file says is fitted (simulated_configuration)
worktable the worktable file (worktable.py); optional, worktable.json in the deck's data
folder. A new one starts ready-made (simulated) or empty, and is written on the
first change.
deck_type STARLetDeck, STARDeck or STARPlusDeck, for a new worktable file (default STARlet)
- equipment what is fitted, when the file does not say ({"head384": true} chooses the 384-head
- recording when simulated)
+ equipment what is fitted, when the file does not say: {"channels": 4, "head96": false}; what it
+ leaves out is what the frame's recording has ({"head384": true}: the 384-head one)
device_address / serial_number which STAR on USB, when there is more than one
step_delay_s a pause after each step, simulated only, so a run can be watched
tracking PyLabRobot's tip and volume tracking
@@ -103,9 +185,17 @@ def __init__(self, simulated: bool = False, worktable: Optional[str] = None, dec
found = None if self._new_file else self._config.get("equipment")
wanted = check_equipment(found or equipment or {}) if (found or equipment) else None
if simulated:
- # What the recording has; the file (or `equipment`) only chooses the 384-head one.
- self._head384 = bool(wanted and wanted["head384"])
+ # What the file (or `equipment`) says, the rest as the frame's recording has it; then
+ # what the simulated STAR made from that reports.
+ asked = found or equipment or {}
+ self._config["equipment"] = self._simulated_equipment(asked, fit=True)
self._config["equipment"] = self._ask(self._make_plr(self._fresh_deck()))
+ left_out = sorted(part for part, on in check_equipment(asked).items()
+ if part in asked and on and not self._config["equipment"].get(part))
+ if left_out or ("channels" in asked and int(asked["channels"]) != self.equipment["channels"]):
+ print(f"plr-ivoryos: a simulated {self._label()} cannot have all that its equipment says "
+ f"({', '.join(left_out) or 'those channels'}); it has what PyLabRobot's recording of one has "
+ "instead.")
elif wanted:
self._config["equipment"] = wanted
else:
@@ -121,16 +211,53 @@ def __init__(self, simulated: bool = False, worktable: Optional[str] = None, dec
def equipment(self) -> Dict[str, Any]:
return dict(self._config.get("equipment") or {})
+ def _kind(self) -> str:
+ return self._config.get("deck_type") or self.KINDS[0]
+
def _fresh_deck(self):
- return worktable.make_deck(self._config.get("deck_type") or self.KINDS[0])
+ return worktable.make_deck(self._kind())
+
+ def _simulated_equipment(self, given: Dict[str, Any], fit: bool = False) -> Dict[str, Any]:
+ """What a simulated STAR of this frame has: what `given` says, the rest as the frame's
+ recording has it. `fit`: what this frame cannot have (16 channels on a STARlet, after
+ switching frames) becomes what its recording has, instead of refused."""
+ kind, given = self._kind(), dict(given or {})
+ has384 = FRAMES[kind][2] is not None
+ if given.get("head384") and not has384:
+ if not fit:
+ _recording(kind, True) # says why
+ given.update(head384=False, head96=True)
+ recorded = recorded_equipment(kind, bool(given.get("head384")))
+ if given.get("head384"):
+ given["head96"] = False
+ elif given.get("head96"):
+ given["head384"] = False
+ given.pop("pipettes", None)
+ given.pop("core_grippers", None) # the channels decide these
+ wanted = {**recorded, **given}
+ if wanted.get("channels") is None:
+ wanted["channels"] = recorded["channels"]
+ out = check_equipment(wanted)
+ problems = []
+ if out["channels"] not in CHANNELS[kind]:
+ problems.append(("channels", f"a simulated {worktable.DECKS.get(kind, kind)} has "
+ f"{', '.join(map(str, CHANNELS[kind]))} channels, not {out['channels']}"))
+ for part in ("iswap", "autoload"):
+ if out[part] and not recorded[part]:
+ problems.append((part, f"PyLabRobot's recording of a {worktable.DECKS.get(kind, kind)} has no "
+ f"{'iSWAP' if part == 'iswap' else 'autoload'} to simulate"))
+ if problems and not fit:
+ text = "; ".join(why for _, why in problems)
+ raise ValueError(text[0].upper() + text[1:] + ".")
+ if problems:
+ return check_equipment({**out, **{part: recorded[part] for part, _ in problems}})
+ return out
def _make_plr(self, deck):
- frame, recording, recording384 = FRAMES[self._config.get("deck_type") or self.KINDS[0]]
+ frame = FRAMES[self._kind()][0]
if self._simulated:
- if getattr(self, "_head384", False) and recording384 is None:
- raise ValueError("PyLabRobot has no recording of this frame with a 384-head to simulate.")
- driver = STARSimulationDriver(deck=deck, declared_configuration_json=recording384 if self._head384
- else recording)
+ driver = STARSimulationDriver(deck=deck, declared_configuration_json=simulated_configuration(
+ self._kind(), self.equipment or recorded_equipment(self._kind())))
else:
driver = STARDriver(device_address=self._device_address, serial_number=self._serial_number, deck=deck)
return frame(deck=deck, driver=driver)
@@ -159,7 +286,10 @@ async def _connect(self) -> None:
await self._plr.setup()
fitted, problems = _fitted(self._plr), []
for part, wanted in self.equipment.items():
- if wanted and not fitted[part]:
+ if part == "channels":
+ if wanted != fitted["channels"]:
+ problems.append(f"it has {fitted['channels']} channels (the file says {wanted})")
+ elif wanted and not fitted[part]:
problems.append(f"there is no {part} (the file says there is)")
if problems:
await self._plr.stop()
@@ -173,6 +303,8 @@ def _plr_target(self):
return self._plr.driver
def _attach_deck(self, deck) -> None:
+ if self._simulated: # another frame, perhaps: what it cannot have becomes what its recording has
+ self._config["equipment"] = self._simulated_equipment(self._config.get("equipment") or {}, fit=True)
self._plr = self._make_plr(deck) # PyLabRobot 1.0 makes the deck a child of the device
def _checked(self, config: dict) -> dict:
@@ -181,6 +313,11 @@ def _checked(self, config: dict) -> dict:
config["equipment"] = check_equipment(config.get("equipment") or self.equipment)
return config
+ def _parts_read(self) -> Any:
+ # The instruments a STAR is split into are made from what is fitted; how many channels
+ # the channels instrument drives is read when it runs.
+ return sorted((part, str(on)) for part, on in self.equipment.items() if part != "channels")
+
def setup(self) -> None:
"""Connect and initialize the STAR, and find what is fitted, checking it against the
worktable file. Any other step does this itself the first time. (PyLabRobot: STAR.setup)"""
@@ -193,7 +330,45 @@ def stop(self) -> None:
self._ready = False
def _deck_extras(self) -> dict:
- return {"equipment": {part: True for part, on in self.equipment.items() if on}}
+ return {"equipment": {part: True for part, on in self.equipment.items() if on and part != "channels"}}
+
+ def _equipment_fields(self) -> List[dict]:
+ kind, now = self._kind(), self.equipment
+ channels = sorted(set(CHANNELS[kind]) | ({now["channels"]} if now.get("channels") else set()))
+ heads = [("96", "96-head")] + ([("384", "384-head")] if FRAMES[kind][2] is not None or now.get("head384") else [])
+ head = "384" if now.get("head384") else "96" if now.get("head96") else None
+ fields = [choice("channels", "Channels", now.get("channels"), [(n, n) for n in channels]),
+ choice("head", "Head", head, heads, none="none"),
+ toggle("iswap", "iSWAP", now.get("iswap"))]
+ if not self._simulated or recorded_equipment(kind)["autoload"]:
+ fields.append(toggle("autoload", "Autoload", now.get("autoload")))
+ return fields
+
+ def _equipment_fixed(self) -> Optional[str]:
+ if not self._simulated:
+ return "As the STAR reported it: its channels and heads are built into it."
+ return None
+
+ def _edit_equipment(self, change: dict) -> str:
+ """What a simulated STAR has: channels (a number CHANNELS offers), head (96, 384 or none),
+ iswap and autoload (true or false). A real STAR's are built into it, and read from it."""
+ if not self._simulated:
+ raise ValueError(f"{self._equipment_fixed()} Change it in {self._path} only if the STAR itself changed.")
+ now = self.equipment
+ given = {part: now.get(part) for part in ("channels", "head96", "head384", "iswap", "autoload")}
+ if "channels" in change:
+ given["channels"] = change["channels"]
+ if "head" in change:
+ head = str(change["head"])
+ if head not in ("96", "384", "none", ""):
+ raise ValueError(f"A STAR's head is a 96-head, a 384-head or none, not '{head}'.")
+ given.update(head96=head == "96", head384=head == "384")
+ for part in ("iswap", "autoload"):
+ if part in change:
+ given[part] = _yes(change[part])
+ self._config["equipment"] = self._simulated_equipment(given)
+ self._plr = self._make_plr(self.deck)
+ return "equipment"
# --- the parts ----------------------------------------------------------------------------------------
diff --git a/plr_ivoryos/labware_view/page/index.html b/plr_ivoryos/labware_view/page/index.html
index e517b5d..9987e80 100644
--- a/plr_ivoryos/labware_view/page/index.html
+++ b/plr_ivoryos/labware_view/page/index.html
@@ -76,6 +76,9 @@
.def { display: block; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 3px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; cursor: grab; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; touch-action: none; }
.def:hover { background: var(--soft); }
.def.on { background: var(--accent-soft); color: var(--accent-fg); border-color: var(--accent); }
+ #peek { position: fixed; z-index: 10; pointer-events: none; padding: 4px 8px; border-radius: 6px; background: var(--ink); color: var(--bg); font: 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; transform: translate(12px, 14px); }
+ .fitted { border: none; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
+ .fitted:hover { color: var(--accent-fg); }
#ghost { position: fixed; z-index: 10; pointer-events: none; padding: 3px 8px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font: 600 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; box-shadow: 0 4px 14px rgba(0,0,0,.18); transform: translate(10px, 10px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 6px 2px 10px; font-size: 12px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 5px; }
@@ -106,10 +109,15 @@
.fixture.movable { cursor: grab; }
.fixture-name { fill: var(--muted); font-size: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; pointer-events: none; }
.trash { fill: var(--fixture); stroke: var(--ware-line); stroke-width: .6; stroke-dasharray: 1.5 1.5; }
- .ware { fill: var(--ware); stroke: var(--ware-line); stroke-width: .8; cursor: pointer; }
- .editing .ware.movable { cursor: grab; }
+ .ware { fill: var(--ware); stroke: var(--ware-line); stroke-width: .8; }
+ /* A labware is one thing to the pointer: clicked anywhere to look closer, grabbed anywhere to move. */
+ .labware { cursor: zoom-in; }
+ .labware:not(.open):hover .ware { stroke: var(--accent); }
+ .editing .labware.movable { cursor: grab; }
+ .labware.open { cursor: default; }
+ body.dragging, body.dragging * { cursor: grabbing !important; }
.ware.sel { stroke: var(--accent); stroke-width: 1.6; }
- .ware.lifted, .fixture.lifted { opacity: .35; }
+ .labware.lifted, .fixture.lifted { opacity: .35; }
.ware-name { fill: var(--ink); font-size: 5px; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; pointer-events: none; }
.ware-site { fill: var(--muted); font-size: 4.6px; text-anchor: end; pointer-events: none; }
.remove { cursor: pointer; }
@@ -143,6 +151,7 @@
}
const layout = layouts[current], state = (states[current] || {}).labware || {};
$("title").textContent = current;
- // What is fitted (a pipette per mount, a 96-head, a gripper, an iSWAP, ...): each one is an
- // instrument of its own. A pipette is named; a part that is simply there is listed.
- const fitted = layout.deck.equipment || {}, fittedLabels = fitted.labels || {};
- const mounted = Object.keys(fitted).filter(k => k !== "labels" && k !== "trash" && fitted[k])
- .map(k => fitted[k] === true ? k.replace(/_/g, " ") : `${k}: ${fittedLabels[k] || fitted[k]}`);
- $("kind").textContent = (layout.deck.label || layout.deck.kind) + (layout.deck.simulated ? " · simulated" : "")
- + (mounted.length ? " · " + mounted.join(", ") : "");
+ // What is fitted (a pipette per mount, a 96-head, a gripper, an iSWAP, ...), said by the robot.
+ // Clicked, it opens where it is changed (or, on a robot whose parts are built in, shown).
+ const fitted = (layout.deck.equipment_summary || []).join(", ");
+ $("kind").innerHTML = esc((layout.deck.label || layout.deck.kind) + (layout.deck.simulated ? " · simulated" : ""))
+ + (fitted ? " · " + (offered.equipment ? `` : esc(fitted)) : "");
$("layoutline").innerHTML = layoutLine(layout.deck.layout);
if (zoomed && !layout.labware[zoomed]) zoomed = null;
@@ -285,10 +292,15 @@
Labware
if (!s.holds && s.w > 40) svg += `${esc(String(s.label).replace(/^.*-/, ""))}`;
}
const choosing = editing && focus && holdsLiquid(focus);
+ const after = []; // drawn over every labware: the × that takes one off
for (const [name, ware] of Object.entries(layout.labware)) {
const held = state[name] || {}, tips = ware.category === "tip_rack";
- const wy = Y(ware.y, ware.h);
- svg += ``;
+ const wy = Y(ware.y, ware.h), open = zoomed === name;
+ // Seen whole, a labware is one thing (its name and what it holds); looked at closely, each
+ // well or tip says what it holds as the pointer passes over it.
+ svg += ``
+ + (open ? "" : `${esc(name)} · ${esc(summaryOf(ware, held))}`);
+ svg += ``;
ware.grid.forEach((row, r) => row.forEach((id, c) => {
const spot = ware.spots[id];
if (!spot) return;
@@ -299,23 +311,24 @@
Labware
const pick = choosing && zoomed === name ? `data-well="${esc(id)}" data-r="${r}" data-c="${c}"` : "";
if (tips) {
const rr = Math.min(3.1, ware.w / (ware.grid[0].length * 2.9));
- svg += `${esc(name)}[${esc(id)}] · ${here.tip === false ? "used" : "tip"}`;
+ const info = open ? `data-info="${esc(name)}[${esc(id)}] · ${here.tip === false ? "no tip" : "tip"}"` : "";
+ svg += ``;
if (active) svg += ``;
return;
}
const volume = here.volume_ul || 0, full = ware.max_volume_ul ? Math.min(1, volume / ware.max_volume_ul) : (volume ? 1 : 0);
const parts = Object.entries(here.liquids || {}).map(([l, v]) => `${l} ${fmt(v)}`).join(", ");
- const label = `${esc(name)}[${esc(id)}] · ${volume ? `${fmt(volume)} µL${parts ? ` (${esc(parts)})` : ""}` : "empty"}`;
+ const info = open ? `data-info="${esc(name)}[${esc(id)}] · ${volume ? `${fmt(volume)} µL${parts ? ` (${esc(parts)})` : ""}` : "empty"}"` : "";
const chosen = choosing && zoomed === name && picked.has(id);
if (round) {
const rr = Math.min(w, h) / 2;
- svg += `${label}`;
+ svg += ``;
if (volume) svg += ``;
if (active) svg += ``;
if (chosen) svg += ``;
} else {
const x = ware.x + dx, y = top - (ware.y + dy + h);
- svg += `${label}`;
+ svg += ``;
// Seen from above a trough has no level to show, so how full it is is how much of it is tinted.
if (volume) svg += ``;
if (active) svg += ``;
@@ -324,8 +337,10 @@
Labware
}));
svg += `${esc(name)}`;
if (ware.site && !(editing && ware.editable)) svg += `${esc(String(ware.site).replace(/^.*-/, "#"))}`;
- if (editing && ware.editable && !focus) svg += removeMark(name, ware.x + ware.w - 4.5, wy + 4.5);
+ svg += ``;
+ if (editing && ware.editable && !focus) after.push(removeMark(name, ware.x + ware.w - 4.5, wy + 4.5));
}
+ svg += after.join("");
// Where a dragged carrier would go: drawn on top, moved as the pointer moves.
svg += ``;
$("stage").innerHTML = ``
@@ -338,14 +353,7 @@