lsst.afw  18.0.0-6-g7484c24d0
aggregatesContinued.py
Go to the documentation of this file.
1 # This file is part of afw.
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 
22 __all__ = ["PointKey", "CovarianceMatrixKey"]
23 
24 import numpy as np
25 
26 from lsst.utils import TemplateMeta
27 from . import aggregates
28 
29 
30 class PointKey(metaclass=TemplateMeta):
31  TEMPLATE_PARAMS = ("dtype", "dim")
32  TEMPLATE_DEFAULTS = (None, 2)
33 
34 
35 PointKey.register((np.int32, 2), aggregates.Point2IKey)
36 PointKey.register((np.float64, 2), aggregates.Point2DKey)
37 
38 
39 # Because Boxes aren't templates themselves, we don't expose the fact that
40 # BoxKey is a template to the Python user; it's considered an implementation
41 # detail.
42 
43 
44 class CovarianceMatrixKey(metaclass=TemplateMeta):
45  TEMPLATE_PARAMS = ("dtype", "dim")
46 
47 
48 CovarianceMatrixKey.register((np.float32, 2), aggregates.CovarianceMatrix2fKey)
49 CovarianceMatrixKey.register((np.float32, 3), aggregates.CovarianceMatrix3fKey)
50 CovarianceMatrixKey.register((np.float32, 4), aggregates.CovarianceMatrix4fKey)
51 CovarianceMatrixKey.register(
52  (np.float32, None), aggregates.CovarianceMatrixXfKey)
53 CovarianceMatrixKey.register((np.float64, 2), aggregates.CovarianceMatrix2dKey)
54 CovarianceMatrixKey.register((np.float64, 3), aggregates.CovarianceMatrix3dKey)
55 CovarianceMatrixKey.register((np.float64, 4), aggregates.CovarianceMatrix4dKey)
56 CovarianceMatrixKey.register(
57  (np.float64, None), aggregates.CovarianceMatrixXdKey)