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


Python CircularAperture.to_image方法代碼示例

本文整理匯總了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])
開發者ID:exowanderer,項目名稱:ExoplanetTSO,代碼行數:30,代碼來源:bak_auxiliary.py

示例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])
開發者ID:exowanderer,項目名稱:ExoplanetTSO,代碼行數:50,代碼來源:bak_auxiliary.py

示例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()]
開發者ID:exowanderer,項目名稱:ExoplanetTSO,代碼行數:26,代碼來源:bak_auxiliary.py


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