23 #ifndef LSST_AFW_IMAGE_PHOTOCALIB_H 24 #define LSST_AFW_IMAGE_PHOTOCALIB_H 34 #include "boost/format.hpp" 141 : _calibrationMean(calibrationMean), _calibrationErr(
calibrationErr), _isConstant(true) {
144 ndarray::Array<double, 2, 2> coeffs = ndarray::allocate(ndarray::makeVector(1, 1));
146 _calibration = std::make_shared<afw::math::ChebyshevBoundedField>(
157 : _calibration(calibration),
158 _calibrationMean(computeCalibrationMean(calibration)),
161 assertNonNegative(_calibrationMean,
"Calibration (computed via BoundedField.mean()) mean");
175 : _calibration(calibration),
176 _calibrationMean(calibrationMean),
177 _calibrationErr(calibrationErr),
178 _isConstant(isConstant) {
196 double instFluxToNanojansky(
double instFlux)
const;
209 Measurement instFluxToNanojansky(
double instFlux,
double instFluxErr,
213 Measurement instFluxToNanojansky(
double instFlux,
double instFluxErr)
const;
274 double instFluxToMagnitude(
double instFlux)
const;
287 Measurement instFluxToMagnitude(
double instFlux,
double instFluxErr,
291 Measurement instFluxToMagnitude(
double instFlux,
double instFluxErr)
const;
353 bool includeScaleUncertainty =
true)
const;
392 double magnitudeToInstFlux(
double magnitude)
const;
485 [[deprecated(
"No-op: PhotoCalib never throws on negative instFlux. Will remove after v18.")]]
static void 490 [[deprecated(
"No-op: PhotoCalib never throws on negative instFlux. Will remove after v18.")]]
static bool 499 [deprecated(
"For backwards compatibility with Calib; use `instFluxToMagnitude` instead. To be " 500 "removed after v18.")]]
double 502 return instFluxToMagnitude(instFlux);
509 [deprecated(
"For backwards compatibility with Calib; use `instFluxToMagnitude` instead. To be " 510 "removed after v18.")]] ndarray::Array<double, 1>
511 getMagnitude(ndarray::Array<double const, 1>
const &instFlux)
const;
513 [deprecated(
"For backwards compatibility with Calib; use `instFluxToMagnitude` instead. To be " 516 auto result = instFluxToMagnitude(instFlux, instFluxErr);
517 return std::make_pair<const double &, const double &>(
result.value,
result.error);
520 "For backwards compatibility with Calib; use `instFluxToMagnitude` instead. To be " 522 getMagnitude(ndarray::Array<double const, 1>
const &instFlux,
523 ndarray::Array<double const, 1>
const &instFluxErr)
const;
529 "For backwards compatibility with Calib; use `magnitudeToInstFlux` instead. To be removed " 530 "after v18.")]]
double 532 return magnitudeToInstFlux(magnitude);
539 "For backwards compatibility with Calib: use `getCalibrationMean`, `getCalibrationErr`, or " 542 return std::make_pair<double, double>(getInstFluxAtZeroMagnitude(),
547 "PhotoCalib is immutable: create a new one with the calibration factor and calibration error," 548 " or create it like an old Calib object with makePhotoCalibFromCalibZeroPoint.")]]
void 551 "PhotoCalib is immutable: create a new `PhotoCalib` with the calibration" 552 " factor and error, or create it like an old Calib object with " 553 "`makePhotoCalibFromCalibZeroPoint`.";
582 double _calibrationMean;
585 double _calibrationErr;
599 ndarray::Array<double, 1> evaluateArray(ndarray::Array<double, 1>
const &xx,
600 ndarray::Array<double, 1>
const &yy)
const;
612 ndarray::Array<double, 2, 2>
result)
const;
615 ndarray::Array<double, 2, 2> result)
const;
650 #endif // LSST_AFW_IMAGE_PHOTOCALIB_H std::shared_ptr< PhotoCalib > makePhotoCalibFromMetadata(daf::base::PropertySet &metadata, bool strip=false)
Construct a PhotoCalib from FITS FLUXMAG0/FLUXMAG0ERR keywords.
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
std::shared_ptr< PhotoCalib > makePhotoCalibFromCalibZeroPoint(double instFluxMag0, double instFluxMag0Err)
Construct a PhotoCalib from the deprecated Calib-style instFluxMag0/instFluxMag0Err values...
PhotoCalib(double calibrationMean, double calibrationErr, std::shared_ptr< afw::math::BoundedField > calibration, bool isConstant)
Create a calibration with a pre-computed mean.
static bool getThrowOnNegativeFlux() noexcept
No-op: for backwards compatibility with Calib (always returns false).
std::ostream & operator<<(std::ostream &os, Measurement const &measurement)
double getCalibrationMean() const
Get the mean photometric calibration.
An object passed to Persistable::write to allow it to persist itself.
The photometric calibration of an exposure.
Interface supporting iteration over heterogenous containers.
bool operator!=(PhotoCalib const &rhs) const
Two PhotoCalibs are equal if their component bounded fields and calibrationErr are equal...
PhotoCalib(double calibrationMean, double calibrationErr=0, lsst::geom::Box2I const &bbox=lsst::geom::Box2I())
Create a non-spatially-varying calibration.
A base class for image defects.
static void setThrowOnNegativeFlux(bool raiseException) noexcept
No-op: for backwards compatibility with Calib.
PhotoCalib(std::shared_ptr< afw::math::BoundedField > calibration, double calibrationErr=0)
Create a spatially-varying calibration.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
A class to manipulate images, masks, and variance as a single object.
Utilities for converting between flux and magnitude in C++.
table::Key< double > calibrationMean
PhotoCalib()
Create a empty, zeroed calibration.
void setFluxMag0(double, double=0) const
Invalid for PhotoCalib: this only exists to provide the user an informative error message...
Measurement(double value, double error)
std::pair< double, double > getMagnitude(double instFlux, double instFluxErr) const
double getCalibrationErr() const
Get the mean photometric calibration error.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
A BoundedField based on 2-d Chebyshev polynomials of the first kind.
Class for storing generic metadata.
std::pair< double, double > getFluxMag0() const
Get the magnitude zero point (the instrumental flux corresponding to 0 magnitude).
Reports invalid arguments.
ItemVariant const * other
double getMagnitude(double instFlux) const
Record class that contains measurements made on a single exposure.
table::Key< table::Flag > isConstant
void assertNonNegative(double value, std::string const &name)
Raise lsst::pex::exceptions::InvalidParameterError if value is not >=0.
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
const double referenceFlux
The Oke & Gunn (1983) AB magnitude reference flux, in nJy (often approximated as 3631.0).
A CRTP facade class for subclasses of Persistable.
An integer coordinate rectangle.
double getFlux(double magnitude) const
double getInstFluxAtZeroMagnitude() const
Get the magnitude zero point (the instrumental flux corresponding to 0 magnitude).
table::Key< double > calibrationErr
Reports errors that are due to events beyond the control of the program.