lsst.afw  13.0-39-g3deb52d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
transformContinued.py
Go to the documentation of this file.
1 #
2 # LSST Data Management System
3 # Copyright 2017 LSST/AURA.
4 #
5 # This product includes software developed by the
6 # LSST Project (http://www.lsst.org/).
7 #
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the LSST License Statement and
19 # the GNU General Public License along with this program. If not,
20 # see <http://www.lsstcorp.org/LegalNotices/>.
21 #
22 from __future__ import absolute_import, division, print_function
23 
24 from lsst.pex.exceptions import InvalidParameterError
25 
26 from . import transform
27 
28 __all__ = []
29 
30 
31 def getJacobian(self, x):
32  # Force 2D matrix over numpy's protests
33  matrix = self._getJacobian(x)
34  matrix.shape = (self.getToEndpoint().getNAxes(),
35  self.getFromEndpoint().getNAxes())
36  return matrix
37 
38 
39 def of(self, first):
40  if first.getToEndpoint() == self.getFromEndpoint():
41  return self._of(first)
42  else:
43  raise InvalidParameterError(
44  "Cannot concatenate %r and %r: endpoints do not match."
45  % (first, self))
46 
47 
48 endpoints = ("Generic", "Point2", "Point3", "SpherePoint")
49 
50 for fromPoint in endpoints:
51  for toPoint in endpoints:
52  name = "Transform" + fromPoint + "To" + toPoint
53  cls = getattr(transform, name)
54  cls.getJacobian = getJacobian
55  cls.of = of