示例#1
0
    def aspirate(self, volume=None, location=None, rate=1.0):
        def _do_aspirate():
            nonlocal volume
            nonlocal location
            if not isinstance(volume, (int, float, complex)):
                if volume and not location:
                    location = volume
                volume = self.max_volume - self.current_volume

            if self.current_volume + volume > self.max_volume:
                raise RuntimeWarning(
                    'Pipette cannot hold volume {}'
                    .format(self.current_volume + volume)
                )

            self.position_for_aspirate(location)

            self.current_volume += volume
            distance, _ = self.plunge_distance(self.current_volume)
            destination = self.positions['bottom'] - distance

            speed = self.speeds['aspirate'] * rate

            self.plunger.speed(speed)
            self.plunger.move(destination)

        description = "Aspirating {0}uL at {1}".format(
            volume,
            (humanize_location(location) if location else '<In Place>')
        )
        self.robot.add_command(
            Command(do=_do_aspirate, description=description))

        return self
示例#2
0
    def dispense(self, volume=None, location=None, rate=1.0):
        def _do():
            nonlocal location
            nonlocal volume
            if not isinstance(volume, (int, float, complex)):
                if volume and not location:
                    location = volume
                volume = self.current_volume

            if self.current_volume - volume < 0:
                volume = self.current_volume

            if location:
                self.move_to(location, now=True)

            if volume:
                self.current_volume -= volume
                distance, _ = self.plunge_distance(self.current_volume)
                destination = self.positions['bottom'] - distance

                speed = self.speeds['dispense'] * rate

                self.plunger.speed(speed)
                self.plunger.move(destination)

        description = "Dispensing {0}uL at {1}".format(
            volume,
            (humanize_location(location) if location else '<In Place>')
        )
        self.robot.add_command(Command(do=_do, description=description))
        return self
示例#3
0
 def blow_out(self, location=None):
     def _do():
         nonlocal location
         if location:
             self.move_to(location, now=True)
         self.plunger.move(self.positions['blow_out'])
         self.current_volume = 0
     description = "Blow_out at {}".format(
         humanize_location(location) if location else '<In Place>'
     )
     self.robot.add_command(Command(do=_do, description=description))
     return self
示例#4
0
    def drop_tip(self, location=None):
        def _do():
            nonlocal location
            if location:
                self.go_to_bottom(location, now=True)

            self.plunger.move(self.positions['drop_tip'])
            self.plunger.home()
            self.current_volume = 0

        description = "Drop_tip at {}".format(
            (humanize_location(location) if location else '<In Place>'))
        self.robot.add_command(Command(do=_do, description=description))
        return self
示例#5
0
    def pick_up_tip(self, location=None):
        def _do():
            nonlocal location
            if location:
                self.go_to_bottom(location, now=True)

            # TODO: actual plunge depth for picking up a tip
            # varies based on the tip
            # right now it's accounted for via plunge depth
            # TODO: Need to talk about containers z positioning
            tip_plunge = 6

            # Dip into tip and pull it up
            for _ in range(3):
                self.robot.move_head(z=-tip_plunge, mode='relative')
                self.robot.move_head(z=tip_plunge, mode='relative')

            self.robot.home('z')
        description = "Picking up tip from {0}".format(
            (humanize_location(location) if location else '<In Place>')
        )
        self.robot.add_command(Command(do=_do, description=description))
        return self