コード例 #1
0
 def test_ellipse(self):
     o = dc.Ellipse(42, 43, 4.2, 4.2, rot_deg=5.0)
     r = g2r(o)
     assert isinstance(r, regions.EllipsePixelRegion)
     assert np.all(np.isclose((o.x, o.y, o.xradius, o.yradius, o.rot_deg),
                              (r.center.x, r.center.y, r.width / 2., r.height / 2.,
                               r.angle.to(u.deg).value)))
コード例 #2
0
 def test_rectangle_annulus(self):
     o = dc.Annulus2R(42, 43, 4.2, 7.2, xwidth=1, ywidth=1, rot_deg=5.0, atype='box')
     r = g2r(o)
     assert isinstance(r, regions.RectangleAnnulusPixelRegion)
     assert np.all(np.isclose((o.x, o.y, o.xradius, o.yradius, o.xradius + o.xwidth,
                               o.yradius + o.ywidth, o.rot_deg),
                              (r.center.x, r.center.y, r.inner_width / 2., r.inner_height / 2.,
                               r.outer_width / 2., r.outer_height / 2.,
                               r.angle.to(u.deg).value)))
コード例 #3
0
 def test_circle_annulus(self):
     o = dc.Annulus(42, 43, 4.2, width=1, atype='circle')
     r = g2r(o)
     assert isinstance(r, regions.CircleAnnulusPixelRegion)
     assert np.all(np.isclose((o.x, o.y, o.radius, o.radius + o.width),
                              (r.center.x, r.center.y, r.inner_radius, r.outer_radius)))
コード例 #4
0
 def test_polygon(self):
     o = dc.Polygon([(1, 1), (2, 1), (2, 2)])
     r = g2r(o)
     assert isinstance(r, regions.PolygonPixelRegion)
     assert np.all(np.isclose(o.points, np.array(r.vertices.xy).T))
コード例 #5
0
 def test_circle(self):
     o = dc.Circle(42, 43, 4.2)
     r = g2r(o)
     assert isinstance(r, regions.CirclePixelRegion)
     assert np.all(np.isclose((o.x, o.y, o.radius), (r.center.x, r.center.y, r.radius)))
コード例 #6
0
 def test_box(self):
     o = dc.Box(42, 43, 10, 10)
     r = g2r(o)
     assert isinstance(r, regions.RectanglePixelRegion)
     assert np.all(np.isclose((o.x, o.y, o.xradius, o.yradius),
                              (r.center.x, r.center.y, r.width / 2.0, r.height / 2.0)))
コード例 #7
0
 def test_line(self):
     o = dc.Line(42, 43, 52, 53)
     r = g2r(o)
     assert isinstance(r, regions.LinePixelRegion)
     assert np.all(np.isclose((o.x1, o.y1, o.x2, o.y2),
                              (r.start.x, r.start.y, r.end.x, r.end.y)))
コード例 #8
0
 def test_text(self):
     o = dc.Text(42, 43, text='Foo', rot_deg=45.0)
     r = g2r(o)
     assert isinstance(r, regions.TextPixelRegion) and r.text == 'Foo'
     assert np.all(np.isclose((o.x, o.y, o.rot_deg),
                              (r.center.x, r.center.y, float(r.visual['textangle']))))
コード例 #9
0
 def test_point3(self):
     o = dc.Point(42, 43, radius=5, style='square')
     r = g2r(o)
     assert isinstance(r, regions.PointPixelRegion)
     assert r.visual['symbol'] == '*'
コード例 #10
0
 def test_point1(self):
     o = dc.Point(42, 43, radius=5, style='cross')
     r = g2r(o)
     assert isinstance(r, regions.PointPixelRegion)
     assert np.all(np.isclose((o.x, o.y), (r.center.x, r.center.y)))
     assert r.visual['symbol'] == 'x'