Skip to content
Back to top
View this page

# wcs_from_points

gwcs.wcstools.wcs_from_points(xy, world_coords, proj_point='center', projection=None, poly_degree=4, polynomial_type='polynomial')

  Given two matching sets of coordinates on detector and sky, compute the WCS.

  Parameters:
    xy tuple of 2 ndarrays

      Points in the input coordinate frame - x, y inputs.

    world_coords `SkyCoord`

      Points in the output coordinate frame. The order matches the order of `xy`.

    proj_point `SkyCoord`

      A fiducial point in the output coordinate frame. If set to ‘center’ (default), the geometric center of input world coordinates will be used as the projection point. To specify an exact point for the projection, a Skycoord object with a coordinate pair can be passed in.

    projection `Projection`

      A projection type. One of the projections in `projcodes`. The direction is from sky to detector. Defaults to TAN projection (`astropy.modeling.projections.Sky2Pix_TAN`).

    poly_degree int

      Degree of polynomial model to be fit to data. Defaults to 4.

    polynomial_type str

      one of “polynomial”, “chebyshev”, “legendre”. Defaults to “polynomial”.

  Returns:
    wcsobj `WCS`

      a WCS object for this observation.

  Notes

  This function implements the following algorithm: `world_coords` are transformed to a projection plane using the specified projection. A polynomial fits `xy` and the projected coordinates. The fitted polynomials and the projection transforms are combined into a transform from detector to sky. The input coordinate frame is set to `detector`. The output coordinate frame is initialized based on the frame in the fiducial.