LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
lsst.afw.image::ExposureInfo Class Reference

A collection of all the things that make an Exposure different from a MaskedImage. More...

#include <ExposureInfo.h>

Classes

struct  FitsWriteData
 A struct passed back and forth between Exposure and ExposureInfo when writing FITS files. More...
 

Public Member Functions

bool hasWcs () const
 Does this exposure have a Wcs? More...
 
boost::shared_ptr< WcsgetWcs ()
 Return the coordinate system of the exposure. More...
 
boost::shared_ptr< Wcs const > getWcs () const
 Return the coordinate system of the exposure. More...
 
void setWcs (boost::shared_ptr< Wcs const > wcs)
 Set the coordinate system of the exposure. More...
 
bool hasDetector () const
 Does this exposure have Detector information? More...
 
boost::shared_ptr
< cameraGeom::Detector const > 
getDetector () const
 Return the exposure's Detector information. More...
 
void setDetector (boost::shared_ptr< cameraGeom::Detector const > detector)
 Set the exposure's Detector information. More...
 
Filter getFilter () const
 Return the exposure's filter. More...
 
void setFilter (Filter const &filter)
 Set the exposure's filter. More...
 
bool hasCalib () const
 Does this exposure have a Calib? More...
 
boost::shared_ptr< CalibgetCalib ()
 Return the exposure's photometric calibration. More...
 
boost::shared_ptr< Calib const > getCalib () const
 Return the exposure's photometric calibration. More...
 
void setCalib (boost::shared_ptr< Calib const > calib)
 Set the Exposure's Calib object. More...
 
boost::shared_ptr
< daf::base::PropertySet
getMetadata () const
 Return flexible metadata. More...
 
void setMetadata (boost::shared_ptr< daf::base::PropertySet > metadata)
 Set the flexible metadata. More...
 
bool hasPsf () const
 Does this exposure have a Psf? More...
 
boost::shared_ptr< detection::PsfgetPsf () const
 Return the exposure's point-spread function. More...
 
void setPsf (boost::shared_ptr< detection::Psf const > psf)
 Set the exposure's point-spread function. More...
 
bool hasValidPolygon () const
 Does this exposure have a valid Polygon. More...
 
boost::shared_ptr
< geom::polygon::Polygon const > 
getValidPolygon () const
 Return the valid Polygon. More...
 
void setValidPolygon (boost::shared_ptr< geom::polygon::Polygon const > polygon)
 Set the exposure's valid Polygon. More...
 
bool hasApCorrMap () const
 Return true if the exposure has an aperture correction map. More...
 
boost::shared_ptr< ApCorrMapgetApCorrMap ()
 Return the exposure's aperture correction map (null pointer if !hasApCorrMap()) More...
 
boost::shared_ptr< ApCorrMap
const > 
getApCorrMap () const
 Return the exposure's aperture correction map (null pointer if !hasApCorrMap()) More...
 
void setApCorrMap (boost::shared_ptr< ApCorrMap > apCorrMap)
 Set the exposure's aperture correction map (null pointer if !hasApCorrMap()) More...
 
void initApCorrMap ()
 
bool hasCoaddInputs () const
 Does this exposure have coadd provenance catalogs? More...
 
void setCoaddInputs (boost::shared_ptr< CoaddInputs > coaddInputs)
 Set the exposure's coadd provenance catalogs. More...
 
boost::shared_ptr< CoaddInputsgetCoaddInputs () const
 Return a pair of catalogs that record the inputs, if this Exposure is a coadd (otherwise null). More...
 
 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. More...
 
 ExposureInfo (ExposureInfo const &other)
 Copy constructor; deep-copies all components except the metadata. More...
 
 ExposureInfo (ExposureInfo const &other, bool copyMetadata)
 Copy constructor; deep-copies everything, possibly including the metadata. More...
 
ExposureInfooperator= (ExposureInfo const &other)
 Assignment; deep-copies all components except the metadata. More...
 
 ~ExposureInfo ()
 

Private Member Functions

FitsWriteData _startWriteFits (geom::Point2I const &xy0=geom::Point2I()) const
 Start the process of writing an exposure to FITS. More...
 
void _finishWriteFits (fits::Fits &fitsfile, FitsWriteData const &data) const
 Write any additional non-image HDUs to a FITS file. More...
 
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. More...
 

Static Private Member Functions

static boost::shared_ptr< Calib_cloneCalib (boost::shared_ptr< Calib const > calib)
 
static boost::shared_ptr< Wcs_cloneWcs (boost::shared_ptr< Wcs const > wcs)
 
static boost::shared_ptr
< ApCorrMap
_cloneApCorrMap (boost::shared_ptr< ApCorrMap const > apCorrMap)
 

Private Attributes

boost::shared_ptr< Wcs_wcs
 
boost::shared_ptr< detection::Psf_psf
 
boost::shared_ptr< Calib_calib
 
boost::shared_ptr
< cameraGeom::Detector const > 
_detector
 
boost::shared_ptr
< geom::polygon::Polygon const > 
_validPolygon
 
Filter _filter
 
boost::shared_ptr
< daf::base::PropertySet
_metadata
 
boost::shared_ptr< CoaddInputs_coaddInputs
 
boost::shared_ptr< ApCorrMap_apCorrMap
 

Friends

template<typename ImageT , typename MaskT , typename VarianceT >
class Exposure
 

Detailed Description

A collection of all the things that make an Exposure different from a MaskedImage.

The constness semantics of the things held by ExposureInfo are admittedly a bit of a mess, but they're that way to preserve backwards compatibility for now. Eventually I'd like to make a lot of these things immutable, but in the meantime, here's the summary:

The setters for Wcs and Calib clone their input arguments (this is a departure from the previous behavior for Calib and Wcs but it's safer w.r.t. aliasing and it matches the old (and current) behavior of the Exposure and ExposureInfo constructors, which clone their arguments. The setter for Psf and constructors do not clone the Psf, as Psfs are immutable and hence we don't need to ensure strict ownership. The setter for Detector does not clone its input argument, because while it technically isn't, we can safely consider a Detector to be immutable once it's attached to an ExposureInfo.

Definition at line 80 of file ExposureInfo.h.

Constructor & Destructor Documentation

lsst.afw.image::ExposureInfo::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 >() 
)
explicit

Construct an ExposureInfo from its various components.

If a null Calib and/or PropertySet pointer is passed (the default), a new Calib and/or PropertyList will be created. To set these pointers to null, you must explicitly call setCalib or setMetadata after construction.

Definition at line 73 of file ExposureInfo.cc.

83  : _wcs(_cloneWcs(wcs)),
84  _psf(boost::const_pointer_cast<detection::Psf>(psf)),
85  _calib(calib ? _cloneCalib(calib) : PTR(Calib)(new Calib())),
86  _detector(detector),
87  _validPolygon(polygon),
88  _filter(filter),
89  _metadata(metadata ? metadata : PTR(daf::base::PropertySet)(new daf::base::PropertyList())),
90  _coaddInputs(coaddInputs),
91  _apCorrMap(_cloneApCorrMap(apCorrMap))
92 {}
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:283
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:278
static boost::shared_ptr< ApCorrMap > _cloneApCorrMap(boost::shared_ptr< ApCorrMap const > apCorrMap)
Definition: ExposureInfo.cc:66
tbl::Key< int > wcs
lsst::daf::base::PropertyList PropertyList
Definition: Wcs.cc:59
boost::shared_ptr< daf::base::PropertySet > _metadata
Definition: ExposureInfo.h:282
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:280
lsst::daf::base::PropertySet PropertySet
Definition: Wcs.cc:58
boost::shared_ptr< cameraGeom::Detector const > _detector
Definition: ExposureInfo.h:279
static boost::shared_ptr< Wcs > _cloneWcs(boost::shared_ptr< Wcs const > wcs)
Definition: ExposureInfo.cc:60
static boost::shared_ptr< Calib > _cloneCalib(boost::shared_ptr< Calib const > calib)
Definition: ExposureInfo.cc:54
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:277
lsst.afw.image::ExposureInfo::ExposureInfo ( ExposureInfo const &  other)

Copy constructor; deep-copies all components except the metadata.

Definition at line 94 of file ExposureInfo.cc.

94  :
95  _wcs(_cloneWcs(other._wcs)),
96  _psf(other._psf),
97  _calib(_cloneCalib(other._calib)),
98  _detector(other._detector),
99  _validPolygon(other._validPolygon),
100  _filter(other._filter),
101  _metadata(other._metadata),
102  _coaddInputs(other._coaddInputs),
103  _apCorrMap(_cloneApCorrMap(other._apCorrMap))
104 {}
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:283
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:278
static boost::shared_ptr< ApCorrMap > _cloneApCorrMap(boost::shared_ptr< ApCorrMap const > apCorrMap)
Definition: ExposureInfo.cc:66
boost::shared_ptr< daf::base::PropertySet > _metadata
Definition: ExposureInfo.h:282
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:280
boost::shared_ptr< cameraGeom::Detector const > _detector
Definition: ExposureInfo.h:279
static boost::shared_ptr< Wcs > _cloneWcs(boost::shared_ptr< Wcs const > wcs)
Definition: ExposureInfo.cc:60
static boost::shared_ptr< Calib > _cloneCalib(boost::shared_ptr< Calib const > calib)
Definition: ExposureInfo.cc:54
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:277
lsst.afw.image::ExposureInfo::ExposureInfo ( ExposureInfo const &  other,
bool  copyMetadata 
)

Copy constructor; deep-copies everything, possibly including the metadata.

Definition at line 106 of file ExposureInfo.cc.

106  :
107  _wcs(_cloneWcs(other._wcs)),
108  _psf(other._psf),
109  _calib(_cloneCalib(other._calib)),
110  _detector(other._detector),
111  _validPolygon(other._validPolygon),
112  _filter(other._filter),
113  _metadata(other._metadata),
114  _coaddInputs(other._coaddInputs),
115  _apCorrMap(_cloneApCorrMap(other._apCorrMap))
116 {
117  if (copyMetadata) _metadata = _metadata->deepCopy();
118 }
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:283
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:278
static boost::shared_ptr< ApCorrMap > _cloneApCorrMap(boost::shared_ptr< ApCorrMap const > apCorrMap)
Definition: ExposureInfo.cc:66
boost::shared_ptr< daf::base::PropertySet > _metadata
Definition: ExposureInfo.h:282
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:280
boost::shared_ptr< cameraGeom::Detector const > _detector
Definition: ExposureInfo.h:279
static boost::shared_ptr< Wcs > _cloneWcs(boost::shared_ptr< Wcs const > wcs)
Definition: ExposureInfo.cc:60
static boost::shared_ptr< Calib > _cloneCalib(boost::shared_ptr< Calib const > calib)
Definition: ExposureInfo.cc:54
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:277
lsst.afw.image::ExposureInfo::~ExposureInfo ( )

Definition at line 139 of file ExposureInfo.cc.

139 {}

Member Function Documentation

boost::shared_ptr< ApCorrMap > lsst.afw.image::ExposureInfo::_cloneApCorrMap ( boost::shared_ptr< ApCorrMap const >  apCorrMap)
staticprivate

Definition at line 66 of file ExposureInfo.cc.

66  {
67  if (apCorrMap) {
68  return boost::make_shared<ApCorrMap>(*apCorrMap);
69  }
70  return PTR(ApCorrMap)();
71 }
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< Calib > lsst.afw.image::ExposureInfo::_cloneCalib ( boost::shared_ptr< Calib const >  calib)
staticprivate

Definition at line 54 of file ExposureInfo.cc.

54  {
55  if (calib)
56  return PTR(Calib)(new Calib(*calib));
57  return PTR(Calib)();
58 }
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< Wcs > lsst.afw.image::ExposureInfo::_cloneWcs ( boost::shared_ptr< Wcs const >  wcs)
staticprivate

Definition at line 60 of file ExposureInfo.cc.

60  {
61  if (wcs)
62  return wcs->clone();
63  return PTR(Wcs)();
64 }
#define PTR(...)
Definition: base.h:41
tbl::Key< int > wcs
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
void lsst.afw.image::ExposureInfo::_finishWriteFits ( fits::Fits fitsfile,
FitsWriteData const &  data 
) const
private

Write any additional non-image HDUs to a FITS file.

Parameters
[in]fitsfileOpen FITS object to write to. Does not need to be positioned to any particular HDU.

The additional HDUs will be appended to the FITS file, and should line up with the HDU index keys included in the result of getFitsMetadata() if this is called after writing the MaskedImage HDUs.

See Also
FitsWriteData

Definition at line 220 of file ExposureInfo.cc.

220  {
221  data.archive.writeFits(fitsfile);
222 }
void lsst.afw.image::ExposureInfo::_readFits ( fits::Fits fitsfile,
boost::shared_ptr< daf::base::PropertySet metadata,
boost::shared_ptr< daf::base::PropertySet imageMetadata 
)
private

Read from a FITS file and metadata.

This operates in-place on this instead of returning a new object, because it will usually only be called by the exposure constructor, which starts by default-constructing the ExposureInfo.

Definition at line 224 of file ExposureInfo.cc.

228  {
229  // true: strip keywords that are related to the created WCS from the input metadata
230  _wcs = makeWcs(imageMetadata, true);
231 
232  if (!imageMetadata->exists("INHERIT")) {
233  // New-style exposures put everything but the Wcs in the primary HDU, use
234  // INHERIT keyword in the others. For backwards compatibility, if we don't
235  // find the INHERIT keyword, we ignore the primary HDU metadata and expect
236  // everything to be in the image HDU metadata. Note that we can't merge them,
237  // because they're probably duplicates.
238  metadata = imageMetadata;
239  }
240 
241  _filter = Filter(metadata, true);
242  detail::stripFilterKeywords(metadata);
243 
244  PTR(Calib) newCalib(new Calib(metadata));
245  setCalib(newCalib);
246  detail::stripCalibKeywords(metadata);
247 
248  int archiveHdu = popInt(*metadata, "AR_HDU");
249 
250  if (archiveHdu) {
251  fitsfile.setHdu(archiveHdu);
252  table::io::InputArchive archive = table::io::InputArchive::readFits(fitsfile);
253  // Load the Psf and Wcs from the archive; id=0 results in a null pointer.
254  // Note that the binary table Wcs, if present, clobbers the FITS header one,
255  // because the former might be an approximation to something we can't represent
256  // using the FITS WCS standard but can represent with binary tables.
257  int psfId = popInt(*metadata, "PSF_ID");
258  try {
259  _psf = archive.get<detection::Psf>(psfId);
260  } catch (pex::exceptions::NotFoundError & err) {
262  boost::format("Could not read PSF; setting to null: %s") % err.what()
263  );
264  }
265  int wcsId = popInt(*metadata, "WCS_ID");
266  try {
267  auto archiveWcs = archive.get<Wcs>(wcsId);
268  if (archiveWcs) {
269  _wcs = archiveWcs;
270  } else {
271  pex::logging::Log::getDefaultLog().info("Empty WCS extension, using FITS header");
272  }
273  } catch (pex::exceptions::NotFoundError & err) {
274  auto msg = str(boost::format("Could not read WCS extension; setting to null: %s") % err.what());
275  if (_wcs) {
276  msg += " ; using WCS from FITS header";
277  }
278 
280  }
281  int coaddInputsId = popInt(*metadata, "COADD_INPUTS_ID");
282  try {
283  _coaddInputs = archive.get<CoaddInputs>(coaddInputsId);
284  } catch (pex::exceptions::NotFoundError & err) {
286  boost::format("Could not read CoaddInputs; setting to null: %s") % err.what()
287  );
288  }
289  int apCorrMapId = popInt(*metadata, "AP_CORR_MAP_ID");
290  try {
291  _apCorrMap = archive.get<ApCorrMap>(apCorrMapId);
292  } catch (pex::exceptions::NotFoundError & err) {
294  boost::format("Could not read ApCorrMap; setting to null: %s") % err.what()
295  );
296  }
297  int validPolygonId = popInt(*metadata, "VALID_POLYGON_ID");
298  try {
299  _validPolygon = archive.get<geom::polygon::Polygon>(validPolygonId);
300  } catch (pex::exceptions::NotFoundError & err) {
302  boost::format("Could not read ValidPolygon; setting to null: %s") % err.what()
303  );
304  }
305  }
306 
307  _metadata = metadata;
308 }
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:283
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
static Log & getDefaultLog()
boost::shared_ptr< daf::base::PropertySet > _metadata
Definition: ExposureInfo.h:282
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:280
Wcs::Ptr makeWcs(boost::shared_ptr< lsst::daf::base::PropertySet > const &fitsMetadata, bool stripMetadata=false)
Definition: makeWcs.cc:40
void setCalib(boost::shared_ptr< Calib const > calib)
Set the Exposure&#39;s Calib object.
Definition: ExposureInfo.h:120
if(width!=gim.getWidth()||height!=gim.getHeight()||x0!=gim.getX0()||y0!=gim.getY0())
Definition: saturated.cc:47
int stripCalibKeywords(boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
Definition: Calib.cc:159
static InputArchive readFits(fits::Fits &fitsfile)
Read an object from an already open FITS object.
void warn(const std::string &message, const lsst::daf::base::PropertySet &properties)
Definition: Log.h:494
int stripFilterKeywords(boost::shared_ptr< lsst::daf::base::PropertySet > metadata)
Definition: Filter.cc:167
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:68
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:277
void info(const std::string &message, const lsst::daf::base::PropertySet &properties)
Definition: Log.h:493
ExposureInfo::FitsWriteData lsst.afw.image::ExposureInfo::_startWriteFits ( geom::Point2I const &  xy0 = geom::Point2I()) const
private

Start the process of writing an exposure to FITS.

Parameters
[in]xy0The origin of the exposure associated with this object, used to install a linear offset-only WCS in the FITS header.
See Also
FitsWriteData

We need to define these keywords properly! XXX

Definition at line 142 of file ExposureInfo.cc.

142  {
143 
144  FitsWriteData data;
145 
146  data.metadata.reset(new daf::base::PropertyList());
147  data.imageMetadata.reset(new daf::base::PropertyList());
148  data.maskMetadata = data.imageMetadata;
149  data.varianceMetadata = data.imageMetadata;
150 
151  data.metadata->combine(getMetadata());
152 
153  // In the future, we might not have exactly three image HDUs, but we always do right now,
154  // so 1=primary, 2=image, 3=mask, 4=variance, 5+=archive
155  data.metadata->set("AR_HDU", 5, "HDU containing the archive used to store ancillary objects");
156  if (hasCoaddInputs()) {
157  int coaddInputsId = data.archive.put(getCoaddInputs());
158  data.metadata->set("COADD_INPUTS_ID", coaddInputsId, "archive ID for coadd inputs catalogs");
159  }
160  if (hasApCorrMap()) {
161  int apCorrMapId = data.archive.put(getApCorrMap());
162  data.metadata->set("AP_CORR_MAP_ID", apCorrMapId, "archive ID for aperture correction map");
163  }
164  if (hasPsf() && getPsf()->isPersistable()) {
165  int psfId = data.archive.put(getPsf());
166  data.metadata->set("PSF_ID", psfId, "archive ID for the Exposure's main Psf");
167  }
168  if (hasWcs() && getWcs()->isPersistable()) {
169  int wcsId = data.archive.put(getWcs());
170  data.metadata->set("WCS_ID", wcsId, "archive ID for the Exposure's main Wcs");
171  }
172  if (hasValidPolygon() && getValidPolygon()->isPersistable()) {
173  int polygonId = data.archive.put(getValidPolygon());
174  data.metadata->set("VALID_POLYGON_ID", polygonId, "archive ID for the Exposure's valid polygon");
175  }
176 
177  //LSST convention is that Wcs is in pixel coordinates (i.e relative to bottom left
178  //corner of parent image, if any). The Wcs/Fits convention is that the Wcs is in
179  //image coordinates. When saving an image we convert from pixel to index coordinates.
180  //In the case where this image is a parent image, the reference pixels are unchanged
181  //by this transformation
182  if (hasWcs()) {
183  PTR(Wcs) newWcs = getWcs()->clone(); //Create a copy
184  newWcs->shiftReferencePixel(-xy0.getX(), -xy0.getY() );
185 
186  // We want the WCS to appear in all HDUs
187  data.imageMetadata->combine(newWcs->getFitsMetadata());
188  }
189 
190  //Store _x0 and _y0. If this exposure is a portion of a larger image, _x0 and _y0
191  //indicate the origin (the position of the bottom left corner) of the sub-image with
192  //respect to the origin of the parent image.
193  //This is stored in the fits header using the LTV convention used by STScI
194  //(see \S2.6.2 of HST Data Handbook for STIS, version 5.0
195  // http://www.stsci.edu/hst/stis/documents/handbooks/currentDHB/ch2_stis_data7.html#429287).
196  //This is not a fits standard keyword, but is recognised by ds9
197  //LTV keywords use the opposite convention to the LSST, in that they represent
198  //the position of the origin of the parent image relative to the origin of the sub-image.
199  // _x0, _y0 >= 0, while LTV1 and LTV2 <= 0
200 
201  data.imageMetadata->set("LTV1", -xy0.getX());
202  data.imageMetadata->set("LTV2", -xy0.getY());
203 
204  data.metadata->set("FILTER", getFilter().getName());
205  if (hasDetector()) {
206  data.metadata->set("DETNAME", getDetector()->getName());
207  data.metadata->set("DETSER", getDetector()->getSerial());
208  }
212  data.metadata->set("TIME-MID", getCalib()->getMidTime().toString());
213  data.metadata->set("EXPTIME", getCalib()->getExptime());
214  data.metadata->set("FLUXMAG0", getCalib()->getFluxMag0().first);
215  data.metadata->set("FLUXMAG0ERR", getCalib()->getFluxMag0().second);
216 
217  return data;
218 }
bool hasWcs() const
Does this exposure have a Wcs?
Definition: ExposureInfo.h:84
#define PTR(...)
Definition: base.h:41
bool hasCoaddInputs() const
Does this exposure have coadd provenance catalogs?
Definition: ExposureInfo.h:171
bool hasApCorrMap() const
Return true if the exposure has an aperture correction map.
Definition: ExposureInfo.h:151
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
boost::shared_ptr< cameraGeom::Detector const > getDetector() const
Return the exposure&#39;s Detector information.
Definition: ExposureInfo.h:99
lsst::daf::base::PropertyList PropertyList
Definition: Wcs.cc:59
boost::shared_ptr< daf::base::PropertySet > getMetadata() const
Return flexible metadata.
Definition: ExposureInfo.h:123
bool hasPsf() const
Does this exposure have a Psf?
Definition: ExposureInfo.h:129
boost::shared_ptr< Calib > getCalib()
Return the exposure&#39;s photometric calibration.
Definition: ExposureInfo.h:114
boost::shared_ptr< Wcs > getWcs()
Return the coordinate system of the exposure.
Definition: ExposureInfo.h:87
if(width!=gim.getWidth()||height!=gim.getHeight()||x0!=gim.getX0()||y0!=gim.getY0())
Definition: saturated.cc:47
bool hasValidPolygon() const
Does this exposure have a valid Polygon.
Definition: ExposureInfo.h:142
boost::shared_ptr< geom::polygon::Polygon const > getValidPolygon() const
Return the valid Polygon.
Definition: ExposureInfo.h:145
boost::shared_ptr< detection::Psf > getPsf() const
Return the exposure&#39;s point-spread function.
Definition: ExposureInfo.h:132
boost::shared_ptr< CoaddInputs > getCoaddInputs() const
Return a pair of catalogs that record the inputs, if this Exposure is a coadd (otherwise null)...
Definition: ExposureInfo.h:177
Filter getFilter() const
Return the exposure&#39;s filter.
Definition: ExposureInfo.h:105
bool hasDetector() const
Does this exposure have Detector information?
Definition: ExposureInfo.h:96
boost::shared_ptr< ApCorrMap > getApCorrMap()
Return the exposure&#39;s aperture correction map (null pointer if !hasApCorrMap())
Definition: ExposureInfo.h:154
boost::shared_ptr< ApCorrMap > lsst.afw.image::ExposureInfo::getApCorrMap ( )
inline

Return the exposure's aperture correction map (null pointer if !hasApCorrMap())

Definition at line 154 of file ExposureInfo.h.

154 { return _apCorrMap; }
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
boost::shared_ptr< ApCorrMap const > lsst.afw.image::ExposureInfo::getApCorrMap ( ) const
inline

Return the exposure's aperture correction map (null pointer if !hasApCorrMap())

Definition at line 157 of file ExposureInfo.h.

157 { return _apCorrMap; }
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
boost::shared_ptr< Calib > lsst.afw.image::ExposureInfo::getCalib ( )
inline

Return the exposure's photometric calibration.

Definition at line 114 of file ExposureInfo.h.

114 { return _calib; }
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:278
boost::shared_ptr< Calib const> lsst.afw.image::ExposureInfo::getCalib ( ) const
inline

Return the exposure's photometric calibration.

Definition at line 117 of file ExposureInfo.h.

117 { return _calib; }
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:278
boost::shared_ptr< CoaddInputs > lsst.afw.image::ExposureInfo::getCoaddInputs ( ) const
inline

Return a pair of catalogs that record the inputs, if this Exposure is a coadd (otherwise null).

Definition at line 177 of file ExposureInfo.h.

177 { return _coaddInputs; }
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:283
boost::shared_ptr< cameraGeom::Detector const> lsst.afw.image::ExposureInfo::getDetector ( ) const
inline

Return the exposure's Detector information.

Definition at line 99 of file ExposureInfo.h.

99 { return _detector; }
boost::shared_ptr< cameraGeom::Detector const > _detector
Definition: ExposureInfo.h:279
Filter lsst.afw.image::ExposureInfo::getFilter ( ) const
inline

Return the exposure's filter.

Definition at line 105 of file ExposureInfo.h.

105 { return _filter; }
boost::shared_ptr< daf::base::PropertySet > lsst.afw.image::ExposureInfo::getMetadata ( ) const
inline

Return flexible metadata.

Definition at line 123 of file ExposureInfo.h.

123 { return _metadata; }
boost::shared_ptr< daf::base::PropertySet > _metadata
Definition: ExposureInfo.h:282
boost::shared_ptr< detection::Psf > lsst.afw.image::ExposureInfo::getPsf ( ) const
inline

Return the exposure's point-spread function.

Definition at line 132 of file ExposureInfo.h.

132 { return _psf; }
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:277
boost::shared_ptr< geom::polygon::Polygon const> lsst.afw.image::ExposureInfo::getValidPolygon ( ) const
inline

Return the valid Polygon.

Definition at line 145 of file ExposureInfo.h.

145 { return _validPolygon;}
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:280
boost::shared_ptr< Wcs > lsst.afw.image::ExposureInfo::getWcs ( )
inline

Return the coordinate system of the exposure.

Definition at line 87 of file ExposureInfo.h.

87 { return _wcs; }
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
boost::shared_ptr< Wcs const> lsst.afw.image::ExposureInfo::getWcs ( ) const
inline

Return the coordinate system of the exposure.

Definition at line 90 of file ExposureInfo.h.

90 { return _wcs; }
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
bool lsst.afw.image::ExposureInfo::hasApCorrMap ( ) const
inline

Return true if the exposure has an aperture correction map.

Definition at line 151 of file ExposureInfo.h.

151 { return static_cast<bool>(_apCorrMap); }
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
bool lsst.afw.image::ExposureInfo::hasCalib ( ) const
inline

Does this exposure have a Calib?

Definition at line 111 of file ExposureInfo.h.

111 { return static_cast<bool>(_calib); }
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:278
bool lsst.afw.image::ExposureInfo::hasCoaddInputs ( ) const
inline

Does this exposure have coadd provenance catalogs?

Definition at line 171 of file ExposureInfo.h.

171 { return static_cast<bool>(_coaddInputs); }
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:283
bool lsst.afw.image::ExposureInfo::hasDetector ( ) const
inline

Does this exposure have Detector information?

Definition at line 96 of file ExposureInfo.h.

96 { return static_cast<bool>(_detector); }
boost::shared_ptr< cameraGeom::Detector const > _detector
Definition: ExposureInfo.h:279
bool lsst.afw.image::ExposureInfo::hasPsf ( ) const
inline

Does this exposure have a Psf?

Definition at line 129 of file ExposureInfo.h.

129 { return static_cast<bool>(_psf); }
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:277
bool lsst.afw.image::ExposureInfo::hasValidPolygon ( ) const
inline

Does this exposure have a valid Polygon.

Definition at line 142 of file ExposureInfo.h.

142 { return static_cast<bool>(_validPolygon);}
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:280
bool lsst.afw.image::ExposureInfo::hasWcs ( ) const
inline

Does this exposure have a Wcs?

Definition at line 84 of file ExposureInfo.h.

84 { return static_cast<bool>(_wcs); }
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
void lsst.afw.image::ExposureInfo::initApCorrMap ( )

Set the exposure's aperture correction map to a new, empty map

Note that the ExposureInfo constructors do not create an empty aperture correction map, so this method provide a convenient way to initialize one before filling it.

Definition at line 135 of file ExposureInfo.cc.

135  {
136  _apCorrMap = boost::make_shared<ApCorrMap>();
137 }
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
ExposureInfo & lsst.afw.image::ExposureInfo::operator= ( ExposureInfo const &  other)

Assignment; deep-copies all components except the metadata.

Definition at line 120 of file ExposureInfo.cc.

120  {
121  if (&other != this) {
122  _wcs = _cloneWcs(other._wcs);
123  _psf = other._psf;
124  _calib = _cloneCalib(other._calib);
125  _detector = other._detector;
126  _validPolygon = other._validPolygon;
127  _filter = other._filter;
128  _metadata = other._metadata;
129  _coaddInputs = other._coaddInputs;
130  _apCorrMap = _cloneApCorrMap(other._apCorrMap);
131  }
132  return *this;
133 }
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:283
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:278
static boost::shared_ptr< ApCorrMap > _cloneApCorrMap(boost::shared_ptr< ApCorrMap const > apCorrMap)
Definition: ExposureInfo.cc:66
boost::shared_ptr< daf::base::PropertySet > _metadata
Definition: ExposureInfo.h:282
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:280
boost::shared_ptr< cameraGeom::Detector const > _detector
Definition: ExposureInfo.h:279
static boost::shared_ptr< Wcs > _cloneWcs(boost::shared_ptr< Wcs const > wcs)
Definition: ExposureInfo.cc:60
static boost::shared_ptr< Calib > _cloneCalib(boost::shared_ptr< Calib const > calib)
Definition: ExposureInfo.cc:54
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:277
void lsst.afw.image::ExposureInfo::setApCorrMap ( boost::shared_ptr< ApCorrMap apCorrMap)
inline

Set the exposure's aperture correction map (null pointer if !hasApCorrMap())

Definition at line 160 of file ExposureInfo.h.

160 { _apCorrMap = apCorrMap; }
boost::shared_ptr< ApCorrMap > _apCorrMap
Definition: ExposureInfo.h:284
void lsst.afw.image::ExposureInfo::setCalib ( boost::shared_ptr< Calib const >  calib)
inline

Set the Exposure's Calib object.

Definition at line 120 of file ExposureInfo.h.

120 { _calib = _cloneCalib(calib); }
boost::shared_ptr< Calib > _calib
Definition: ExposureInfo.h:278
static boost::shared_ptr< Calib > _cloneCalib(boost::shared_ptr< Calib const > calib)
Definition: ExposureInfo.cc:54
void lsst.afw.image::ExposureInfo::setCoaddInputs ( boost::shared_ptr< CoaddInputs coaddInputs)
inline

Set the exposure's coadd provenance catalogs.

Definition at line 174 of file ExposureInfo.h.

174 { _coaddInputs = coaddInputs; }
boost::shared_ptr< CoaddInputs > _coaddInputs
Definition: ExposureInfo.h:283
void lsst.afw.image::ExposureInfo::setDetector ( boost::shared_ptr< cameraGeom::Detector const >  detector)
inline

Set the exposure's Detector information.

Definition at line 102 of file ExposureInfo.h.

102 { _detector = detector; }
boost::shared_ptr< cameraGeom::Detector const > _detector
Definition: ExposureInfo.h:279
void lsst.afw.image::ExposureInfo::setFilter ( Filter const &  filter)
inline

Set the exposure's filter.

Definition at line 108 of file ExposureInfo.h.

108 { _filter = filter; }
void lsst.afw.image::ExposureInfo::setMetadata ( boost::shared_ptr< daf::base::PropertySet metadata)
inline

Set the flexible metadata.

Definition at line 126 of file ExposureInfo.h.

126 { _metadata = metadata; }
boost::shared_ptr< daf::base::PropertySet > _metadata
Definition: ExposureInfo.h:282
void lsst.afw.image::ExposureInfo::setPsf ( boost::shared_ptr< detection::Psf const >  psf)
inline

Set the exposure's point-spread function.

Definition at line 135 of file ExposureInfo.h.

135  {
136  // Psfs are immutable, so this is always safe; it'd be better to always just pass around
137  // const or non-const pointers, instead of both, but this is more backwards-compatible.
138  _psf = boost::const_pointer_cast<detection::Psf>(psf);
139  }
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:68
boost::shared_ptr< detection::Psf > _psf
Definition: ExposureInfo.h:277
void lsst.afw.image::ExposureInfo::setValidPolygon ( boost::shared_ptr< geom::polygon::Polygon const >  polygon)
inline

Set the exposure's valid Polygon.

Definition at line 148 of file ExposureInfo.h.

148 { _validPolygon = polygon; }
boost::shared_ptr< geom::polygon::Polygon const > _validPolygon
Definition: ExposureInfo.h:280
void lsst.afw.image::ExposureInfo::setWcs ( boost::shared_ptr< Wcs const >  wcs)
inline

Set the coordinate system of the exposure.

Definition at line 93 of file ExposureInfo.h.

93 { _wcs = _cloneWcs(wcs); }
boost::shared_ptr< Wcs > _wcs
Definition: ExposureInfo.h:276
tbl::Key< int > wcs
static boost::shared_ptr< Wcs > _cloneWcs(boost::shared_ptr< Wcs const > wcs)
Definition: ExposureInfo.cc:60

Friends And Related Function Documentation

template<typename ImageT , typename MaskT , typename VarianceT >
friend class Exposure
friend

Definition at line 212 of file ExposureInfo.h.

Member Data Documentation

boost::shared_ptr< ApCorrMap > lsst.afw.image::ExposureInfo::_apCorrMap
private

Definition at line 284 of file ExposureInfo.h.

boost::shared_ptr< Calib > lsst.afw.image::ExposureInfo::_calib
private

Definition at line 278 of file ExposureInfo.h.

boost::shared_ptr< CoaddInputs > lsst.afw.image::ExposureInfo::_coaddInputs
private

Definition at line 283 of file ExposureInfo.h.

boost::shared_ptr< cameraGeom::Detector const> lsst.afw.image::ExposureInfo::_detector
private

Definition at line 279 of file ExposureInfo.h.

Filter lsst.afw.image::ExposureInfo::_filter
private

Definition at line 281 of file ExposureInfo.h.

boost::shared_ptr< daf::base::PropertySet > lsst.afw.image::ExposureInfo::_metadata
private

Definition at line 282 of file ExposureInfo.h.

boost::shared_ptr< detection::Psf > lsst.afw.image::ExposureInfo::_psf
private

Definition at line 277 of file ExposureInfo.h.

boost::shared_ptr< geom::polygon::Polygon const> lsst.afw.image::ExposureInfo::_validPolygon
private

Definition at line 280 of file ExposureInfo.h.

boost::shared_ptr< Wcs > lsst.afw.image::ExposureInfo::_wcs
private

Definition at line 276 of file ExposureInfo.h.


The documentation for this class was generated from the following files: