PixCoord

class regions.PixCoord(x, y)[source]

Bases: object

Pixel coordinates.

This class can represent scalar or array pixel coordinates.

The data members are either numbers or Numpy arrays (not Quantity objects with unit “pixel”).

Given a astropy.wcs.WCS object, it can be transformed to and from a SkyCoord object.

Parameters
xfloat or array-like

Pixel coordinate x value

yfloat or array-like

Pixel coordinate y value

Examples

Usage examples are provided in the Coordinates section of the docs.

Attributes Summary

isscalar

xy

A 2-tuple (x, y) for this coordinate.

Methods Summary

copy()

from_sky(skycoord, wcs[, origin, mode])

Create PixCoord from SkyCoord.

rotate(center, angle)

Make a rotated pixel coordinate.

separation(other)

Separation to another pixel coordinate.

to_sky(wcs[, origin, mode])

Convert this PixCoord to SkyCoord.

Attributes Documentation

isscalar
xy

A 2-tuple (x, y) for this coordinate.

Methods Documentation

copy()[source]
classmethod from_sky(skycoord, wcs, origin=0, mode='all')[source]

Create PixCoord from SkyCoord.

Calls astropy.coordinates.SkyCoord.to_pixel(). See parameter description there.

rotate(center, angle)[source]

Make a rotated pixel coordinate.

Rotates counter-clockwise for positive angle.

Parameters
centerPixCoord

Rotation center point

angleAngle

Rotation angle

Returns
coordPixCoord

Rotated coordinates (an independent copy)

separation(other)[source]

Separation to another pixel coordinate.

This is the two-dimensional cartesian separation \(d\) with

\[d = \sqrt{(x_1 - x_2) ^ 2 + (y_1 - y_2) ^ 2}\]
Parameters
otherPixCoord

Other pixel coordinate

Returns
separationnumpy.array

Separation in pixels

to_sky(wcs, origin=0, mode='all')[source]

Convert this PixCoord to SkyCoord.

Calls astropy.coordinates.SkyCoord.from_pixel(). See parameter description there.