23#ifndef LSST_AFW_IMAGE_PHOTOCALIB_H
24#define LSST_AFW_IMAGE_PHOTOCALIB_H
32#include "boost/format.hpp"
72 (boost::format(
"%s must be positive: %.3g") %
name % value).
str());
142 ndarray::Array<double, 2, 2> coeffs = ndarray::allocate(ndarray::makeVector(1, 1));
144 _calibration = std::make_shared<afw::math::ChebyshevBoundedField>(
155 : _calibration(calibration),
156 _calibrationMean(computeCalibrationMean(calibration)),
159 assertNonNegative(_calibrationMean,
"Calibration (computed via BoundedField.mean()) mean");
173 : _calibration(calibration),
351 bool includeScaleUncertainty =
true)
const;
530 double _calibrationMean;
533 double _calibrationErr;
547 ndarray::Array<double, 1> evaluateArray(ndarray::Array<double, 1>
const &xx,
548 ndarray::Array<double, 1>
const &yy)
const;
560 ndarray::Array<double, 2, 2>
result)
const;
563 ndarray::Array<double, 2, 2>
result)
const;
table::Key< std::string > name
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
table::Key< double > calibrationMean
table::Key< double > calibrationErr
A class to manipulate images, masks, and variance as a single object.
The photometric calibration of an exposure.
PhotoCalib(double calibrationMean, double calibrationErr, std::shared_ptr< afw::math::BoundedField > calibration, bool isConstant)
Create a calibration with a pre-computed mean.
afw::table::SourceCatalog calibrateCatalog(afw::table::SourceCatalog const &catalog, std::vector< std::string > const &instFluxFields) const
Return a flux calibrated catalog, with new _flux, _fluxErr, _mag, and _magErr fields.
bool operator==(PhotoCalib const &rhs) const
Two PhotoCalibs are equal if their component bounded fields and calibrationErr are equal.
double getCalibrationMean() const
Get the mean photometric calibration.
PhotoCalib(PhotoCalib &&)=default
double instFluxToNanojansky(double instFlux, lsst::geom::Point< double, 2 > const &point) const
Convert instFlux in ADU to nJy at a point in the BoundedField.
std::string getPersistenceName() const override
Return the unique name used to persist this object and look up its factory.
PhotoCalib()
Create a empty, zeroed calibration.
PhotoCalib(PhotoCalib const &)=default
double instFluxToMagnitude(double instFlux, lsst::geom::Point< double, 2 > const &point) const
Convert instFlux in ADU to AB magnitude.
PhotoCalib(double calibrationMean, double calibrationErr=0, lsst::geom::Box2I const &bbox=lsst::geom::Box2I())
Create a non-spatially-varying calibration.
std::string toString() const override
Create a string representation of this object.
bool operator!=(PhotoCalib const &rhs) const
Two PhotoCalibs are equal if their component bounded fields and calibrationErr are equal.
bool equals(typehandling::Storable const &other) const noexcept override
Compare this object to another Storable.
PhotoCalib(std::shared_ptr< afw::math::BoundedField > calibration, double calibrationErr=0)
Create a spatially-varying calibration.
PhotoCalib & operator=(PhotoCalib const &)=delete
std::shared_ptr< typehandling::Storable > cloneStorable() const override
Create a new PhotoCalib that is a copy of this one.
double getLocalCalibration(lsst::geom::Point< double, 2 > const &point) const
Get the local calibration at a point.
std::shared_ptr< afw::math::BoundedField > computeScalingTo(std::shared_ptr< PhotoCalib > other) const
Calculates the scaling between this PhotoCalib and another PhotoCalib.
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
double getCalibrationErr() const
Get the mean photometric calibration error.
bool isConstant() const
Is this photoCalib spatially constant?
MaskedImage< float > calibrateImage(MaskedImage< float > const &maskedImage, bool includeScaleUncertainty=true) const
Return a flux calibrated image, with pixel values in nJy.
~PhotoCalib() override=default
std::shared_ptr< afw::math::BoundedField > computeScaledCalibration() const
Calculates the spatially-variable calibration, normalized by the mean in the valid domain.
PhotoCalib & operator=(PhotoCalib &&)=delete
double magnitudeToInstFlux(double magnitude, lsst::geom::Point< double, 2 > const &point) const
Convert AB magnitude to instFlux (ADU).
double getInstFluxAtZeroMagnitude() const
Get the magnitude zero point (the instrumental flux corresponding to 0 magnitude).
A BoundedField based on 2-d Chebyshev polynomials of the first kind.
Record class that contains measurements made on a single exposure.
A CRTP facade class for subclasses of Persistable.
io::OutputArchiveHandle OutputArchiveHandle
Interface supporting iteration over heterogenous containers.
Class for storing generic metadata.
An integer coordinate rectangle.
A coordinate class intended to represent absolute positions.
Reports invalid arguments.
std::shared_ptr< PhotoCalib > makePhotoCalibFromMetadata(daf::base::PropertySet &metadata, bool strip=false)
Construct a PhotoCalib from FITS FLUXMAG0/FLUXMAG0ERR keywords.
std::ostream & operator<<(std::ostream &os, Measurement const &measurement)
void assertNonNegative(double value, std::string const &name)
Raise lsst::pex::exceptions::InvalidParameterError if value is not >=0.
const double referenceFlux
The Oke & Gunn (1983) AB magnitude reference flux, in nJy (often approximated as 3631....
Measurement(double value, double error)
Utilities for converting between flux and magnitude in C++.