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
Esempio n. 2
0
    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
Esempio n. 3
0
    def get_poly_position(self):
        position = plane.Position()

        if self.caom_version >= 23:
            v0 = shape.Vertex(0.0, 0.0, shape.SegmentType.MOVE)
            v1 = shape.Vertex(1.0, 2.0, shape.SegmentType.LINE)
            v2 = shape.Vertex(2.0, 3.0, shape.SegmentType.LINE)
            v3 = shape.Vertex(3.0, 4.0, shape.SegmentType.LINE)
            v4 = shape.Vertex(0.0, 0.0, shape.SegmentType.CLOSE)
            vl = [v0, v1, v2, v3, v4]

            samples = shape.MultiPolygon(vertices=vl)

            p1 = shape.Point(0.0, 0.0)
            p2 = shape.Point(1.0, 2.0)
            p3 = shape.Point(2.0, 3.0)
            p4 = shape.Point(3.0, 4.0)
            p = [p1, p2, p3, p4]
            polygon = shape.Polygon(points=p, samples=samples)

            position.bounds = polygon

        position.dimension = wcs.Dimension2D(10, 20)
        position.resolution = 0.5
        position.sample_size = 1.1
        position.time_dependent = False

        return position
Esempio n. 4
0
    def get_circle_position(self):
        position = plane.Position()
        position.bounds = shape.Circle(shape.Point(1.1, 2.2), 3.0)
        position.dimension = wcs.Dimension2D(10, 20)
        position.resolution = 0.5
        position.sample_size = 1.1
        position.time_dependent = False

        return position
Esempio n. 5
0
 def get_circle_position(self):
     position = plane.Position()
     position.bounds = shape.Circle(shape.Point(1.1, 2.2), 3.0)
     position.dimension = wcs.Dimension2D(10, 20)
     position.resolution = 0.5
     position.sample_size = 1.1
     position.time_dependent = False
     if self.caom_version >= 24:
         position.resolution_bounds = shape.Interval(1.0, 2.0)
     return position
Esempio n. 6
0
 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
    def get_position(self):
        position = plane.Position()
        
        v1 = shape.Vertex(1.0, 2.0, shape.SegmentType.LINE)
        v2 = shape.Vertex(2.0, 3.0, shape.SegmentType.LINE)
        v3 = shape.Vertex(3.0, 4.0, shape.SegmentType.LINE)
        v4 = shape.Vertex(0.0, 0.0, shape.SegmentType.CLOSE)
        vl = [v1, v2, v3, v4]

        polygon = shape.Polygon()
        polygon.vertices = vl
        
        position.bounds = polygon
        position.dimension = wcs.Dimension2D(10, 20)
        position.resolution = 0.5
        position.sample_size = 1.1
        position.time_dependent = False
        
        return position