当前位置: 首页>>代码示例>>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;未经允许,请勿转载。