當前位置: 首頁>>代碼示例>>Python>>正文


Python CCDData.divide方法代碼示例

本文整理匯總了Python中astropy.nddata.ccddata.CCDData.divide方法的典型用法代碼示例。如果您正苦於以下問題:Python CCDData.divide方法的具體用法?Python CCDData.divide怎麽用?Python CCDData.divide使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在astropy.nddata.ccddata.CCDData的用法示例。


在下文中一共展示了CCDData.divide方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_arithmetic_with_wcs_compare_fail

# 需要導入模塊: from astropy.nddata.ccddata import CCDData [as 別名]
# 或者: from astropy.nddata.ccddata.CCDData import divide [as 別名]
def test_arithmetic_with_wcs_compare_fail():
    def return_diff_smaller_1(first, second):
        return abs(first - second) <= 1

    ccd1 = CCDData(np.ones((10, 10)), unit='', wcs=2)
    ccd2 = CCDData(np.ones((10, 10)), unit='', wcs=5)
    with pytest.raises(ValueError):
        ccd1.add(ccd2, compare_wcs=return_diff_smaller_1).wcs
    with pytest.raises(ValueError):
        ccd1.subtract(ccd2, compare_wcs=return_diff_smaller_1).wcs
    with pytest.raises(ValueError):
        ccd1.multiply(ccd2, compare_wcs=return_diff_smaller_1).wcs
    with pytest.raises(ValueError):
        ccd1.divide(ccd2, compare_wcs=return_diff_smaller_1).wcs
開發者ID:Cadair,項目名稱:astropy,代碼行數:16,代碼來源:test_ccddata.py

示例2: test_arithmetic_with_wcs_compare

# 需要導入模塊: from astropy.nddata.ccddata import CCDData [as 別名]
# 或者: from astropy.nddata.ccddata.CCDData import divide [as 別名]
def test_arithmetic_with_wcs_compare():
    def return_diff_smaller_3(first, second):
        return abs(first - second) <= 3

    ccd1 = CCDData(np.ones((10, 10)), unit='', wcs=2)
    ccd2 = CCDData(np.ones((10, 10)), unit='', wcs=5)
    assert ccd1.add(ccd2, compare_wcs=return_diff_smaller_3).wcs == 2
    assert ccd1.subtract(ccd2, compare_wcs=return_diff_smaller_3).wcs == 2
    assert ccd1.multiply(ccd2, compare_wcs=return_diff_smaller_3).wcs == 2
    assert ccd1.divide(ccd2, compare_wcs=return_diff_smaller_3).wcs == 2
開發者ID:Cadair,項目名稱:astropy,代碼行數:12,代碼來源:test_ccddata.py

示例3: test_arithmetic_overload_differing_units

# 需要導入模塊: from astropy.nddata.ccddata import CCDData [as 別名]
# 或者: from astropy.nddata.ccddata.CCDData import divide [as 別名]
def test_arithmetic_overload_differing_units():
    a = np.array([1, 2, 3]) * u.m
    b = np.array([1, 2, 3]) * u.cm
    ccddata = CCDData(a)

    # TODO: Could also be parametrized.
    res = ccddata.add(b)
    np.testing.assert_array_almost_equal(res.data, np.add(a, b).value)
    assert res.unit == np.add(a, b).unit

    res = ccddata.subtract(b)
    np.testing.assert_array_almost_equal(res.data, np.subtract(a, b).value)
    assert res.unit == np.subtract(a, b).unit

    res = ccddata.multiply(b)
    np.testing.assert_array_almost_equal(res.data, np.multiply(a, b).value)
    assert res.unit == np.multiply(a, b).unit

    res = ccddata.divide(b)
    np.testing.assert_array_almost_equal(res.data, np.divide(a, b).value)
    assert res.unit == np.divide(a, b).unit
開發者ID:Cadair,項目名稱:astropy,代碼行數:23,代碼來源:test_ccddata.py

示例4: test_arithmetic_divide_with_array

# 需要導入模塊: from astropy.nddata.ccddata import CCDData [as 別名]
# 或者: from astropy.nddata.ccddata.CCDData import divide [as 別名]
def test_arithmetic_divide_with_array():
    ccd = CCDData(np.ones((3, 3)), unit=u.m)
    res = ccd.divide(np.ones((3, 3)) * 2)
    np.testing.assert_array_equal(res.data, [[0.5, 0.5, 0.5]] * 3)
    assert res.unit == ccd.unit
開發者ID:Cadair,項目名稱:astropy,代碼行數:7,代碼來源:test_ccddata.py

示例5: test_arithmetic_no_wcs_compare

# 需要導入模塊: from astropy.nddata.ccddata import CCDData [as 別名]
# 或者: from astropy.nddata.ccddata.CCDData import divide [as 別名]
def test_arithmetic_no_wcs_compare():
    ccd = CCDData(np.ones((10, 10)), unit='')
    assert ccd.add(ccd, compare_wcs=None).wcs is None
    assert ccd.subtract(ccd, compare_wcs=None).wcs is None
    assert ccd.multiply(ccd, compare_wcs=None).wcs is None
    assert ccd.divide(ccd, compare_wcs=None).wcs is None
開發者ID:Cadair,項目名稱:astropy,代碼行數:8,代碼來源:test_ccddata.py


注:本文中的astropy.nddata.ccddata.CCDData.divide方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。