Esempio n. 1
0
def test_sum_samples_around_peak(camera_waveforms):
    waveforms, _ = camera_waveforms
    n_pixels, n_samples = waveforms.shape
    rand = np.random.RandomState(1)
    peak_index = rand.uniform(0, n_samples, n_pixels).astype(np.int)
    charge = sum_samples_around_peak(waveforms, peak_index, 7, 3)
    assert_allclose(charge[0], 146.022991, rtol=1e-3)
Esempio n. 2
0
def test_sum_samples_around_peak(camera_waveforms):
    waveforms, _ = camera_waveforms
    _, n_pixels, n_samples = waveforms.shape
    rand = np.random.RandomState(1)
    peak_index = rand.uniform(0, n_samples, (2, n_pixels)).astype(np.int)
    charge = sum_samples_around_peak(waveforms, peak_index, 7, 3)

    assert_allclose(charge[0][0], 146.022991, rtol=1e-3)
    assert_allclose(charge[1][0], 22.393974, rtol=1e-3)
Esempio n. 3
0
def test_sum_samples_around_peak_expected(camera_waveforms):
    waveforms, _ = camera_waveforms
    waveforms = np.ones(waveforms.shape)
    n_samples = waveforms.shape[-1]

    peak_index = 0
    width = 10
    shift = 0
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 10)

    peak_index = 0
    width = 10
    shift = 10
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 0)

    peak_index = 0
    width = 20
    shift = 10
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 10)

    peak_index = n_samples
    width = 10
    shift = 0
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 0)

    peak_index = n_samples
    width = 20
    shift = 10
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 10)

    peak_index = 0
    width = n_samples * 3
    shift = n_samples
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, n_samples)
Esempio n. 4
0
def test_sum_samples_around_peak_expected(camera_waveforms):
    waveforms, _ = camera_waveforms
    waveforms = np.ones(waveforms.shape)
    n_samples = waveforms.shape[-1]

    peak_index = 0
    width = 10
    shift = 0
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 10)

    peak_index = 0
    width = 10
    shift = 10
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 0)

    peak_index = 0
    width = 20
    shift = 10
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 10)

    peak_index = n_samples
    width = 10
    shift = 0
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 0)

    peak_index = n_samples
    width = 20
    shift = 10
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, 10)

    peak_index = 0
    width = n_samples*3
    shift = n_samples
    charge = sum_samples_around_peak(waveforms, peak_index, width, shift)
    assert_equal(charge, n_samples)