def test_add_last_half_shutter(): nshutters = 7 shadow = bar.create_empty_shadow_array(nshutters) shadow_element = rn.random_sample((501, 101)) # The actual value of first_row would be a multiple of 500. first_row = 1819 dummy_value = 1.3 shadow[:, :] = dummy_value shadow = bar.add_last_half_shutter(shadow, shadow_element, first_row) assert np.allclose(shadow[0:first_row, :], dummy_value, atol=1.e-10) # This column is the average of 1.3 and shadow_element[0, :]. assert np.allclose(shadow[first_row, :], (dummy_value + shadow_element[0, :]) / 2., atol=1.e-9) first_row += 1 last_row = first_row + 500 assert np.allclose(shadow[first_row:last_row, :], shadow_element[1:, :], atol=1.e-10)
def test_add_first_half_shutter(): nshutters = 3 shadow = bar.create_empty_shadow_array(nshutters) shadow_element = rn.random_sample((501, 101)) shadow = bar.add_first_half_shutter(shadow, shadow_element) assert np.allclose(shadow[0:501, :], shadow_element, atol=1.e-10)
def test_create_empty_shadow_array(): nshutters = 3 shadow = bar.create_empty_shadow_array(nshutters) assert shadow.shape == (2000, 101) assert shadow.min() == 0. assert shadow.max() == 0.