Ejemplo n.º 1
0
 def test_sample_location(self):
     # test datatype as 'float'
     sample_location = IA.sample_locations(samples, 24)
     assert len(sample_location) == 24, ' the expected array is not the' +\
         ' lenght. Check input sample array'
     assert isinstance(sample_location['Column'].loc[0],
                       (float, np.float32))
     # test datatype as 'int'
     sample_location = IA.sample_locations(samples, 24, dtype='int')
     assert len(sample_location) == 24, ' the expected array is not the' +\
         ' lenght. Check input sample array'
     assert isinstance(sample_location['Column'].loc[0],
                       (float, np.float32, int, np.int64)),\
         'sample coordinates should be in numeric form'
     assert len(sample_location.columns) == 3, 'the dataframe should ' +\
         'contain 3 columns'
     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