Skip to content

Commit

Permalink
rev shaker
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-ray committed Dec 28, 2024
1 parent 9598c07 commit 3669c0b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pylabrobot/shaking/shaker.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import asyncio
from typing import Optional

from pylabrobot.heating_shaking.backend import HeaterShakerBackend
from pylabrobot.heating_shaking.chatterbox import HeaterShakerChatterboxBackend
from pylabrobot.machines.machine import Machine
from pylabrobot.resources.resource_holder import ResourceHolder
from pylabrobot.shaking.chatterbox import ShakerChatterboxBackend

from .backend import ShakerBackend


class Shaker(ResourceHolder, Machine):
Expand All @@ -16,8 +17,8 @@ def __init__(
size_x: float,
size_y: float,
size_z: float,
backend: HeaterShakerBackend,
category: str = "heatershaker",
backend: ShakerBackend,
category: str = "shaker",
model: Optional[str] = None,
):
ResourceHolder.__init__(
Expand All @@ -30,7 +31,7 @@ def __init__(
model=model,
)
Machine.__init__(self, backend=backend)
self.backend: HeaterShakerBackend = backend # fix type
self.backend: ShakerBackend = backend # fix type

async def shake(self, speed: float, duration: Optional[float] = None):
"""Shake the shaker at the given speed
Expand All @@ -42,7 +43,7 @@ async def shake(self, speed: float, duration: Optional[float] = None):
await self.backend.lock_plate()
await self.backend.shake(speed=speed)

if duration is None or isinstance(self.backend, HeaterShakerChatterboxBackend):
if duration is None or isinstance(self.backend, ShakerChatterboxBackend):
return

await asyncio.sleep(duration)
Expand Down

0 comments on commit 3669c0b

Please sign in to comment.