Ejemplo n.º 1
0
 def test_edge_detection(self):
     # test canny method
     samples = IA.edge_detection(test_image[12:105, 17:148], 24)
     assert isinstance(samples, list), 'the output should be a list'
     assert len(samples) == 24, \
         'number of samples found exceeds the expected one'
     # test sobel method
     samples = IA.edge_detection(test_image[12:105, 17:148],
                                 24,
                                 method='sobel')
     assert isinstance(samples, list), 'the output should be a list'
     assert len(samples) == 24, \
         'number of samples found exceeds the expected one'
     return
Ejemplo n.º 2
0
 def test_sort_samples(self):
     samples = IA.edge_detection(test_image[12:105, 17:148], 24)
     sample_location = IA.sample_locations(samples, 24)
     sorted = IA.sort_samples(sample_location, 6, 4)
     assert len(sorted) == 24, 'resulting dataframe is not the ' +\
         'correct length'
     assert len(sorted.columns) == 2, 'the dataframe contains extra ' +\
         'columns. Expected number was 2, found {}'.format(
             len(sorted.columns))
     return
Ejemplo n.º 3
0
import unittest

import numpy as np

from phasIR import image_analysis as IA
from unittest.mock import patch

image_file = './doc/data/empty_plates_images/24_conical_empty_plate.png'
video_file = './phasIR/test/data/empty_plate_well_position.HDF5'
test_image = IA.input_file(image_file)
samples = IA.edge_detection(test_image[12:105, 17:148], 24)
sample_location = IA.sample_locations(samples, 24)
sorted = IA.sort_samples(sample_location, 6, 4)
mock_coords = [[1, 13], [24, 25]]


class TestSimulationTools(unittest.TestCase):
    def test_input_file(self):
        '''Test for function which loads the input file'''
        frames = IA.input_file(image_file)
        assert isinstance(frames, np.ndarray), 'Output is not an array'

        frames = IA.input_file(video_file)
        assert isinstance(frames, list), 'Output is not an array'
        return

    def test_flip_frame(self):
        frames = IA.input_file(video_file)
        flipped_frames = IA.flip_frame(frames)
        assert isinstance(flipped_frames, list), 'Output is not an array'
        return