22 """Python helpers for pybind11 wrapping of Transform classes and subclasses 24 .. _pybind11_transform_classes: 26 Transform Classes and Subclasses 27 -------------------------------- 29 Transforms are instances of 30 lsst::afw::geom::Transform<FromEndpoint, ToEndpoint> 31 and subclasses, such as lsst::afw::geom::SkyWcs. 33 In Python the templated Transform classes have names such as 34 `lsst.afw.geom.TransformSpherePointToPoint2` for 35 `lsst::afw::geom::Transform<SpherePointEndpoint, Point2Endpoint>` 39 __all__ = [
"addTransformMethods",
"reduceTransform",
"transformRegistry"]
44 transformRegistry = {}
49 matrix = self._getJacobian(x)
50 matrix.shape = (self.toEndpoint.nAxes,
51 self.fromEndpoint.nAxes)
55 def then(self, next, simplify=True):
56 """Concatenate two transforms 58 The result of A.then(B) is is C(x) = B(A(x)) 60 if self.toEndpoint == next.fromEndpoint:
61 return self._then(next, simplify=simplify)
64 "Cannot concatenate %r and %r: endpoints do not match." 69 """Unpickle a Transform object 81 The unpickled Transform. 83 return cls.readString(state)
87 """Pickle a Transform object 89 This provides the `__reduce__` implementation for a Transform. 91 return unpickleTransform, (
type(transform), transform.writeString())
95 """Add pure python methods to the specified Transform class, and register 96 the class in `transformRegistry` 98 All :ref:`_pybind11_transform_classes` must call this function. 102 cls : :ref:`_pybind11_transform_classes` 103 A Transform class or subclass, e.g. 104 `lsst.afw.geom.TransformPoint2ToSpherePoint` 106 global transformRegistry
107 className = cls.__name__
108 if className
in transformRegistry:
109 raise RuntimeError(
"Class %r=%s already registered; cannot register class %s" %
110 (className, transformRegistry[className], cls))
111 transformRegistry[cls.__name__] = cls
112 cls.getJacobian = getJacobian
114 cls.__reduce__ = reduceTransform
Reports invalid arguments.