Beispiel #1
0
def test_rebin_smaller():
    ccd_data = ccd_data_func(data_size=10)
    a = ccd_data.data
    with catch_warnings(AstropyDeprecationWarning) as w:
        b = rebin(a, (20, 20))
        c = rebin(b, (10, 10))
    assert len(w) >= 1

    assert c.shape == (10, 10)
    assert (c - a).sum() == 0
Beispiel #2
0
def test_rebin_does_not_change_input():
    ccd_data = ccd_data_func()
    original = ccd_data.copy()
    with catch_warnings(AstropyDeprecationWarning) as w:
        _ = rebin(ccd_data, (20, 20))
    assert len(w) >= 1
    np.testing.assert_array_equal(original.data, ccd_data.data)
    assert original.unit == ccd_data.unit
Beispiel #3
0
def test_rebin_larger():
    ccd_data = ccd_data_func(data_size=10)
    a = ccd_data.data
    with catch_warnings(AstropyDeprecationWarning) as w:
        b = rebin(a, (20, 20))
    assert len(w) >= 1

    assert b.shape == (20, 20)
    np.testing.assert_almost_equal(b.sum(), 4 * a.sum())
Beispiel #4
0
def test_rebin_ccddata(mask_data, uncertainty):
    ccd_data = ccd_data_func(data_size=10)
    if mask_data:
        ccd_data.mask = np.zeros_like(ccd_data)
    if uncertainty:
        err = np.random.normal(size=ccd_data.shape)
        ccd_data.uncertainty = StdDevUncertainty(err)

    with catch_warnings(AstropyDeprecationWarning) as w:
        b = rebin(ccd_data, (20, 20))
    assert len(w) >= 1

    assert b.shape == (20, 20)
    if mask_data:
        assert b.mask.shape == (20, 20)
    if uncertainty:
        assert b.uncertainty.array.shape == (20, 20)
Beispiel #5
0
def test_rebin_ccddata_dimensions():
    ccd_data = ccd_data_func(data_size=10)
    with pytest.raises(ValueError), catch_warnings(AstropyDeprecationWarning):
        rebin(ccd_data, (5, ))
Beispiel #6
0
def test_rebin_ndarray():
    with pytest.raises(TypeError), catch_warnings(AstropyDeprecationWarning):
        rebin(1, (5, 5))