39 namespace lsst {
namespace afw {
namespace image {
46 if (metadata.exists(name)) {
47 r = metadata.get<
int>(
name);
48 metadata.remove(name);
72 return std::make_shared<ApCorrMap>(*apCorrMap);
88 ) : _wcs(_cloneWcs(wcs)),
89 _psf(std::const_pointer_cast<detection::Psf>(psf)),
92 _validPolygon(polygon),
95 _coaddInputs(coaddInputs),
96 _apCorrMap(_cloneApCorrMap(apCorrMap)),
101 _wcs(_cloneWcs(other._wcs)),
103 _calib(_cloneCalib(other._calib)),
104 _detector(other._detector),
105 _validPolygon(other._validPolygon),
106 _filter(other._filter),
108 _coaddInputs(other._coaddInputs),
109 _apCorrMap(_cloneApCorrMap(other._apCorrMap)),
110 _visitInfo(other._visitInfo)
114 _wcs(_cloneWcs(other._wcs)),
116 _calib(_cloneCalib(other._calib)),
117 _detector(other._detector),
118 _validPolygon(other._validPolygon),
119 _filter(other._filter),
121 _coaddInputs(other._coaddInputs),
122 _apCorrMap(_cloneApCorrMap(other._apCorrMap)),
123 _visitInfo(other._visitInfo)
129 if (&other !=
this) {
164 data.
metadata->set(
"AR_HDU", 5,
"HDU containing the archive used to store ancillary objects");
167 data.
metadata->set(
"COADD_INPUTS_ID", coaddInputsId,
"archive ID for coadd inputs catalogs");
171 data.
metadata->set(
"AP_CORR_MAP_ID", apCorrMapId,
"archive ID for aperture correction map");
175 data.
metadata->set(
"PSF_ID", psfId,
"archive ID for the Exposure's main Psf");
179 data.
metadata->set(
"WCS_ID", wcsId,
"archive ID for the Exposure's main Wcs");
183 data.
metadata->set(
"VALID_POLYGON_ID", polygonId,
"archive ID for the Exposure's valid polygon");
193 newWcs->shiftReferencePixel(-xy0.getX(), -xy0.getY() );
210 data.
imageMetadata->set(
"LTV1", static_cast<double>(-xy0.getX()));
211 data.
imageMetadata->set(
"LTV2", static_cast<double>(-xy0.getY()));
245 if (!imageMetadata->
exists(
"INHERIT")) {
251 metadata = imageMetadata;
264 int archiveHdu = popInt(*metadata,
"AR_HDU");
267 fitsfile.
setHdu(archiveHdu);
273 int psfId = popInt(*metadata,
"PSF_ID");
276 }
catch (pex::exceptions::NotFoundError & err) {
277 LOGLS_WARN(_log,
"Could not read PSF; setting to null: " << err.what());
279 int wcsId = popInt(*metadata,
"WCS_ID");
281 auto archiveWcs = archive.
get<
Wcs>(wcsId);
285 LOGLS_INFO(_log,
"Empty WCS extension, using FITS header");
287 }
catch (pex::exceptions::NotFoundError & err) {
288 auto msg = str(
boost::format(
"Could not read WCS extension; setting to null: %s") % err.what());
290 msg +=
" ; using WCS from FITS header";
294 int coaddInputsId = popInt(*metadata,
"COADD_INPUTS_ID");
297 }
catch (pex::exceptions::NotFoundError & err) {
298 LOGLS_WARN(_log,
"Could not read CoaddInputs; setting to null: " << err.what());
300 int apCorrMapId = popInt(*metadata,
"AP_CORR_MAP_ID");
303 }
catch (pex::exceptions::NotFoundError & err) {
304 LOGLS_WARN(_log,
"Could not read ApCorrMap; setting to null: " << err.what());
306 int validPolygonId = popInt(*metadata,
"VALID_POLYGON_ID");
309 }
catch (pex::exceptions::NotFoundError & err) {
310 LOGLS_WARN(_log,
"Could not read ValidPolygon; setting to null: " << err.what());
#define LOGLS_WARN(logger, message)
Log a warn-level message using an iostream-based interface.
boost::shared_ptr< ApCorrMap > _apCorrMap
boost::shared_ptr< detection::Psf > getPsf() const
Return the exposure's point-spread function.
table::Key< std::string > name
void _finishWriteFits(fits::Fits &fitsfile, FitsWriteData const &data) const
Write any additional non-image HDUs to a FITS file.
boost::shared_ptr< daf::base::PropertyList > imageMetadata
boost::shared_ptr< image::VisitInfo const > getVisitInfo() const
Return the exposure's visit info.
boost::shared_ptr< image::VisitInfo const > _visitInfo
Class for storing ordered metadata with comments.
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
Include files required for standard LSST Exception handling.
static boost::shared_ptr< Wcs > _cloneWcs(boost::shared_ptr< Wcs const > wcs)
Information about a single exposure of an imaging camera.
int put(Persistable const *obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
bool hasValidPolygon() const
Does this exposure have a valid Polygon.
Implementation of the WCS standard for a any projection.
ExposureInfo(boost::shared_ptr< Wcs const > const &wcs=boost::shared_ptr< Wcs const >(), boost::shared_ptr< detection::Psf const > const &psf=boost::shared_ptr< detection::Psf const >(), boost::shared_ptr< Calib const > const &calib=boost::shared_ptr< Calib const >(), boost::shared_ptr< cameraGeom::Detector const > const &detector=boost::shared_ptr< cameraGeom::Detector const >(), boost::shared_ptr< geom::polygon::Polygon const > const &polygon=boost::shared_ptr< geom::polygon::Polygon const >(), Filter const &filter=Filter(), boost::shared_ptr< daf::base::PropertySet > const &metadata=boost::shared_ptr< daf::base::PropertySet >(), boost::shared_ptr< CoaddInputs > const &coaddInputs=boost::shared_ptr< CoaddInputs >(), boost::shared_ptr< ApCorrMap > const &apCorrMap=boost::shared_ptr< ApCorrMap >(), boost::shared_ptr< image::VisitInfo const > const &visitInfo=boost::shared_ptr< image::VisitInfo const >())
Construct an ExposureInfo from its various components.
bool hasCoaddInputs() const
Does this exposure have coadd provenance catalogs?
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
bool exists(std::string const &name) const
Determine if a name (possibly hierarchical) exists.
boost::shared_ptr< cameraGeom::Detector const > getDetector() const
Return the exposure's Detector information.
Describe an exposure's calibration.
static boost::shared_ptr< Calib > _cloneCalib(boost::shared_ptr< Calib const > calib)
table::Key< table::Array< Kernel::Pixel > > image
LSST DM logging module built on log4cxx.
lsst::daf::base::PropertySet PropertySet
boost::shared_ptr< daf::base::PropertySet > _metadata
ExposureInfo & operator=(ExposureInfo const &other)
Assignment; deep-copies all components except the metadata.
void writeFits(fits::Fits &fitsfile) const
Write the archive to an already-open FITS object.
boost::shared_ptr< Wcs > makeWcs(boost::shared_ptr< lsst::daf::base::PropertySet > const &fitsMetadata, bool stripMetadata=false)
Create a Wcs object from a fits header.
void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo)
Set FITS metadata from a VisitInfo.
boost::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Return the valid Polygon.
A struct passed back and forth between Exposure and ExposureInfo when writing FITS files...
boost::shared_ptr< detection::Psf > _psf
void initApCorrMap()
Set the exposure's aperture correction map to a new, empty map.
boost::shared_ptr< Wcs > getWcs()
Return the coordinate system of the exposure.
boost::shared_ptr< daf::base::PropertyList > maskMetadata
boost::shared_ptr< Wcs > _wcs
boost::shared_ptr< ApCorrMap > getApCorrMap()
Return the exposure's aperture correction map (null pointer if !hasApCorrMap())
Classes to support calibration (e.g.
Holds an integer identifier for an LSST filter.
void setHdu(int hdu, bool relative=false)
Set the current HDU.
int stripCalibKeywords(boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
Remove Calib-related keywords from the metadata.
#define LOGLS_INFO(logger, message)
Log a info-level message using an iostream-based interface.
boost::shared_ptr< cameraGeom::Detector const > _detector
Utilities for working with FITS files.
static boost::shared_ptr< ApCorrMap > _cloneApCorrMap(boost::shared_ptr< ApCorrMap const > apCorrMap)
Filter getFilter() const
Return the exposure's filter.
Information about a CCD or other imaging detector.
bool hasPsf() const
Does this exposure have a Psf?
void setCalib(boost::shared_ptr< Calib const > calib)
Set the Exposure's Calib object.
bool hasWcs() const
Does this exposure have a Wcs?
void _readFits(fits::Fits &fitsfile, boost::shared_ptr< daf::base::PropertySet > metadata, boost::shared_ptr< daf::base::PropertySet > imageMetadata)
Read from a FITS file and metadata.
Class for storing generic metadata.
table::io::OutputArchive archive
boost::shared_ptr< daf::base::PropertySet > getMetadata() const
Return flexible metadata.
int stripVisitInfoKeywords(daf::base::PropertySet &metadata)
Remove VisitInfo-related keywords from the metadata.
int stripFilterKeywords(boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
Remove Filter-related keywords from the metadata.
bool hasApCorrMap() const
Return true if the exposure has an aperture correction map.
boost::shared_ptr< Calib > _calib
boost::shared_ptr< CoaddInputs > getCoaddInputs() const
Return a pair of catalogs that record the inputs, if this Exposure is a coadd (otherwise null)...
#define CONST_PTR(...)
A shared pointer to a const object.
boost::shared_ptr< daf::base::PropertyList > metadata
#define LOG_GET(logger)
Returns a Log object associated with logger.
A collection of all the things that make an Exposure different from a MaskedImage.
A polymorphic base class for representing an image's Point Spread Function.
boost::shared_ptr< daf::base::PropertyList > varianceMetadata
boost::shared_ptr< Calib > getCalib()
Return the exposure's photometric calibration.
daf::base::PropertySet & _metadata
bool hasDetector() const
Does this exposure have Detector information?
FitsWriteData _startWriteFits(geom::Point2I const &xy0=geom::Point2I()) const
Start the process of writing an exposure to FITS.
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
boost::shared_ptr< CoaddInputs > _coaddInputs