def find_contour(box, mask, sigma_level):
"""
This function ...
:param box:
:param mask:
:param sigma_level:
:return:
"""
props = source_properties(box, mask)
#tbl = properties_table(props)
x_shift = box.x_min
y_shift = box.y_min
# Since there is only one segment in the self.source.mask (the center segment), the props
# list contains only one entry (one galaxy)
if len(props) == 0: return None
properties = props[0]
# Obtain the position, orientation and extent
position = Position(properties.xcentroid.value + x_shift, properties.ycentroid.value + y_shift)
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)
# Create and return the elliptical contour
return Ellipse(position, radius, angle)
# -----------------------------------------------------------------
评论列表
文章目录