3 #include "lsst/meas/extensions/psfex/Field.hh" 11 namespace lsst {
namespace meas {
namespace extensions {
namespace psfex {
14 impl(NULL), _isInitialized(false)
16 QCALLOC(impl, fieldstruct, 1);
20 impl->rcatname = impl->catname;
22 strncpy(impl->rtcatname, impl->rcatname,
sizeof(impl->rtcatname) - 1);
23 strncpy(impl->ident,
"??",
sizeof(impl->ident) - 1);
25 if (!(impl->rcatname =
strrchr(impl->catname,
'/'))) {
26 impl->rcatname = impl->catname;
31 strncpy(impl->rtcatname, impl->rcatname,
sizeof(impl->rtcatname) - 1);
33 char *pstr=
strrchr(impl->rtcatname,
'.');
39 strncpy(impl->ident,
"??",
sizeof(impl->ident) - 1);
51 for (
int i = 0; i != impl->next; ++i) {
62 Field::_finalize(
bool force)
64 if (force || !_isInitialized) {
65 field_init_finalize(impl);
66 _isInitialized =
true;
73 Field::getPsfs()
const 77 for (
int i = 0; i != impl->next; ++i) {
78 _psfs.push_back(
Psf(impl->psf[i]));
87 int const naxis1,
int const naxis2,
90 QREALLOC(impl->psf, psfstruct *, impl->next + 1);
91 impl->psf[impl->next] = 0;
92 QREALLOC(impl->wcs, wcsstruct *, impl->next + 1);
93 impl->wcs[impl->next] = 0;
97 QMALLOC(impl->wcs[impl->next], wcsstruct, 1);
98 wcsstruct *
wcs = impl->wcs[impl->next];
101 wcs->naxisn[0] = naxis1;
102 wcs->naxisn[1] = naxis2;
110 for (
int i = 0; i != wcs->naxis; ++i) {
112 auto ctype = metadata->getAsString(
"CTYPE" +
std::to_string(ifits));
113 strncpy(wcs->ctype[i], ctype.c_str(), ctype.size() + 1);
114 strncpy(wcs->cunit[i], cunit.c_str(), cunit.size() + 1);
115 wcs->crpix[i] =
crpix[i];
116 wcs->crval[i] =
crval[i].asDegrees();
121 for (
int i = 0, k = 0; i < 2; ++i) {
122 for (
int j = 0; j < 2; ++j, ++k) {
123 wcs->cd[k] = cdMatrix(i, j);
132 wcs->wcsscalepos[1] = center.getLatitude().asDegrees();
134 double maxradius = 0.0;
135 for (
int x = 0;
x <= 1; ++
x) {
136 for (
int y = 0;
y <= 1; ++
y) {
138 double const radius = center.separation(wcs_.
pixelToSky(point)).asDegrees();
139 if (radius > maxradius) {
144 wcs->wcsmaxradius = maxradius;
Eigen::Matrix2d getCdMatrix(Point2D const &pixel) const
Extent< double, 2 > Extent2D
Angle getLongitude() const noexcept
table::PointKey< double > crpix
table::PointKey< double > crval
table::Key< table::Array< std::uint8_t > > wcs
Point< double, 2 > Point2D
Point2D getPixelOrigin() const
SpherePoint pixelToSky(Point2D const &pixel) const
std::shared_ptr< daf::base::PropertyList > getFitsMetadata(bool precise=false) const
constexpr double asDegrees() const noexcept
SpherePoint getSkyOrigin() const