本文整理汇总了Python中photutils.CircularAperture.to_image方法的典型用法代码示例。如果您正苦于以下问题:Python CircularAperture.to_image方法的具体用法?Python CircularAperture.to_image怎么用?Python CircularAperture.to_image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类photutils.CircularAperture
的用法示例。
在下文中一共展示了CircularAperture.to_image方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: measure_one_median_bg
# 需要导入模块: from photutils import CircularAperture [as 别名]
# 或者: from photutils.CircularAperture import to_image [as 别名]
def measure_one_median_bg(image, center, aperRad, metric, nSig, apMethod='exact'):
"""Class methods are similar to regular functions.
Note:
Do not include the `self` parameter in the ``Args`` section.
Args:
param1: The first parameter.
param2: The second parameter.
Returns:
True if successful, False otherwise.
"""
aperture = CircularAperture(center, aperRad)
aperture = aperture.to_mask(method=apMethod)[0]
aperture = aperture.to_image(image.shape).astype(bool)
backgroundMask = ~aperture
medFrame = median(image[backgroundMask])
madFrame = std(image[backgroundMask])
medianMask= abs(image - medFrame) < nSig*madFrame
maskComb = medianMask*backgroundMask
return median(image[maskComb])
示例2: measure_one_background
# 需要导入模块: from photutils import CircularAperture [as 别名]
# 或者: from photutils.CircularAperture import to_image [as 别名]
def measure_one_background(image, center, aperRad, metric, apMethod='exact', bgMethod='circle'):
"""Class methods are similar to regular functions.
Note:
Do not include the `self` parameter in the ``Args`` section.
Args:
param1: The first parameter.
param2: The second parameter.
Returns:
True if successful, False otherwise.
"""
if np.ndim(aperRad) == 0:
aperture = CircularAperture(center, aperRad)
aperture = aperture.to_mask(method=apMethod)[0] # list of ApertureMask objects (one for each position)
aperture = ~aperture.to_image(image).astype(bool) # inverse to keep 'outside' aperture
else:
innerRad, outerRad = aperRad
innerAperture = CircularAperture(center, innerRad)
outerAperture = CircularAperture(center, outerRad)
inner_aper_mask = innerAperture.to_mask(method=method)[0]
inner_aper_mask = inner_aper_mask.to_image(image.shape).astype(bool)
outer_aper_mask = outerAperture.to_mask(method=method)[0]
outer_aper_mask = outer_aper_mask.to_image(image.shape).astype(bool)
aperture = (~inner_aper_mask)*outer_aper_mask
if bgMethod == 'median':
medFrame = median(image[aperture])
madFrame = scale.mad(image[aperture])
medianMask= abs(image - medFrame) < nSig*madFrame
aperture = medianMask*aperture
if bgMethod == 'kde':
kdeFrame = kde.KDEUnivariate(image[aperture].ravel())
kdeFrame.fit()
return kdeFrame.support[kdeFrame.density.argmax()]
return metric(image[aperture])
示例3: measure_one_KDE_bg
# 需要导入模块: from photutils import CircularAperture [as 别名]
# 或者: from photutils.CircularAperture import to_image [as 别名]
def measure_one_KDE_bg(image, center, aperRad, metric, apMethod='exact'):
"""Class methods are similar to regular functions.
Note:
Do not include the `self` parameter in the ``Args`` section.
Args:
param1: The first parameter.
param2: The second parameter.
Returns:
True if successful, False otherwise.
"""
aperture = CircularAperture(center, aperRad)
aperture = aperture.to_mask(method=apMethod)[0]
aperture = aperture.to_image(image.shape).astype(bool)
backgroundMask = ~aperture
kdeFrame = kde.KDEUnivariate(image[backgroundMask])
kdeFrame.fit()
return kdeFrame.support[kdeFrame.density.argmax()]