Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def to_pixel(self, wcs):
center, scale, _ = skycoord_to_pixel_scale_angle(self.center, wcs)
radius = self.radius.to('deg').value * scale
return CirclePixelRegion(center, radius, self.meta, self.visual)
def to_sky(self, wcs):
# TODO: write a pixel_to_skycoord_scale_angle
center = pixel_to_skycoord(self.center.x, self.center.y, wcs)
_, scale, _ = skycoord_to_pixel_scale_angle(center, wcs)
radius = Angle(self.radius / scale, 'deg')
return CircleSkyRegion(center, radius, self.meta, self.visual)
def to_sky(self, wcs):
center = pixel_to_skycoord(self.center.x, self.center.y, wcs)
_, scale, _ = skycoord_to_pixel_scale_angle(center, wcs)
inner_radius = self.inner_radius / scale * u.deg
outer_radius = self.outer_radius / scale * u.deg
return CircleAnnulusSkyRegion(
center, inner_radius, outer_radius, self.meta, self.visual
)
def to_sky(self, wcs):
# TODO: write a pixel_to_skycoord_scale_angle
center = pixel_to_skycoord(self.center.x, self.center.y, wcs)
_, scale, north_angle = skycoord_to_pixel_scale_angle(center, wcs)
width = Angle(self.width / scale, 'deg')
height = Angle(self.height / scale, 'deg')
return RectangleSkyRegion(center, width, height,
angle=self.angle - (north_angle - 90 * u.deg),
meta=self.meta, visual=self.visual)
def to_sky_args(self, wcs):
center = pixel_to_skycoord(self.center.x, self.center.y, wcs)
_, scale, north_angle = skycoord_to_pixel_scale_angle(center, wcs)
inner_width = self.inner_width / scale * u.deg
inner_height = self.inner_height / scale * u.deg
outer_width = self.outer_width / scale * u.deg
outer_height = self.outer_height / scale * u.deg
angle = self.angle - (north_angle - 90 * u.deg)
return center, inner_width, inner_height, outer_width, outer_height, angle
def to_pixel(self, wcs):
center, scale, north_angle = skycoord_to_pixel_scale_angle(self.center, wcs)
# FIXME: The following line is needed to get a scalar PixCoord
center = PixCoord(float(center.x), float(center.y))
width = self.width.to('deg').value * scale
height = self.height.to('deg').value * scale
return RectanglePixelRegion(center, width, height,
angle=self.angle + (north_angle - 90 * u.deg),
meta=self.meta, visual=self.visual)
def to_pixel(self, wcs):
center, scale, _ = skycoord_to_pixel_scale_angle(self.center, wcs)
# FIXME: The following line is needed to get a scalar PixCoord
center = PixCoord(float(center.x), float(center.y))
inner_radius = self.inner_radius.to("deg").value * scale
outer_radius = self.outer_radius.to("deg").value * scale
return CircleAnnulusPixelRegion(
center, inner_radius, outer_radius, self.meta, self.visual
)
def to_sky(self, wcs):
# TODO: write a pixel_to_skycoord_scale_angle
center = pixel_to_skycoord(self.center.x, self.center.y, wcs)
_, scale, north_angle = skycoord_to_pixel_scale_angle(center, wcs)
height = Angle(self.height / scale, 'deg')
width = Angle(self.width / scale, 'deg')
return EllipseSkyRegion(center, width, height,
angle=self.angle - (north_angle - 90 * u.deg),
meta=self.meta, visual=self.visual)
def to_pixel_args(self, wcs):
center, scale, north_angle = skycoord_to_pixel_scale_angle(self.center, wcs)
center = PixCoord(center.x, center.y)
inner_width = self.inner_width.to("deg").value * scale
inner_height = self.inner_height.to("deg").value * scale
outer_width = self.outer_width.to("deg").value * scale
outer_height = self.outer_height.to("deg").value * scale
angle = self.angle + (north_angle - 90 * u.deg)
return center, inner_width, inner_height, outer_width, outer_height, angle
def to_pixel(self, wcs):
center, scale, north_angle = skycoord_to_pixel_scale_angle(self.center, wcs)
# FIXME: The following line is needed to get a scalar PixCoord
center = PixCoord(float(center.x), float(center.y))
height = self.height.to('deg').value * scale
width = self.width.to('deg').value * scale
return EllipsePixelRegion(center, width, height,
angle=self.angle + (north_angle - 90 * u.deg),
meta=self.meta, visual=self.visual)