def get_coord_axis2d(self): axis1 = wcs.Axis("axis1Ctype", "axis1Cunit") axis2 = wcs.Axis("axis2Ctype", "axis2Cunit") coord_axis2d = wcs.CoordAxis2D(axis1, axis2) if self.complete: coord_axis2d.error1 = wcs.CoordError(1.0, 1.5) coord_axis2d.error2 = wcs.CoordError(2.0, 2.5) start = wcs.Coord2D(wcs.RefCoord(3.0, 3.5), wcs.RefCoord(4.0, 4.5)) end = wcs.Coord2D(wcs.RefCoord(5.0, 5.5), wcs.RefCoord(6.0, 6.5)) coord_axis2d.range = wcs.CoordRange2D(start, end) dimension = wcs.Dimension2D(7, 8) ref_coord = wcs.Coord2D(wcs.RefCoord(9.0, 9.5), wcs.RefCoord(10.0, 10.5)) coord_axis2d.function = ( wcs.CoordFunction2D(dimension, ref_coord, 11.0, 12.0, 13.0, 14.0)) if self.bounds_is_circle: center = wcs.ValueCoord2D(15.0, 16.0) coord_axis2d.bounds = wcs.CoordCircle2D(center, 17.0) else: polygon = wcs.CoordPolygon2D() polygon.vertices.append(wcs.ValueCoord2D(15.0, 16.0)) polygon.vertices.append(wcs.ValueCoord2D(17.0, 18.0)) polygon.vertices.append(wcs.ValueCoord2D(19.0, 20.0)) coord_axis2d.bounds = polygon return coord_axis2d
def get_test_function(px, py, sx, sy, gal): axis1 = wcs.Axis("RA", "deg") axis2 = wcs.Axis("DEC", "deg") if gal: axis1 = wcs.Axis("GLON", "deg") axis2 = wcs.Axis("GLAT", "deg") axis_2d = wcs.CoordAxis2D(axis1, axis2) spatial_wcs = chunk.SpatialWCS(axis_2d) spatial_wcs.coordsys = "ICRS" wcs.coordsys = "ICRS" if gal: spatial_wcs.coordsys = None wcs.equinox = None # Simple frame set: 1000x1000 pixels, 1 pixel = 1.0e-3 deg dim = wcs.Dimension2D(1000, 1000) ref = wcs.Coord2D(wcs.RefCoord(px, sx), wcs.RefCoord(py, sy)) axis_2d.function = wcs.CoordFunction2D(dim, ref, 1.e-3, 0.0, 0.0, 1.0e-3) return spatial_wcs
def bad_wcs(): axis1 = wcs.Axis("RA---TAN", "deg") axis2 = wcs.Axis("DEC--TAN", "deg") axis = wcs.CoordAxis2D(axis1, axis2) spatial_wcs = chunk.SpatialWCS(axis) spatial_wcs.equinox = None dim = wcs.Dimension2D(1024, 1024) ref = wcs.Coord2D(wcs.RefCoord(512.0, 10.0), wcs.RefCoord(512.0, 20.0)) # Create Invalid function axis.function = wcs.CoordFunction2D(dim, ref, 1.0e-3, 0.0, 0.0, 0.0) # singular CD matrix return spatial_wcs