def test_find_pixel_neighbourhood_interior(self):
		"""check neighbourhood for pixels not on boundary"""
		pixel_grid_dim = np.array([400, 300])
		pixel_loc = np.array([200, 150])
		expected_neighbours = {
			'left_nbor': np.array([199, 150]),
			'right_nbor': np.array([201, 150]),
			'up_nbor': np.array([200, 149]),
			'down_nbor': np.array([200, 151])
		}
		neighbours = find_pixel_neighbourhood(pixel_loc, pixel_grid_dim)
		self.assert_dict_values_of_numpys_equal(expected_neighbours, neighbours)
	def test_find_pixel_neighbourhood_top_boundary(self):
		"""check neighbourhood for pixels on top boundary
		does not contain a top neighbour."""
		pixel_grid_dim = np.array([400, 300])
		pixel_loc = np.array([200, 0])
		expected_neighbours = {
			'left_nbor': np.array([199, 0]),
			'right_nbor': np.array([201, 0]),			
			'down_nbor': np.array([200, 1])
		}
		neighbours = find_pixel_neighbourhood(pixel_loc, pixel_grid_dim)
		self.assertEqual(expected_neighbours.keys(), neighbours.keys())
		self.assert_dict_values_of_numpys_equal(expected_neighbours, neighbours)
	def test_find_pixel_neighbourhood_right_boundary(self):
		"""check neighbourhood for pixels on right boundary
		does not contain a right neighbour."""
		pixel_grid_dim = np.array([400, 300])
		pixel_loc = np.array([399, 150])
		expected_neighbours = {
			'left_nbor': np.array([398, 150]),
			'up_nbor': np.array([399, 149]),
			'down_nbor': np.array([399, 151])
		}
		neighbours = find_pixel_neighbourhood(pixel_loc, pixel_grid_dim)
		self.assertEqual(expected_neighbours.keys(), neighbours.keys())
		self.assert_dict_values_of_numpys_equal(expected_neighbours, neighbours)
Exemplo n.º 4
0
 def test_find_pixel_neighbourhood_interior(self):
     """check neighbourhood for pixels not on boundary"""
     pixel_grid_dim = np.array([400, 300])
     pixel_loc = np.array([200, 150])
     expected_neighbours = {
         'left_nbor': np.array([199, 150]),
         'right_nbor': np.array([201, 150]),
         'up_nbor': np.array([200, 149]),
         'down_nbor': np.array([200, 151])
     }
     neighbours = find_pixel_neighbourhood(pixel_loc, pixel_grid_dim)
     self.assert_dict_values_of_numpys_equal(expected_neighbours,
                                             neighbours)
Exemplo n.º 5
0
    def test_find_pixel_neighbourhood_top_boundary(self):
        """check neighbourhood for pixels on top boundary
		does not contain a top neighbour."""
        pixel_grid_dim = np.array([400, 300])
        pixel_loc = np.array([200, 0])
        expected_neighbours = {
            'left_nbor': np.array([199, 0]),
            'right_nbor': np.array([201, 0]),
            'down_nbor': np.array([200, 1])
        }
        neighbours = find_pixel_neighbourhood(pixel_loc, pixel_grid_dim)
        self.assertEqual(expected_neighbours.keys(), neighbours.keys())
        self.assert_dict_values_of_numpys_equal(expected_neighbours,
                                                neighbours)
Exemplo n.º 6
0
    def test_find_pixel_neighbourhood_right_boundary(self):
        """check neighbourhood for pixels on right boundary
		does not contain a right neighbour."""
        pixel_grid_dim = np.array([400, 300])
        pixel_loc = np.array([399, 150])
        expected_neighbours = {
            'left_nbor': np.array([398, 150]),
            'up_nbor': np.array([399, 149]),
            'down_nbor': np.array([399, 151])
        }
        neighbours = find_pixel_neighbourhood(pixel_loc, pixel_grid_dim)
        self.assertEqual(expected_neighbours.keys(), neighbours.keys())
        self.assert_dict_values_of_numpys_equal(expected_neighbours,
                                                neighbours)