30 #define __attribute__(x) 37 #include <boost/archive/binary_iarchive.hpp> 38 #include <boost/archive/binary_oarchive.hpp> 39 #include <boost/archive/text_iarchive.hpp> 40 #include <boost/archive/text_oarchive.hpp> 42 #include "wcslib/wcs.h" 61 namespace formatters {
83 LOGL_DEBUG(_log,
"TamWcsFormatter write start");
91 LOGL_DEBUG(_log,
"TanWcsFormatter write BoostStorage");
92 boost->getOArchive() & *ip;
101 LOGL_DEBUG(_log,
"TanWcsFormatter read start");
106 LOGL_DEBUG(_log,
"TanWcsFormatter read BoostStorage");
107 boost->getIArchive() & *ip;
113 LOGL_DEBUG(_log,
"TanWcsFormatter read FitsStorage");
129 template <
class Archive>
134 if (Archive::is_loading::value) {
135 m = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>(rows, cols);
137 for (
int j = 0; j < m.cols(); ++j) {
138 for (
int i = 0; i < m.rows(); ++i) {
146 Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>
const&
m) {
147 int order = m.rows();
148 if (m.cols() != order) {
153 wcsProps->add(which +
"_ORDER", static_cast<int>(order));
154 for (
int i = 0; i <= order; ++i) {
155 for (
int j = 0; j <= order; ++j) {
156 double val =
m(i, j);
158 wcsProps->add((
boost::format(
"%1%_%2%_%3%") % which % i % j).str(), val);
173 wcsProps->add(
"NAXIS", wcs.
_wcsInfo[0].naxis,
"number of data axes");
176 if (strncmp(wcs.
_wcsInfo[0].radesys,
"ICRS", 4) != 0) {
177 wcsProps->add(
"EQUINOX", wcs.
_wcsInfo[0].equinox,
"Equinox of coordinates");
179 wcsProps->add(
"RADESYS",
std::string(wcs.
_wcsInfo[0].radesys),
"Coordinate system for equinox");
180 wcsProps->add(
"CRPIX1", wcs.
_wcsInfo[0].crpix[0],
"WCS Coordinate reference pixel");
181 wcsProps->add(
"CRPIX2", wcs.
_wcsInfo[0].crpix[1],
"WCS Coordinate reference pixel");
182 wcsProps->add(
"CD1_1", wcs.
_wcsInfo[0].cd[0],
"WCS Coordinate scale matrix");
183 wcsProps->add(
"CD1_2", wcs.
_wcsInfo[0].cd[1],
"WCS Coordinate scale matrix");
184 wcsProps->add(
"CD2_1", wcs.
_wcsInfo[0].cd[2],
"WCS Coordinate scale matrix");
185 wcsProps->add(
"CD2_2", wcs.
_wcsInfo[0].cd[3],
"WCS Coordinate scale matrix");
186 wcsProps->add(
"CRVAL1", wcs.
_wcsInfo[0].crval[0],
"WCS Ref value (RA in decimal degrees)");
187 wcsProps->add(
"CRVAL2", wcs.
_wcsInfo[0].crval[1],
"WCS Ref value (DEC in decimal degrees)");
201 if (ctype1.
rfind(
"-SIP") == std::string::npos) {
204 if (ctype2.
rfind(
"-SIP") == std::string::npos) {
207 encodeSipHeader(wcsProps,
"A", wcs.
_sipA);
208 encodeSipHeader(wcsProps,
"B", wcs.
_sipB);
209 encodeSipHeader(wcsProps,
"AP", wcs.
_sipAp);
210 encodeSipHeader(wcsProps,
"BP", wcs.
_sipBp);
212 wcsProps->add(
"CTYPE1", ctype1,
"WCS Coordinate type");
213 wcsProps->add(
"CTYPE2", ctype2,
"WCS Coordinate type");
218 template <
class Archive>
220 LOGL_DEBUG(_log,
"TanWcsFormatter delegateSerialize start");
241 if (Archive::is_loading::value) {
242 ip->
_wcsInfo =
reinterpret_cast<wcsprm*
>(malloc(ip->
_nWcsInfo *
sizeof(wcsprm)));
245 for (
int i = 0; i < ip->
_nWcsInfo; ++i) {
247 if (Archive::is_loading::value) {
271 if (Archive::is_loading::value) {
276 LOGL_DEBUG(_log,
"TanWcsFormatter delegateSerialize end");
Class for storing ordered metadata with comments.
Class for FITS file storage.
table::Key< std::string > ctype2
daf_persistence package header file
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
LSST DM logging module built on log4cxx.
std::shared_ptr< daf::base::PropertyList > readMetadata(std::string const &fileName, int hdu=DEFAULT_HDU, bool strip=false)
Read FITS header.
A base class for image defects.
Implementation of the WCS standard for the special case of the Gnomonic (tangent plane) projection...
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Include files required for standard LSST Exception handling.
T dynamic_pointer_cast(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
int _wcshdrCtrl
Controls messages to stderr from wcshdr (0 for none); see wcshdr.h for details.
int _relax
Degree of permissiveness for wcspih (0 for strict); see wcshdr.h for details.
int _wcsfixCtrl
Do potentially unsafe translations of non-standard unit strings? 0/1 = no/yes.
Class for boost::serialization storage.
Base class for all persistable classes.
#define LOG_GET(logger)
Returns a Log object associated with logger.
table::Key< std::string > ctype1
coord::CoordSystem _coordSystem
const int DEFAULT_HDU
Specify that the default HDU should be read.