3 #include "lsst/meas/extensions/psfex/Field.hh" 12 namespace lsst {
namespace meas {
namespace extensions {
namespace psfex {
15 impl(NULL), _isInitialized(false)
17 QCALLOC(impl, fieldstruct, 1);
21 impl->rcatname = impl->catname;
23 strncpy(impl->rtcatname, impl->rcatname,
sizeof(impl->rtcatname) - 1);
24 strncpy(impl->ident,
"??",
sizeof(impl->ident) - 1);
26 if (!(impl->rcatname =
strrchr(impl->catname,
'/'))) {
27 impl->rcatname = impl->catname;
32 strncpy(impl->rtcatname, impl->rcatname,
sizeof(impl->rtcatname) - 1);
34 char *pstr=
strrchr(impl->rtcatname,
'.');
40 strncpy(impl->ident,
"??",
sizeof(impl->ident) - 1);
52 for (
int i = 0; i != impl->next; ++i) {
63 Field::_finalize(
bool force)
65 if (force || !_isInitialized) {
66 field_init_finalize(impl);
67 _isInitialized =
true;
74 Field::getPsfs()
const 78 for (
int i = 0; i != impl->next; ++i) {
79 _psfs.push_back(
Psf(impl->psf[i]));
88 int const naxis1,
int const naxis2,
91 QREALLOC(impl->psf, psfstruct *, impl->next + 1);
92 impl->psf[impl->next] = 0;
93 QREALLOC(impl->wcs, wcsstruct *, impl->next + 1);
94 impl->wcs[impl->next] = 0;
98 QMALLOC(impl->wcs[impl->next], wcsstruct, 1);
99 wcsstruct *
wcs = impl->wcs[impl->next];
102 wcs->naxisn[0] = naxis1;
103 wcs->naxisn[1] = naxis2;
111 for (
int i = 0; i != wcs->naxis; ++i) {
113 auto ctype = metadata->getAsString(
"CTYPE" +
std::to_string(ifits));
114 strncpy(wcs->ctype[i], ctype.c_str(), ctype.size() + 1);
115 strncpy(wcs->cunit[i], cunit.
c_str(), cunit.
size() + 1);
116 wcs->crpix[i] =
crpix[i];
117 wcs->crval[i] =
crval[i].asDegrees();
122 for (
int i = 0, k = 0; i < 2; ++i) {
123 for (
int j = 0; j < 2; ++j, ++k) {
124 wcs->cd[k] = cdMatrix(i, j);
133 wcs->wcsscalepos[1] = center.getLatitude().asDegrees();
135 double maxradius = 0.0;
136 for (
int x = 0;
x <= 1; ++
x) {
137 for (
int y = 0;
y <= 1; ++
y) {
139 double const radius = center.separation(wcs_.
pixelToSky(point)).asDegrees();
140 if (radius > maxradius) {
145 wcs->wcsmaxradius = maxradius;
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
constexpr double asDegrees() const noexcept
Return an Angle's value in degrees.
lsst::geom::SpherePoint pixelToSky(lsst::geom::Point2D const &pixel) const
Compute sky position(s) from pixel position(s)
table::PointKey< double > crpix
Angle getLongitude() const noexcept
The longitude of this point.
table::PointKey< double > crval
lsst::geom::SpherePoint getSkyOrigin() const
Get the sky origin, the celestial fiducial point.
table::Key< table::Array< std::uint8_t > > wcs
Eigen::Matrix2d getCdMatrix(lsst::geom::Point2D const &pixel) const
Get the 2x2 CD matrix at the specified pixel position.
A base class for image defects.
lsst::geom::Point2D getPixelOrigin() const
Get the pixel origin, in pixels, using the LSST convention.
std::shared_ptr< daf::base::PropertyList > getFitsMetadata(bool precise=false) const
Return the WCS as FITS WCS metadata.
Extent< double, 2 > Extent2D