Пример #1
0
 def test_get_all_children(self):
     c1 = self.generate_plate(4, 2, (5, 5), (0, 0), 5)
     c2 = self.generate_plate(4, 2, (5, 5), (0, 0), 5)
     deck = Deck()
     deck.add(c1, "A1", (0, 0, 0))
     deck.add(c2, "A2", (50, 50, 50))
     self.assertEqual(len(deck.get_all_children()), 10)
Пример #2
0
    def generate_deck(self):
        deck = Deck()
        slot = Slot()
        deck.add(slot, 'A1', (5, 10, 0))
        c = Container()
        red = Well(properties={'radius': 5})
        blue = Well(properties={'radius': 5})
        c.add(red, "Red", (5, 5, 0))
        c.add(blue, "Blue", (15, 5, 0))
        slot.add(c, 'tube_rack')

        return deck
Пример #3
0
    def test_get_name(self):
        deck = Deck()
        slot = Slot()
        c = Container()
        deck.add(slot, 'A1', (0, 0, 0))
        red = Well(properties={'radius': 5})
        blue = Well(properties={'radius': 5})
        c.add(red, "Red", (0, 0, 0))
        c.add(blue, "Blue", (10, 0, 0))
        slot.add(c)

        self.assertEqual(red.get_name(), 'Red')
Пример #4
0
    def test_coordinates(self):
        deck = Deck()
        slot = Slot()
        plate = self.generate_plate(wells=96,
                                    cols=8,
                                    spacing=(10, 15),
                                    offset=(5, 15),
                                    radius=5)
        deck.add(slot, 'B2', (100, 200, 0))
        slot.add(plate)

        self.assertEqual(plate['A1'].coordinates(deck), (105, 215, 0))
Пример #5
0
    def test_max_dimensions(self):
        c1 = self.generate_plate(4, 2, (5, 5), (0, 0), 5)
        c2 = self.generate_plate(4, 2, (5, 5), (0, 0), 5)
        deck = Deck()
        deck.add(c1, "A1", (0, 0, 0))
        deck.add(c2, "A2", (50, 50, 50))

        actual = [(str(i), j) for i, j in deck.max_dimensions(deck)]
        expected = [('<Well A2>', (65.0, 60.0, 50.0)),
                    ('<Well B1>', (60.0, 65.0, 50.0)),
                    ('<Container A2>', (50.0, 50.0, 50.0))]
        self.assertListEqual(actual, expected)
Пример #6
0
    def test_top_bottom(self):
        deck = Deck()
        slot = Slot()
        plate = self.generate_plate(wells=4,
                                    cols=2,
                                    spacing=(10, 10),
                                    offset=(0, 0),
                                    radius=5,
                                    height=10)
        deck.add(slot, 'A1', (0, 0, 0))
        slot.add(plate)

        self.assertEqual(plate['A1'].bottom(10),
                         (plate['A1'], Vector(5, 5, 10)))
        self.assertEqual(plate['A1'].top(10), (plate['A1'], Vector(5, 5, 20)))
Пример #7
0
    def test_well_from_center(self):
        deck = Deck()
        slot = Slot()
        plate = self.generate_plate(wells=4,
                                    cols=2,
                                    spacing=(10, 10),
                                    offset=(0, 0),
                                    radius=5)
        deck.add(slot, 'A1', (0, 0, 0))
        slot.add(plate)

        self.assertEqual(plate['B2'].center(), (5, 5, 0))
        self.assertEqual(plate['B2'].from_center(x=0.0, y=0.0, z=0.0),
                         (5, 5, 0))
        self.assertEqual(
            plate['B2'].from_center(r=1.0, theta=math.pi / 2, h=0.0),
            (5.0, 10.0, 0.0))