def test_get_rgb_2d_data(): data_2d = np.ones((10, 10)) rgb_data = bayer.get_rgb_data(data_2d) assert isinstance(rgb_data, np.ma.core.MaskedArray) assert len(rgb_data) == 3 # Red and Blue will add to 25 for a 10x10 data stamp assert rgb_data[0].sum() == 25 assert rgb_data[-1].sum() == 25 assert rgb_data[1].sum() == 50 rgb_data = bayer.get_rgb_data(data_2d, separate_green=True) assert isinstance(rgb_data, np.ma.core.MaskedArray) assert len(rgb_data) == 4 # Red and Blue will add to 25 for a 10x10 data stamp assert rgb_data[0].sum() == 25 assert rgb_data[1].sum() == 25 assert rgb_data[2].sum() == 25 assert rgb_data[3].sum() == 25
def test_get_rgb_4d_data(): data = np.ones((10, 10, 10, 10)) with pytest.raises(TypeError): bayer.get_rgb_data(data)