LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
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.