def plate_grid(self):
     '''numpy.ndarray[int]: IDs of plates arranged according to
     their relative position of the plate within the experiment overview
     image (sorted row-wise by plate names)
     '''
     n = len(self.plates)
     dimensions = guess_stitch_dimensions(n)
     cooridinates = itertools.product(
         range(dimensions[1]), range(dimensions[0])
     )
     grid = np.zeros(dimensions, dtype=int)
     plates = sorted(self.plates, key=lambda p: p.id)
     for i, (x, y) in enumerate(cooridinates):
         try:
             grid[y, x] = plates[i].id
         except IndexError:
             continue
     return grid
def test_guess_stitch_dimensions_73_vertical():
    assert stitch.guess_stitch_dimensions(73, 'vertical') == (15, 5)
def test_guess_stitch_dimensions_22_horizontal():
    assert stitch.guess_stitch_dimensions(22, 'horizontal') == (3, 8)
def test_guess_stitch_dimensions_22_vertical():
    assert stitch.guess_stitch_dimensions(22, 'vertical') == (8, 3)
def test_guess_stitch_dimensions_10_horizontal():
    assert stitch.guess_stitch_dimensions(10, 'horizontal') == (2, 5)
def test_guess_stitch_dimensions_10_vertical():
    assert stitch.guess_stitch_dimensions(10, 'vertical') == (5, 2)
def test_guess_stitch_dimensions_9_horizontal():
    assert stitch.guess_stitch_dimensions(9, 'horizontal') == (3, 3)
def test_guess_stitch_dimensions_1_vertical():
    assert stitch.guess_stitch_dimensions(1, 'vertical') == (1, 1)
def test_guess_stitch_dimensions_9_vertical():
    assert stitch.guess_stitch_dimensions(9, 'vertical') == (3, 3)
def test_guess_stitch_dimensions_8_horizontal():
    assert stitch.guess_stitch_dimensions(8, 'horizontal') == (2, 4)
def test_guess_stitch_dimensions_8_vertical():
    assert stitch.guess_stitch_dimensions(8, 'vertical') == (4, 2)
def test_guess_stitch_dimensions_6_horizontal():
    assert stitch.guess_stitch_dimensions(6, 'horizontal') == (2, 3)
def test_guess_stitch_dimensions_6_vertical():
    assert stitch.guess_stitch_dimensions(6, 'vertical') == (3, 2)
def test_guess_stitch_dimensions_4_horizontal():
    assert stitch.guess_stitch_dimensions(4, 'horizontal') == (2, 2)
def test_guess_stitch_dimensions_73_horizontal():
    assert stitch.guess_stitch_dimensions(73, 'horizontal') == (5, 15)
def test_guess_stitch_dimensions_1_horizontal():
    assert stitch.guess_stitch_dimensions(1, 'horizontal') == (1, 1)
def test_guess_stitch_dimensions_4_vertical():
    assert stitch.guess_stitch_dimensions(4, 'vertical') == (2, 2)