35 namespace lsst {
namespace afw {
namespace image {
42 if (metadata.exists(name)) {
43 r = metadata.get<
int>(
name);
44 metadata.remove(name);
68 return boost::make_shared<ApCorrMap>(*apCorrMap);
83 ) : _wcs(_cloneWcs(wcs)),
84 _psf(boost::const_pointer_cast<detection::Psf>(psf)),
87 _validPolygon(polygon),
90 _coaddInputs(coaddInputs),
91 _apCorrMap(_cloneApCorrMap(apCorrMap))
95 _wcs(_cloneWcs(other._wcs)),
97 _calib(_cloneCalib(other._calib)),
98 _detector(other._detector),
99 _validPolygon(other._validPolygon),
100 _filter(other._filter),
102 _coaddInputs(other._coaddInputs),
103 _apCorrMap(_cloneApCorrMap(other._apCorrMap))
107 _wcs(_cloneWcs(other._wcs)),
109 _calib(_cloneCalib(other._calib)),
110 _detector(other._detector),
111 _validPolygon(other._validPolygon),
112 _filter(other._filter),
114 _coaddInputs(other._coaddInputs),
115 _apCorrMap(_cloneApCorrMap(other._apCorrMap))
121 if (&other !=
this) {
155 data.
metadata->set(
"AR_HDU", 5,
"HDU containing the archive used to store ancillary objects");
158 data.
metadata->set(
"COADD_INPUTS_ID", coaddInputsId,
"archive ID for coadd inputs catalogs");
162 data.
metadata->set(
"AP_CORR_MAP_ID", apCorrMapId,
"archive ID for aperture correction map");
166 data.
metadata->set(
"PSF_ID", psfId,
"archive ID for the Exposure's main Psf");
170 data.
metadata->set(
"WCS_ID", wcsId,
"archive ID for the Exposure's main Wcs");
174 data.
metadata->set(
"VALID_POLYGON_ID", polygonId,
"archive ID for the Exposure's valid polygon");
184 newWcs->shiftReferencePixel(-xy0.getX(), -xy0.getY() );
232 if (!imageMetadata->
exists(
"INHERIT")) {
238 metadata = imageMetadata;
248 int archiveHdu = popInt(*metadata,
"AR_HDU");
251 fitsfile.
setHdu(archiveHdu);
257 int psfId = popInt(*metadata,
"PSF_ID");
260 }
catch (pex::exceptions::NotFoundError & err) {
262 boost::format(
"Could not read PSF; setting to null: %s") % err.what()
265 int wcsId = popInt(*metadata,
"WCS_ID");
267 auto archiveWcs = archive.
get<
Wcs>(wcsId);
273 }
catch (pex::exceptions::NotFoundError & err) {
274 auto msg = str(
boost::format(
"Could not read WCS extension; setting to null: %s") % err.what());
276 msg +=
" ; using WCS from FITS header";
281 int coaddInputsId = popInt(*metadata,
"COADD_INPUTS_ID");
284 }
catch (pex::exceptions::NotFoundError & err) {
286 boost::format(
"Could not read CoaddInputs; setting to null: %s") % err.what()
289 int apCorrMapId = popInt(*metadata,
"AP_CORR_MAP_ID");
292 }
catch (pex::exceptions::NotFoundError & err) {
294 boost::format(
"Could not read ApCorrMap; setting to null: %s") % err.what()
297 int validPolygonId = popInt(*metadata,
"VALID_POLYGON_ID");
300 }
catch (pex::exceptions::NotFoundError & err) {
302 boost::format(
"Could not read ValidPolygon; setting to null: %s") % err.what()
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
Class for storing ordered metadata with comments.
Include files required for standard LSST Exception handling.
A thin wrapper around std::map to allow aperture corrections to be attached to Exposures.
static boost::shared_ptr< Wcs > _cloneWcs(boost::shared_ptr< Wcs const > wcs)
bool hasValidPolygon() const
Does this exposure have a valid Polygon.
Implementation of the WCS standard for a any projection.
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...
static Log & getDefaultLog()
boost::shared_ptr< cameraGeom::Detector const > getDetector() const
Return the exposure's Detector information.
static boost::shared_ptr< Calib > _cloneCalib(boost::shared_ptr< Calib const > calib)
table::Key< table::Array< Kernel::Pixel > > image
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.
Wcs::Ptr makeWcs(boost::shared_ptr< lsst::daf::base::PropertySet > const &fitsMetadata, bool stripMetadata=false)
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...
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 >())
Construct an ExposureInfo from its various components.
boost::shared_ptr< detection::Psf > _psf
boost::shared_ptr< Wcs > getWcs()
Return the coordinate system of the exposure.
void writeFits(fits::Fits &fitsfile) const
Write the archive to an already-open FITS object.
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())
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)
boost::shared_ptr< cameraGeom::Detector const > _detector
static boost::shared_ptr< ApCorrMap > _cloneApCorrMap(boost::shared_ptr< ApCorrMap const > apCorrMap)
Filter getFilter() const
Return the exposure's filter.
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.
void warn(const std::string &message, const lsst::daf::base::PropertySet &properties)
table::io::OutputArchive archive
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...
boost::shared_ptr< daf::base::PropertySet > getMetadata() const
Return flexible metadata.
int stripFilterKeywords(boost::shared_ptr< lsst::daf::base::PropertySet > 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)...
boost::shared_ptr< daf::base::PropertyList > metadata
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 exists(std::string const &name) const
bool hasDetector() const
Does this exposure have Detector information?
void info(const std::string &message, const lsst::daf::base::PropertySet &properties)
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