24#include "pybind11/pybind11.h"
26#include "pybind11/eigen.h"
32#include "pybind11/stl.h"
33#include "ndarray/pybind11.h"
42using namespace py::literals;
49void declareSkyWcs(lsst::utils::python::WrapperCollection &wrappers) {
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);
57 Eigen::Matrix2d
const &,
std::string const &))makeSkyWcs,
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 &,
68 Eigen::MatrixXd
const &))makeTanSipWcs,
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 &,
74 Eigen::MatrixXd
const &))makeTanSipWcs,
75 "crpix"_a,
"crval"_a,
"cdMatrix"_a,
"sipA"_a,
"sipB"_a,
"sipAp"_a,
"sipBp"_a);
76 mod.def(
"makeWcsPairTransform", makeWcsPairTransform,
"src"_a,
"dst"_a);
77 mod.def(
"getIntermediateWorldCoordsToSky", getIntermediateWorldCoordsToSky,
"wcs"_a,
79 mod.def(
"getPixelToIntermediateWorldCoords", getPixelToIntermediateWorldCoords,
"wcs"_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(); });
112 cls.def(
"linearizePixelToSky",
114 lsst::
geom::AngleUnit const &) const) &
115 SkyWcs::linearizePixelToSky,
116 "coord"_a,
"skyUnit"_a);
117 cls.def(
"linearizePixelToSky",
119 lsst::
geom::AngleUnit const &) const) &
120 SkyWcs::linearizePixelToSky,
121 "coord"_a,
"skyUnit"_a);
122 cls.def(
"linearizeSkyToPixel",
124 lsst::
geom::AngleUnit const &) const) &
125 SkyWcs::linearizeSkyToPixel,
126 "coord"_a,
"skyUnit"_a);
127 cls.def(
"linearizeSkyToPixel",
129 lsst::
geom::AngleUnit const &) const) &
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",
150 std::vector<
lsst::
geom::SpherePoint> const &) const) &
159 utils::python::addOutputOp(cls,
"__str__");
161 utils::python::addOutputOp(cls,
"__repr__");
165void wrapSkyWcs(lsst::utils::python::WrapperCollection &wrappers) {
166 wrappers.addInheritanceDependency(
"lsst.afw.table.io");
167 wrappers.addInheritanceDependency(
"lsst.afw.typehandling");
168 wrappers.addSignatureDependency(
"astshim");
169 declareSkyWcs(wrappers);
std::string writeString() const
Serialize this SkyWcs to a string, using the same format as writeStream.
static std::shared_ptr< SkyWcs > readString(std::string &str)
Deserialize a SkyWcs from a string, using the same format as readStream.
std::shared_ptr< const TransformPoint2ToSpherePoint > getTransform() const
Get a TransformPoint2ToSpherePoint that transforms pixels to sky in the forward direction and sky to ...
bool isFlipped() const
Does the WCS follow the convention of North=Up, East=Left?
bool isFits() const
Return true getFitsMetadata(true) will succeed, false if not.
A class representing an angle.
Point in an unspecified spherical coordinate system.
void wrapSkyWcs(lsst::utils::python::WrapperCollection &)
AngleUnit constexpr degrees
constant with units of degrees
Point< double, 2 > Point2D