37 using namespace std::string_literals;
 
   51 typehandling::Key<std::string, std::shared_ptr<geom::SkyWcs const>> 
const ExposureInfo::KEY_WCS =
 
   52         typehandling::makeKey<std::shared_ptr<geom::SkyWcs const>>(
"SKYWCS"s);
 
   54 bool ExposureInfo::hasWcs()
 const { 
return hasComponent(KEY_WCS); }
 
   59         typehandling::makeKey<std::shared_ptr<detection::Psf const>>(
"PSF"s);
 
   61 bool ExposureInfo::hasPsf()
 const { 
return hasComponent(KEY_PSF); }
 
   66         typehandling::makeKey<std::shared_ptr<PhotoCalib const>>(
"PHOTOCALIB"s);
 
   68 bool ExposureInfo::hasPhotoCalib()
 const { 
return hasComponent(KEY_PHOTO_CALIB); }
 
   70     return getComponent(KEY_PHOTO_CALIB);
 
   77         typehandling::makeKey<std::shared_ptr<cameraGeom::Detector const>>(
"DETECTOR"s);
 
   79 bool ExposureInfo::hasDetector()
 const { 
return hasComponent(KEY_DETECTOR); }
 
   81     return getComponent(KEY_DETECTOR);
 
   84     setComponent(KEY_DETECTOR, 
detector);
 
   88         ExposureInfo::KEY_VALID_POLYGON =
 
   89                 typehandling::makeKey<std::shared_ptr<geom::polygon::Polygon const>>(
"VALID_POLYGON"s);
 
   91 bool ExposureInfo::hasValidPolygon()
 const { 
return hasComponent(KEY_VALID_POLYGON); }
 
   93     return getComponent(KEY_VALID_POLYGON);
 
   96     setComponent(KEY_VALID_POLYGON, polygon);
 
  100         typehandling::makeKey<std::shared_ptr<CoaddInputs const>>(
"COADD_INPUTS"s);
 
  102 bool ExposureInfo::hasCoaddInputs()
 const { 
return hasComponent(KEY_COADD_INPUTS); }
 
  104     setComponent(KEY_COADD_INPUTS, coaddInputs);
 
  107     return getComponent(KEY_COADD_INPUTS);
 
  111         typehandling::makeKey<std::shared_ptr<ApCorrMap const>>(
"AP_CORR_MAP"s);
 
  113 bool ExposureInfo::hasApCorrMap()
 const { 
return hasComponent(KEY_AP_CORR_MAP); }
 
  116     setComponent(KEY_AP_CORR_MAP, 
apCorrMap);
 
  120         ExposureInfo::KEY_TRANSMISSION_CURVE =
 
  121                 typehandling::makeKey<std::shared_ptr<TransmissionCurve const>>(
"TRANSMISSION_CURVE"s);
 
  123 bool ExposureInfo::hasTransmissionCurve()
 const { 
return hasComponent(KEY_TRANSMISSION_CURVE); }
 
  125     return getComponent(KEY_TRANSMISSION_CURVE);
 
  128     setComponent(KEY_TRANSMISSION_CURVE, tc);
 
  131 bool ExposureInfo::hasId() const noexcept { 
return _exposureId.has_value(); }
 
  146         auto newVisitInfo = std::make_shared<VisitInfo>(
 
  147                 *_exposureId, oldVisitInfo->getExposureTime(), oldVisitInfo->getDarkTime(),
 
  148                 oldVisitInfo->getDate(), oldVisitInfo->getUt1(), oldVisitInfo->getEra(),
 
  149                 oldVisitInfo->getBoresightRaDec(), oldVisitInfo->getBoresightAzAlt(),
 
  150                 oldVisitInfo->getBoresightAirmass(), oldVisitInfo->getBoresightRotAngle(),
 
  151                 oldVisitInfo->getRotType(), oldVisitInfo->getObservatory(), oldVisitInfo->getWeather(),
 
  152                 oldVisitInfo->getInstrumentLabel(), oldVisitInfo->getId());
 
  154         _visitInfo = newVisitInfo;
 
  158 void ExposureInfo::clearId() noexcept { _exposureId.reset(); }
 
  177         typehandling::makeKey<std::shared_ptr<FilterLabel const>>(
"FILTER"s);
 
  178 bool ExposureInfo::hasFilterLabel()
 const { 
return hasComponent(KEY_FILTER); }
 
  181     setComponent(KEY_FILTER, label);
 
  184 int ExposureInfo::getFitsSerializationVersion() {
 
  193 std::string const& ExposureInfo::getFitsSerializationVersionName() {
 
  202         return std::make_shared<ApCorrMap>(*
apCorrMap);
 
  218           _metadata(metadata ? metadata
 
  219                              : 
std::shared_ptr<daf::base::PropertySet>(new daf::base::PropertyList())),
 
  221           _components(
std::make_unique<MapClass>()) {
 
  240         : _exposureId(other._exposureId),
 
  241           _metadata(other._metadata),
 
  242           _visitInfo(other._visitInfo),
 
  244           _components(
std::make_unique<MapClass>(*(other._components))) {
 
  245     if (copyMetadata) _metadata = _metadata->deepCopy();
 
  249     if (&other != 
this) {
 
  250         _exposureId = other._exposureId;
 
  251         _metadata = other._metadata;
 
  252         _visitInfo = other._visitInfo;
 
  254         _components = std::make_unique<MapClass>(*(other._components));
 
  267     int componentId = 
data.archive.put(
object);
 
  268     data.metadata->set(key, componentId, comment);
 
  272 int ExposureInfo::_addToArchive(FitsWriteData& 
data,
 
  277     int componentId = 
data.archive.put(
object);
 
  278     data.metadata->set(key, componentId, comment);
 
  288     return "archive ID for generic component '" + mapKey + 
"'";
 
  292 ExposureInfo::FitsWriteData ExposureInfo::_startWriteFits(
lsst::geom::Point2I const& xy0)
 const {
 
  295     data.metadata.reset(
new daf::base::PropertyList());
 
  296     data.imageMetadata.reset(
new daf::base::PropertyList());
 
  297     data.maskMetadata = 
data.imageMetadata;
 
  298     data.varianceMetadata = 
data.imageMetadata;
 
  310     data.metadata->set(
"AR_HDU", 5, 
"HDU (1-indexed) containing the archive used to store ancillary objects");
 
  311     for (
auto const& keyValue : *_components) {
 
  315         if (
object && object->isPersistable()) {
 
  320             int id = _addToArchive(
data, 
object, _getOldHeaderKey(key), comment);
 
  321             data.metadata->set(_getNewHeaderKey(key), 
id, comment);
 
  334         auto newWcs = 
getWcs()->copyAtShiftedPixelOrigin(shift);
 
  337             wcsMetadata = newWcs->getFitsMetadata(
true);
 
  338         } 
catch (pex::exceptions::RuntimeError 
const&) {
 
  342             data.imageMetadata->combine(newWcs->getFitsMetadata(
true));
 
  352     data.imageMetadata->set(
"LTV1", 
static_cast<double>(-xy0.getX()));
 
  353     data.imageMetadata->set(
"LTV2", 
static_cast<double>(-xy0.getY()));
 
  373 void ExposureInfo::_finishWriteFits(fits::Fits& fitsfile, FitsWriteData 
const& 
data)
 const {
 
  374     data.archive.writeFits(fitsfile);
 
table::Key< int > detector
 
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
 
LSST DM logging module built on log4cxx.
 
#define LOG_GET(logger)
Returns a Log object associated with logger.
 
Implementation of the Photometric Calibration class.
 
table::Key< table::Array< std::uint8_t > > wcs
 
A collection of all the things that make an Exposure different from a MaskedImage.
 
bool hasWcs() const
Does this exposure have a Wcs?
 
static int getFitsSerializationVersion()
Get the version of FITS serialization that this ExposureInfo understands.
 
std::shared_ptr< daf::base::PropertySet > getMetadata() const
Return flexible metadata.
 
ExposureInfo & operator=(ExposureInfo const &other)
Assignment; shares all components.
 
void setFilter(Filter const &filter)
Set the exposure's filter.
 
ExposureInfo(std::shared_ptr< geom::SkyWcs const > const &wcs=std::shared_ptr< geom::SkyWcs const >(), std::shared_ptr< detection::Psf const > const &psf=std::shared_ptr< detection::Psf const >(), std::shared_ptr< PhotoCalib const > const &photoCalib=std::shared_ptr< PhotoCalib const >(), std::shared_ptr< cameraGeom::Detector const > const &detector=std::shared_ptr< cameraGeom::Detector const >(), std::shared_ptr< geom::polygon::Polygon const > const &polygon=std::shared_ptr< geom::polygon::Polygon const >(), Filter const &filter=Filter(), std::shared_ptr< daf::base::PropertySet > const &metadata=std::shared_ptr< daf::base::PropertySet >(), std::shared_ptr< CoaddInputs > const &coaddInputs=std::shared_ptr< CoaddInputs >(), std::shared_ptr< ApCorrMap > const &apCorrMap=std::shared_ptr< ApCorrMap >(), std::shared_ptr< image::VisitInfo const > const &visitInfo=std::shared_ptr< image::VisitInfo const >(), std::shared_ptr< TransmissionCurve const > const &transmissionCurve=std::shared_ptr< TransmissionCurve >())
Construct an ExposureInfo from its various components.
 
void setValidPolygon(std::shared_ptr< geom::polygon::Polygon const > polygon)
Set the exposure's valid Polygon.
 
void setWcs(std::shared_ptr< geom::SkyWcs const > wcs)
Set the WCS of the exposure.
 
std::shared_ptr< image::VisitInfo const  > getVisitInfo() const
Return the exposure's visit info.
 
void setApCorrMap(std::shared_ptr< ApCorrMap const > apCorrMap)
Set the exposure's aperture correction map (null pointer if !hasApCorrMap())
 
std::shared_ptr< cameraGeom::Detector const  > getDetector() const
Return the exposure's Detector information.
 
void setPhotoCalib(std::shared_ptr< PhotoCalib const > photoCalib)
Set the Exposure's PhotoCalib object.
 
void setCoaddInputs(std::shared_ptr< CoaddInputs const > coaddInputs)
Set the exposure's coadd provenance catalogs.
 
void setDetector(std::shared_ptr< cameraGeom::Detector const > detector)
Set the exposure's Detector information.
 
void setPsf(std::shared_ptr< detection::Psf const > psf)
Set the exposure's point-spread function.
 
void initApCorrMap()
Set the exposure's aperture correction map to a new, empty map.
 
table::RecordId getId() const
Return the exposure ID.
 
std::shared_ptr< geom::SkyWcs const  > getWcs() const
Return the WCS of the exposure.
 
bool hasDetector() const
Does this exposure have Detector information?
 
static std::string const  & getFitsSerializationVersionName()
Get the version of FITS serialization version info name.
 
bool hasId() const noexcept
Does this Exposure have an exposure id?
 
void setTransmissionCurve(std::shared_ptr< TransmissionCurve const > tc)
Set the exposure's transmission curve.
 
A group of labels for a filter in an exposure or coadd.
 
A map of Storable supporting strongly-typed access.
 
A base class for objects that can be persisted via afw::table::io Archive classes.
 
Key for type-safe lookup in a GenericMap.
 
Reports attempts to access elements using an invalid key.
 
void setVisitInfoMetadata(daf::base::PropertyList &metadata, VisitInfo const &visitInfo)
Set FITS metadata from a VisitInfo.
 
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
 
Filter makeFilter(FilterLabel const &label)
Convert a FilterLabel back to an old-style Filter.
 
std::shared_ptr< FilterLabel > makeFilterLabel(Filter const &filter)
Convert an old-style Filter to a FilterLabel.
 
std::string const  & getName() const noexcept
Return a filter's name.
 
Extent< double, 2 > Extent2D
 
A base class for image defects.
 
Key< int > transmissionCurve