24#include "pybind11/pybind11.h"
26#include "pybind11/eigen.h"
32#include "pybind11/stl.h"
33#include "ndarray/pybind11.h"
42using 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);
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) &
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 helper class for subdividing pybind11 module across multiple translation units (i....
void addSignatureDependency(std::string const &name)
Indicate an external module that provides a type used in function/method signatures.
void wrap(WrapperCallback function)
Add a set of wrappers without defining a class.
void addInheritanceDependency(std::string const &name)
Indicate an external module that provides a base class for a subsequent addType call.
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...
A class representing an angle.
Point in an unspecified spherical coordinate system.
void wrapSkyWcs(lsst::cpputils::python::WrapperCollection &)
void addOutputOp(PyClass &cls, std::string const &method)
Add __str__ or __repr__ method implemented by operator<<.
AngleUnit constexpr degrees
constant with units of degrees
Point< double, 2 > Point2D