Ejemplo n.º 1
0
def test_observation_s2n(image_data):
    obs = Observation(image=image_data['image'], weight=image_data['weight'])
    s2n = obs.get_s2n()

    s2n_true = (np.sum(image_data['image']) /
                np.sqrt(np.sum(1.0 / image_data['weight'])))

    assert np.allclose(s2n, s2n_true)
Ejemplo n.º 2
0
def test_observation_s2n(image_data):
    obs = Observation(image=image_data['image'], weight=image_data['weight'])
    s2n = obs.get_s2n()

    s2n_true = (np.sum(image_data['image']) /
                np.sqrt(np.sum(1.0 / image_data['weight'])))

    assert np.allclose(s2n, s2n_true)

    # if we are not storing pixels, when we can have an all zero weight map
    # in this case s2n is -9999
    obs = Observation(
        image=image_data['image'],
        weight=np.zeros_like(obs.weight),
        store_pixels=False,
    )
    assert np.allclose(obs.get_s2n(), -9999)