sources.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码
def find_contours(data, segments, sigma_level):

    """
    This function ...
    :param data:
    :param segments:
    :param sigma_level:
    :return:
    """

    # Initialize a list for the contours
    contours = []

    # Get the segment properties
    # Since there is only one segment in the source.mask (the center segment), the props
    # list contains only one entry (one galaxy)
    properties_list = source_properties(data, segments)

    for properties in properties_list:

        # Obtain the position, orientation and extent
        position = Position(properties.xcentroid.value, properties.ycentroid.value)
        a = properties.semimajor_axis_sigma.value * sigma_level
        b = properties.semiminor_axis_sigma.value * sigma_level
        angle = properties.orientation.value # in radians
        angle = Angle(angle, u.rad)

        radius = Extent(a, b)

        meta = {"text": str(properties.label)}

        # Create the contour
        contours.append(Ellipse(position, radius, angle, meta=meta))

    # Return the contours
    return contours

# -----------------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号