LSST Applications g0dd1f4853b+10f999ec6a,g1635faa6d4+a532cf075c,g1653933729+a8ce1bb630,g28da252d5a+e572b726dd,g2bbee38e9b+de1ea1445d,g2bc492864f+de1ea1445d,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+de1ea1445d,g35bb328faa+a8ce1bb630,g3a166c0a6a+de1ea1445d,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+b32763d0b7,g531c6476d5+e6a12b3054,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g7ab3e175f3+639c6ea003,g80478fca09+05e86c5124,g82479be7b0+29640585df,g833419f2f4+b689876871,g858d7b2824+e6a12b3054,g9125e01d80+a8ce1bb630,ga5288a1d22+8d9931977a,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gb9c6c11c1e+416f6b785a,gc28159a63d+de1ea1445d,gcf0d15dbbd+376045fc75,gd3624f51fd+3f6df5dced,gda3e153d99+e6a12b3054,gda6a2b7d83+376045fc75,gdaeeff99f8+1711a396fd,ge2409df99d+f7e20d4350,ge33fd446bb+e6a12b3054,ge79ae78c31+de1ea1445d,gf0baf85859+147a0692ba,gf3967379c6+28f972f967,w.2024.45
LSST Data Management Base Package
Loading...
Searching...
No Matches
test_centroid.py
Go to the documentation of this file.
1# This file is part of gauss2d.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
21
22import lsst.gauss2d as g2d
23
24
26 values = g2d.CentroidValues()
27 assert values.xy == [0., 0.]
28
29 values.x, values.y = -2., 3.
30 assert values.xy == [-2., 3.]
31
32 str_values = "CentroidValues(x=-2.000000e+00, y=3.000000e+00)"
33 assert str(values) == str_values
34 assert repr(values) == f"lsst.gauss2d.{str_values}"
35
36
38 values = g2d.CentroidValues(-1.0, 2.0)
39 cen1 = g2d.Centroid(values)
40 cen2 = g2d.Centroid(values)
41 cen3 = g2d.Centroid(-1.0, 2.0)
42
43 assert cen1 == cen2
44 assert not (cen1 != cen3)
45
46 cen1.x = cen1.y
47 assert cen2.x == cen1.x
48 assert cen1 != cen3
49
50 str_values = str(values)
51 assert str(cen1) == f"Centroid(data={str_values})"
52 assert repr(cen1) == f"lsst.gauss2d.Centroid(data=lsst.gauss2d.{str_values})"
A 2D coordinate representing the center of a plane figure.
Definition centroid.h:114
A CentroidData storing centroid values as shared_ptrs.
Definition centroid.h:74