LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
LSST Data Management Base Package
Loading...
Searching...
No Matches
Functions | Variables
test_ellipse Namespace Reference

Functions

 test_Covariance ()
 
 test_Ellipse ()
 
 test_EllipseMajor ()
 

Variables

 rho_min = math.nextafter(-1, -2)
 
 rho_max = math.nextafter(1, 2)
 
 pos_min = math.nextafter(0, 1)
 
str prefix_namespace = "lsst.gauss2d."
 

Function Documentation

◆ test_Covariance()

test_ellipse.test_Covariance ( )

Definition at line 33 of file test_ellipse.py.

33def test_Covariance():
34 with pytest.raises(ValueError):
36 with pytest.raises(ValueError):
37 g2d.Covariance(0, -1)
38 for rho_bad in (rho_min, rho_max):
39 with pytest.raises(ValueError):
40 g2d.Covariance(0, 0, rho_bad)
41
42 covar_0 = g2d.Covariance()
43 assert (covar_0.sigma_x_sq, covar_0.sigma_y_sq, covar_0.cov_xy) == (0, 0, 0)
44 assert covar_0.xyc == [0, 0, 0]
45 assert covar_0 != g2d.Covariance(pos_min, 0, 0)
46 assert covar_0 != g2d.Covariance(0, pos_min, 0)
47 assert g2d.Covariance(1, 1, 0) != g2d.Covariance(1, 1, pos_min)
48
49 covar_conv = g2d.Covariance(9., 9., 0).make_convolution(g2d.Covariance(16., 16., 0))
50 assert covar_conv == g2d.Covariance(25., 25., 0)
51
52 str_covar_conv = "Covariance(sigma_x_sq=2.500000e+01, sigma_y_sq=2.500000e+01, cov_xy=0.000000e+00)"
53 assert str(str_covar_conv) == str_covar_conv
54 assert repr(covar_conv) == f"{prefix_namespace}{str_covar_conv}"
55
56
A representation of a 2D Gaussian with x and y standard deviations and a covariance value.
Definition ellipse.h:57

◆ test_Ellipse()

test_ellipse.test_Ellipse ( )

Definition at line 57 of file test_ellipse.py.

57def test_Ellipse():
58 with pytest.raises(ValueError):
59 g2d.Ellipse(-1)
60 with pytest.raises(ValueError):
61 g2d.Ellipse(0, -1)
62 for rho_bad in (rho_min, rho_max):
63 with pytest.raises(ValueError):
64 g2d.Ellipse(0, 0, rho_bad)
65
66 ell_0 = g2d.Ellipse()
67 assert ell_0.xyr == [0, 0, 0]
68 assert ell_0 != g2d.Ellipse(pos_min, 0, 0)
69 assert ell_0 != g2d.Ellipse(0, pos_min, 0)
70 ell_1 = g2d.Ellipse(sigma_x=1, sigma_y=1, rho=-0.1)
71 assert (ell_1.sigma_x, ell_1.sigma_y, ell_1.rho) == (1, 1, -0.1)
72 assert [ell_1.hwhm_x, ell_1.hwhm_y, ell_1.rho] == ell_1.hxyr
73 ell_1.set_h(hwhm_x=1, hwhm_y=1, rho=0.1)
74 assert (ell_1.hwhm_x, ell_1.hwhm_y, ell_1.rho) == (1, 1, 0.1)
75 assert ell_1 != g2d.Ellipse(1, 1, pos_min)
76
77 ell_conv = g2d.Ellipse(3., 3., 0).make_convolution(g2d.Ellipse(4., 4., 0))
78 assert ell_conv == g2d.Ellipse(5., 5., 0)
79 assert ell_conv.get_radius_trace() == pytest.approx(5*math.sqrt(2.), rel=1e-10, abs=1e-10)
80
81 str_data = "EllipseValues(sigma_x=5.000000e+00, sigma_y=5.000000e+00, rho=0.000000e+00)"
82 assert str(ell_conv) == f"Ellipse(data={str_data})"
83 assert repr(ell_conv) == f"{prefix_namespace}Ellipse(data={prefix_namespace}{str_data})"
84
85 ell_conv.set(g2d.Covariance(ell_0))
86 print(g2d.Covariance(ell_0))
87 assert ell_conv == ell_0
88 ell_1_maj = g2d.EllipseMajor(ell_1)
89 ell_conv.set(ell_1_maj)
90 assert ell_conv == g2d.Ellipse(ell_1_maj)
91
92
An Ellipse with sigma_x, sigma_y, and rho values.
Definition ellipse.h:283
An Ellipse with r_major, axrat and angle values.
Definition ellipse.h:337

◆ test_EllipseMajor()

test_ellipse.test_EllipseMajor ( )

Definition at line 93 of file test_ellipse.py.

93def test_EllipseMajor():
94 covar = g2d.Covariance(0.08333332098858685, 0.08333332098858683, 1.337355953645e-13)
95 ellipse_maj = g2d.EllipseMajor(covar)
96 assert ellipse_maj.r_major > 0

Variable Documentation

◆ pos_min

test_ellipse.pos_min = math.nextafter(0, 1)

Definition at line 29 of file test_ellipse.py.

◆ prefix_namespace

str test_ellipse.prefix_namespace = "lsst.gauss2d."

Definition at line 30 of file test_ellipse.py.

◆ rho_max

test_ellipse.rho_max = math.nextafter(1, 2)

Definition at line 28 of file test_ellipse.py.

◆ rho_min

test_ellipse.rho_min = math.nextafter(-1, -2)

Definition at line 27 of file test_ellipse.py.