Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if 'tube-rack-5x12' not in labware.list():
labware.create(
'tube-rack-5x12',
grid=(12, 5),
spacing=(20, 20),
diameter=16,
depth=90)
# labware setup
trough1 = labware.load('trough-12row', '7')
sample_rack = labware.load('tube-rack-5x12', '4')
tiprack_50 = labware.load('tiprack-200ul', '8')
tiprack_1000 = labware.load('tiprack-1000ul', '9')
# pipette setup
p50 = instruments.P50_Single(
mount='left',
tip_racks=[tiprack_50]
)
p1000 = instruments.P1000_Single(
mount='right',
tip_racks=[tiprack_1000]
)
def run_custom_protocol(
number_of_samples: int=10
):
# number of racks for serial dilutions
rack_num = number_of_samples // 12 + (
def run_custom_protocol(
pipette_type: StringSelection(
'p300-Single', 'p300-Multi', 'p50-Single', 'p50-Multi')='p300-Multi',
dilution_factor: float=1.5,
num_of_dilutions: int=10,
final_volume: float=200.0,
tip_reuse_strategy: StringSelection(
'reuse one tip', 'new tip each time')='reuse one tip'):
pip_name = pipette_type.split('-')
print(pip_name[1])
if pipette_type == 'p300-Single':
pipette = instruments.P300_Single(
mount='left',
tip_racks=[tiprack])
elif pipette_type == 'p50-Single':
pipette = instruments.P50_Single(
mount='left',
tip_racks=[tiprack])
elif pipette_type == 'p300-Multi':
pipette = instruments.P300_Multi(
mount='left',
tip_racks=[tiprack])
elif pipette_type == 'p50-Multi':
pipette = instruments.P50_Multi(
mount='left',
tip_racks=[tiprack])
new_tip = 'never' if tip_reuse_strategy == 'reuse one tip' else 'always'
def test_init(self):
v1 = Vector(1, 2, 3)
v2 = Vector((1, 2, 3))
v3 = Vector({'x': 1, 'y': 2, 'z': 3})
v4 = Vector({'x': 1})
self.assertEqual(v1, (1, 2, 3))
self.assertEqual(v2, (1, 2, 3))
self.assertEqual(v3, (1, 2, 3))
self.assertEqual(v4, Vector(1, 0, 0))
def test_init(self):
v1 = Vector(1, 2, 3)
v2 = Vector((1, 2, 3))
v3 = Vector({'x': 1, 'y': 2, 'z': 3})
v4 = Vector({'x': 1})
self.assertEqual(v1, (1, 2, 3))
self.assertEqual(v2, (1, 2, 3))
self.assertEqual(v3, (1, 2, 3))
self.assertEqual(v4, Vector(1, 0, 0))
'96-flat',
'B1',
'plate'
)
trash = containers.load(
'point',
'C2',
'trash'
)
trough = containers.load(
'trough-12row',
'B2',
'trough'
)
p200 = instruments.Pipette(
name="p200",
trash_container=trash,
tip_racks=[tiprack],
max_volume=200,
min_volume=0.5,
axis="b",
channels=1
)
calibration_data = """
{
"b": {
"blowout": 28.0,
"bottom": 26.0,
"droptip": 32.0,
"resting": 0,
def setUp(self):
Robot.reset_for_tests()
self.robot = Robot.get_instance()
self.robot.connect()
self.plate = containers.load('96-flat', 'A1', 'plate')
self.p200 = instruments.Pipette(name="p200", axis="b")
self.p200.delete_calibration_data()
well = self.plate[0]
pos = well.from_center(x=0, y=0, z=0, reference=self.plate)
self.location = (self.plate, pos)
well_deck_coordinates = well.center(well.get_deck())
dest = well_deck_coordinates + Vector(1, 2, 3)
self.robot.move_head(x=dest['x'], y=dest['y'], z=dest['z'])
self.p200.calibrate_position(self.location)
def test_stop_run(self):
p200 = instruments.Pipette(axis='b', name='my-fancy-pancy-pipette')
p200.calibrate_plunger(top=0, bottom=5, blow_out=6, drop_tip=7)
for i in range(1000):
p200.aspirate().dispense()
res = None
def _run():
nonlocal res
self.assertRaises(RuntimeError, self.robot.run)
thread = threading.Thread(target=_run)
thread.start()
self.robot.stop()
def setUp(self):
self.robot = Robot.reset_for_tests()
self.p200 = instruments.Pipette(axis='b', max_volume=200)
self.plate = containers.load('96-flat', 'C1')
def test_break_down_travel(self):
# with 3-dimensional points
p1 = Vector(0, 0, 0)
p2 = Vector(10, -12, 14)
res = helpers.break_down_travel(
p1, p2, increment=5, mode='absolute')
self.assertEquals(res[-1], p2)
self.assertEquals(len(res), 5)
p1 = Vector(10, -12, 14)
res = helpers.break_down_travel(Vector(0, 0, 0), p1, mode='relative')
expected = Vector(
0.46537410754407676,
-0.5584489290528921,
0.6515237505617075)
self.assertEquals(res[-1], expected)
self.assertEquals(len(res), 5)
def test_add(self):
v1 = Vector(1, 2, 3)
v2 = Vector(4, 5, 6)
res = v1 + v2
self.assertEqual(res, Vector(5, 7, 9))