24 #include "pybind11/pybind11.h"
26 #include "pybind11/eigen.h"
32 #include "pybind11/stl.h"
33 #include "ndarray/pybind11.h"
42 using namespace py::literals;
50 wrappers.
wrap([](
auto &mod) {
53 mod.def(
"makeFlippedWcs",
makeFlippedWcs,
"wcs"_a,
"flipLR"_a,
"flipTB"_a,
"center"_a);
54 mod.def(
"makeModifiedWcs",
makeModifiedWcs,
"pixelTransform"_a,
"wcs"_a,
"modifyActualPixels"_a);
58 "crpix"_a,
"crval"_a,
"cdMatrix"_a,
"projection"_a =
"TAN");
60 "metadata"_a,
"strip"_a =
false);
64 "pixelsToFieldAngle"_a,
"orientation"_a,
"flipX"_a,
"boresight"_a,
"projection"_a =
"TAN");
65 mod.def(
"makeTanSipWcs",
67 Eigen::Matrix2d
const &, Eigen::MatrixXd
const &,
69 "crpix"_a,
"crval"_a,
"cdMatrix"_a,
"sipA"_a,
"sipB"_a);
70 mod.def(
"makeTanSipWcs",
72 Eigen::Matrix2d
const &, Eigen::MatrixXd
const &,
73 Eigen::MatrixXd
const &, Eigen::MatrixXd
const &,
75 "crpix"_a,
"crval"_a,
"cdMatrix"_a,
"sipA"_a,
"sipB"_a,
"sipAp"_a,
"sipBp"_a);
84 [](
auto &mod,
auto &cls) {
85 cls.def(py::init<daf::base::PropertySet &, bool>(),
"metadata"_a,
"strip"_a = false);
86 cls.def(py::init<ast::FrameDict const &>(),
"frameDict"_a);
88 cls.def(
"__eq__", &SkyWcs::operator==, py::is_operator());
89 cls.def(
"__ne__", &SkyWcs::operator!=, py::is_operator());
91 table::io::python::addPersistableMethods<SkyWcs>(cls);
93 cls.def(
"copyAtShiftedPixelOrigin", &SkyWcs::copyAtShiftedPixelOrigin,
"shift"_a);
94 cls.def(
"getFitsMetadata", &SkyWcs::getFitsMetadata,
"precise"_a = false);
95 cls.def(
"getPixelScale",
96 (lsst::geom::Angle(SkyWcs::*)(lsst::geom::Point2D const &) const) &
97 SkyWcs::getPixelScale,
99 cls.def(
"getPixelScale", (lsst::geom::Angle(SkyWcs::*)() const) & SkyWcs::getPixelScale);
100 cls.def(
"getPixelOrigin", &SkyWcs::getPixelOrigin);
101 cls.def(
"getSkyOrigin", &SkyWcs::getSkyOrigin);
102 cls.def(
"getCdMatrix",
103 (Eigen::Matrix2d(SkyWcs::*)(lsst::geom::Point2D const &) const) & SkyWcs::getCdMatrix,
105 cls.def(
"getCdMatrix", (Eigen::Matrix2d(SkyWcs::*)() const) & SkyWcs::getCdMatrix);
106 cls.def(
"getTanWcs", &SkyWcs::getTanWcs,
"pixel"_a);
107 cls.def(
"getFrameDict", [](SkyWcs const &self) { return self.getFrameDict()->copy(); });
108 cls.def(
"getTransform", &SkyWcs::getTransform);
110 cls.def_property_readonly(
"isFits", &SkyWcs::isFits);
111 cls.def_property_readonly(
"isFlipped", &SkyWcs::isFlipped);
112 cls.def(
"linearizePixelToSky",
115 SkyWcs::linearizePixelToSky,
116 "coord"_a,
"skyUnit"_a);
117 cls.def(
"linearizePixelToSky",
120 SkyWcs::linearizePixelToSky,
121 "coord"_a,
"skyUnit"_a);
122 cls.def(
"linearizeSkyToPixel",
125 SkyWcs::linearizeSkyToPixel,
126 "coord"_a,
"skyUnit"_a);
127 cls.def(
"linearizeSkyToPixel",
130 SkyWcs::linearizeSkyToPixel,
131 "coord"_a,
"skyUnit"_a);
132 cls.def(
"pixelToSky",
136 cls.def(
"pixelToSky",
139 cls.def(
"pixelToSky",
144 cls.def(
"skyToPixel",
148 cls.def(
"skyToPixel",
156 cls.def_static(
"readString", &SkyWcs::readString);
157 cls.def(
"writeString", &SkyWcs::writeString);
169 declareSkyWcs(wrappers);
A class representing an angle.
A class used to convert scalar POD types such as double to Angle.
Point in an unspecified spherical coordinate system.
A helper class for subdividing pybind11 module across multiple translation units (i....
pybind11::module module
The module object passed to the PYBIND11_MODULE block that contains this WrapperCollection.
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
Add a type (class or enum) wrapper, deferring method and other attribute definitions until finish() i...
void addInheritanceDependency(std::string const &name)
Indicate an external module that provides a base class for a subsequent addType call.
void wrap(WrapperCallback function)
Add a set of wrappers without defining a class.
void addSignatureDependency(std::string const &name)
Indicate an external module that provides a type used in function/method signatures.
std::shared_ptr< SkyWcs > makeSkyWcs(daf::base::PropertySet &metadata, bool strip=false)
Construct a SkyWcs from FITS keywords.
std::shared_ptr< TransformPoint2ToPoint2 > getPixelToIntermediateWorldCoords(SkyWcs const &wcs, bool simplify=true)
Return a transform from pixel coordinates to intermediate world coordinates.
std::shared_ptr< SkyWcs > makeTanSipWcs(lsst::geom::Point2D const &crpix, lsst::geom::SpherePoint const &crval, Eigen::Matrix2d const &cdMatrix, Eigen::MatrixXd const &sipA, Eigen::MatrixXd const &sipB)
Construct a TAN-SIP SkyWcs with forward SIP distortion terms and an iterative inverse.
Eigen::Matrix2d makeCdMatrix(lsst::geom::Angle const &scale, lsst::geom::Angle const &orientation=0 *lsst::geom::degrees, bool flipX=false)
Make a WCS CD matrix.
std::shared_ptr< TransformPoint2ToSpherePoint > getIntermediateWorldCoordsToSky(SkyWcs const &wcs, bool simplify=true)
Return a transform from intermediate world coordinates to sky.
std::shared_ptr< SkyWcs > makeModifiedWcs(TransformPoint2ToPoint2 const &pixelTransform, SkyWcs const &wcs, bool modifyActualPixels)
Create a new SkyWcs whose pixels are transformed by pixelTransform, as described below.
void wrapSkyWcs(lsst::utils::python::WrapperCollection &)
std::shared_ptr< TransformPoint2ToPoint2 > makeWcsPairTransform(SkyWcs const &src, SkyWcs const &dst)
A Transform obtained by putting two SkyWcs objects "back to back".
Transform< Point2Endpoint, Point2Endpoint > TransformPoint2ToPoint2
std::shared_ptr< SkyWcs > makeFlippedWcs(SkyWcs const &wcs, bool flipLR, bool flipTB, lsst::geom::Point2D const ¢er)
Return a copy of a FITS-WCS with pixel positions flipped around a specified center.
constexpr AngleUnit degrees
constant with units of degrees
void addOutputOp(PyClass &cls, std::string const &method)
Add __str__ or __repr__ method implemented by operator<<.
A base class for image defects.