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
# -----------------------------------------------------------------
评论列表
文章目录