lsst.afw  17.0.1-17-g8f3aa1b31+1
PhotoCalib.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2017 LSST Corporation.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <http://www.lsstcorp.org/LegalNotices/>.
21  */
22 
23 #include <cmath>
24 
25 #include "lsst/geom/Point.h"
28 #include "lsst/afw/table/Source.h"
32 #include "lsst/pex/exceptions.h"
33 #include "ndarray.h"
35 #include "lsst/utils/Magnitude.h"
36 
37 namespace lsst {
38 namespace afw {
39 
42 
43 namespace image {
44 
45 // ------------------- helpers -------------------
46 
49  s << std::setprecision(std::numeric_limits<long double>::digits10 + 1);
50  s << "value=" << measurement.value << ", error=" << measurement.error;
51  return os << s.str();
52 }
53 
54 namespace {
55 
56 int const SERIALIZATION_VERSION = 1;
57 
58 double toNanojansky(double instFlux, double scale) { return instFlux * scale; }
59 
60 double toMagnitude(double instFlux, double scale) { return utils::nanojanskyToABMagnitude(instFlux * scale); }
61 
62 double toInstFluxFromMagnitude(double magnitude, double scale) {
63  // Note: flux[nJy] / scale = instFlux[counts]
64  return utils::ABMagnitudeToNanojansky(magnitude) / scale;
65 }
66 
67 double toNanojanskyErr(double instFlux, double instFluxErr, double scale, double scaleErr,
68  double nanojansky) {
69  return std::abs(nanojansky) * hypot(instFluxErr / instFlux, scaleErr / scale);
70 }
71 
85 void toNanojanskyVariance(ndarray::Array<float const, 2, 1> const &instFlux,
86  ndarray::Array<float const, 2, 1> const &instFluxVar, float scaleErr,
87  ndarray::Array<float const, 2, 1> const &flux, ndarray::Array<float, 2, 1> out) {
88  auto eigenFlux = ndarray::asEigen<Eigen::ArrayXpr>(flux);
89  auto eigenInstFluxVar = ndarray::asEigen<Eigen::ArrayXpr>(instFluxVar);
90  auto eigenInstFlux = ndarray::asEigen<Eigen::ArrayXpr>(instFlux);
91  auto eigenOut = ndarray::asEigen<Eigen::ArrayXpr>(out);
92  eigenOut = eigenFlux.square() *
93  (eigenInstFluxVar / eigenInstFlux.square() + (scaleErr / eigenFlux * eigenInstFlux).square());
94 }
95 
96 double toMagnitudeErr(double instFlux, double instFluxErr, double scale, double scaleErr) {
97  return 2.5 / log(10.0) * hypot(instFluxErr / instFlux, scaleErr / scale);
98 }
99 
100 } // anonymous namespace
101 
102 // ------------------ Deprecated Calib interface -------------------
103 
104 ndarray::Array<double, 1> PhotoCalib::getMagnitude(ndarray::Array<double const, 1> const &instFlux) const {
105  ndarray::Array<double, 1> result = ndarray::allocate(ndarray::makeVector(int(instFlux.size())));
106  auto iter = result.begin();
107  for (auto const &i : instFlux) {
108  *iter = toMagnitude(i, _calibrationMean);
109  iter++;
110  }
111  return result;
112 }
113 
114 std::pair<ndarray::Array<double, 1>, ndarray::Array<double, 1>> PhotoCalib::getMagnitude(
115  ndarray::Array<double const, 1> const &instFlux,
116  ndarray::Array<double const, 1> const &instFluxErr) const {
117  ndarray::Array<double, 1> mag = ndarray::allocate(ndarray::makeVector(int(instFlux.size())));
118  ndarray::Array<double, 1> magErr = ndarray::allocate(ndarray::makeVector(int(instFlux.size())));
119  auto iMag = mag.begin();
120  auto iMagErr = magErr.begin();
121  for (auto i = instFlux.begin(), iErr = instFluxErr.begin(); i != instFlux.end(); ++i, ++iErr) {
122  *iMag = toMagnitude(*i, _calibrationMean);
123  *iMagErr = toMagnitudeErr(*i, *iErr, _calibrationMean, _calibrationErr);
124  iMag++;
125  iMagErr++;
126  }
127  return std::make_pair(mag, magErr);
128 }
129 
130 // ------------------- Conversions to nanojansky -------------------
131 
132 double PhotoCalib::instFluxToNanojansky(double instFlux, lsst::geom::Point<double, 2> const &point) const {
133  return toNanojansky(instFlux, evaluate(point));
134 }
135 
136 double PhotoCalib::instFluxToNanojansky(double instFlux) const {
137  return toNanojansky(instFlux, _calibrationMean);
138 }
139 
140 Measurement PhotoCalib::instFluxToNanojansky(double instFlux, double instFluxErr,
141  lsst::geom::Point<double, 2> const &point) const {
142  double calibration, error, nanojansky;
143  calibration = evaluate(point);
144  nanojansky = toNanojansky(instFlux, calibration);
145  error = toNanojanskyErr(instFlux, instFluxErr, calibration, _calibrationErr, nanojansky);
146  return Measurement(nanojansky, error);
147 }
148 
149 Measurement PhotoCalib::instFluxToNanojansky(double instFlux, double instFluxErr) const {
150  double nanojansky = toNanojansky(instFlux, _calibrationMean);
151  double error = toNanojanskyErr(instFlux, instFluxErr, _calibrationMean, _calibrationErr, nanojansky);
152  return Measurement(nanojansky, error);
153 }
154 
155 Measurement PhotoCalib::instFluxToNanojansky(afw::table::SourceRecord const &sourceRecord,
156  std::string const &instFluxField) const {
157  auto position = sourceRecord.getCentroid();
158  auto instFluxKey = sourceRecord.getSchema().find<double>(instFluxField + "_instFlux").key;
159  auto instFluxErrKey = sourceRecord.getSchema().find<double>(instFluxField + "_instFluxErr").key;
160  return instFluxToNanojansky(sourceRecord.get(instFluxKey), sourceRecord.get(instFluxErrKey), position);
161 }
162 ndarray::Array<double, 2, 2> PhotoCalib::instFluxToNanojansky(afw::table::SourceCatalog const &sourceCatalog,
163  std::string const &instFluxField) const {
164  ndarray::Array<double, 2, 2> result =
165  ndarray::allocate(ndarray::makeVector(int(sourceCatalog.size()), 2));
166  instFluxToNanojanskyArray(sourceCatalog, instFluxField, result);
167  return result;
168 }
169 
170 void PhotoCalib::instFluxToNanojansky(afw::table::SourceCatalog &sourceCatalog,
171  std::string const &instFluxField, std::string const &outField) const {
172  auto instFluxKey = sourceCatalog.getSchema().find<double>(instFluxField + "_instFlux").key;
173  auto instFluxErrKey = sourceCatalog.getSchema().find<double>(instFluxField + "_instFluxErr").key;
174  auto nanojanskyKey = sourceCatalog.getSchema().find<double>(outField + "_flux").key;
175  auto nanojanskyErrKey = sourceCatalog.getSchema().find<double>(outField + "_fluxErr").key;
176  for (auto &record : sourceCatalog) {
177  auto result = instFluxToNanojansky(record.get(instFluxKey), record.get(instFluxErrKey),
178  record.getCentroid());
179  record.set(nanojanskyKey, result.value);
180  record.set(nanojanskyErrKey, result.error);
181  }
182 }
183 
184 // ------------------- Conversions to Magnitudes -------------------
185 
186 double PhotoCalib::instFluxToMagnitude(double instFlux, lsst::geom::Point<double, 2> const &point) const {
187  return toMagnitude(instFlux, evaluate(point));
188 }
189 
190 double PhotoCalib::instFluxToMagnitude(double instFlux) const {
191  return toMagnitude(instFlux, _calibrationMean);
192 }
193 
194 Measurement PhotoCalib::instFluxToMagnitude(double instFlux, double instFluxErr,
195  lsst::geom::Point<double, 2> const &point) const {
196  double calibration, error, magnitude;
197  calibration = evaluate(point);
198  magnitude = toMagnitude(instFlux, calibration);
199  error = toMagnitudeErr(instFlux, instFluxErr, calibration, _calibrationErr);
200  return Measurement(magnitude, error);
201 }
202 
203 Measurement PhotoCalib::instFluxToMagnitude(double instFlux, double instFluxErr) const {
204  double magnitude = toMagnitude(instFlux, _calibrationMean);
205  double error = toMagnitudeErr(instFlux, instFluxErr, _calibrationMean, _calibrationErr);
206  return Measurement(magnitude, error);
207 }
208 
209 Measurement PhotoCalib::instFluxToMagnitude(afw::table::SourceRecord const &sourceRecord,
210  std::string const &instFluxField) const {
211  auto position = sourceRecord.getCentroid();
212  auto instFluxKey = sourceRecord.getSchema().find<double>(instFluxField + "_instFlux").key;
213  auto instFluxErrKey = sourceRecord.getSchema().find<double>(instFluxField + "_instFluxErr").key;
214  return instFluxToMagnitude(sourceRecord.get(instFluxKey), sourceRecord.get(instFluxErrKey), position);
215 }
216 
217 ndarray::Array<double, 2, 2> PhotoCalib::instFluxToMagnitude(afw::table::SourceCatalog const &sourceCatalog,
218  std::string const &instFluxField) const {
219  ndarray::Array<double, 2, 2> result =
220  ndarray::allocate(ndarray::makeVector(int(sourceCatalog.size()), 2));
221  instFluxToMagnitudeArray(sourceCatalog, instFluxField, result);
222  return result;
223 }
224 
225 void PhotoCalib::instFluxToMagnitude(afw::table::SourceCatalog &sourceCatalog,
226  std::string const &instFluxField, std::string const &outField) const {
227  auto instFluxKey = sourceCatalog.getSchema().find<double>(instFluxField + "_instFlux").key;
228  auto instFluxErrKey = sourceCatalog.getSchema().find<double>(instFluxField + "_instFluxErr").key;
229  auto magKey = sourceCatalog.getSchema().find<double>(outField + "_mag").key;
230  auto magErrKey = sourceCatalog.getSchema().find<double>(outField + "_magErr").key;
231  for (auto &record : sourceCatalog) {
232  auto result = instFluxToMagnitude(record.get(instFluxKey), record.get(instFluxErrKey),
233  record.getCentroid());
234  record.set(magKey, result.value);
235  record.set(magErrKey, result.error);
236  }
237 }
238 
239 // ------------------- other utility methods -------------------
240 
241 double PhotoCalib::magnitudeToInstFlux(double magnitude) const {
242  return toInstFluxFromMagnitude(magnitude, _calibrationMean);
243 }
244 
245 double PhotoCalib::magnitudeToInstFlux(double magnitude, lsst::geom::Point<double, 2> const &point) const {
246  return toInstFluxFromMagnitude(magnitude, evaluate(point));
247 }
248 
249 std::shared_ptr<math::BoundedField> PhotoCalib::computeScaledCalibration() const {
250  return *(_calibration) / _calibrationMean;
251 }
252 
254  throw LSST_EXCEPT(pex::exceptions::LogicError, "Not Implemented: See DM-10154.");
255 }
256 
257 bool PhotoCalib::operator==(PhotoCalib const &rhs) const {
258  return (_calibrationMean == rhs._calibrationMean && _calibrationErr == rhs._calibrationErr &&
259  (*_calibration) == *(rhs._calibration));
260 }
261 
262 double PhotoCalib::computeCalibrationMean(std::shared_ptr<afw::math::BoundedField> calibration) const {
263  return calibration->mean();
264 }
265 
267  if (photoCalib._isConstant)
268  os << "spatially constant with ";
269  else
270  os << *(photoCalib._calibration) << " with ";
271  return os << "mean: " << photoCalib._calibrationMean << " error: " << photoCalib._calibrationErr;
272 }
273 
274 MaskedImage<float> PhotoCalib::calibrateImage(MaskedImage<float> const &maskedImage,
275  bool includeScaleUncertainty) const {
276  // Deep copy construct, as we're mutiplying in-place.
277  auto result = MaskedImage<float>(maskedImage, true);
278 
279  if (_isConstant) {
280  *(result.getImage()) *= _calibrationMean;
281  } else {
282  _calibration->multiplyImage(*(result.getImage()), true); // only in the overlap region
283  }
284  if (includeScaleUncertainty) {
285  toNanojanskyVariance(maskedImage.getImage()->getArray(), maskedImage.getVariance()->getArray(),
286  _calibrationErr, result.getImage()->getArray(),
287  result.getVariance()->getArray());
288  } else {
289  toNanojanskyVariance(maskedImage.getImage()->getArray(), maskedImage.getVariance()->getArray(), 0,
290  result.getImage()->getArray(), result.getVariance()->getArray());
291  }
292 
293  return result;
294 }
295 
296 // ------------------- persistence -------------------
297 
298 namespace {
299 
300 class PhotoCalibSchema {
301 public:
302  table::Schema schema;
303  table::Key<double> calibrationMean;
304  table::Key<double> calibrationErr;
305  table::Key<table::Flag> isConstant;
306  table::Key<int> field;
307  table::Key<int> version;
308 
309  // No copying
310  PhotoCalibSchema(PhotoCalibSchema const &) = delete;
311  PhotoCalibSchema &operator=(PhotoCalibSchema const &) = delete;
312  // No moving
313  PhotoCalibSchema(PhotoCalibSchema &&) = delete;
314  PhotoCalibSchema &operator=(PhotoCalibSchema &&) = delete;
315 
316  static PhotoCalibSchema const &get() {
317  static PhotoCalibSchema const instance;
318  return instance;
319  }
320 
321 private:
322  PhotoCalibSchema()
323  : schema(),
324  calibrationMean(schema.addField<double>(
325  "calibrationMean", "mean calibration on this PhotoCalib's domain", "count")),
327  schema.addField<double>("calibrationErr", "1-sigma error on calibrationMean", "count")),
328  isConstant(schema.addField<table::Flag>("isConstant", "Is this spatially-constant?")),
329  field(schema.addField<int>("field", "archive ID of the BoundedField object")),
330  version(schema.addField<int>("version", "version of this PhotoCalib")) {
331  schema.getCitizen().markPersistent();
332  }
333 };
334 
335 class PhotoCalibFactory : public table::io::PersistableFactory {
336 public:
337  PTR(table::io::Persistable)
338  read(InputArchive const &archive, CatalogVector const &catalogs) const override {
339  table::BaseRecord const &record = catalogs.front().front();
340  PhotoCalibSchema const &keys = PhotoCalibSchema::get();
341  int version = getVersion(record);
342  if (version < 1) {
343  throw(pex::exceptions::RuntimeError("Unsupported version (version 0 was defined in maggies): " +
344  std::to_string(version)));
345  }
346  return std::make_shared<PhotoCalib>(record.get(keys.calibrationMean), record.get(keys.calibrationErr),
347  archive.get<afw::math::BoundedField>(record.get(keys.field)),
348  record.get(keys.isConstant));
349  }
350 
351  PhotoCalibFactory(std::string const &name) : afw::table::io::PersistableFactory(name) {}
352 
353 protected:
354  int getVersion(table::BaseRecord const &record) const {
355  int version = -1;
356  try {
357  std::string versionName = "version";
358  auto versionKey = record.getSchema().find<int>(versionName);
359  version = record.get(versionKey.key);
360  } catch (const pex::exceptions::NotFoundError &) {
361  // un-versioned files are version 0
362  version = 0;
363  }
364  return version;
365  }
366 };
367 
368 std::string getPhotoCalibPersistenceName() { return "PhotoCalib"; }
369 
370 PhotoCalibFactory registration(getPhotoCalibPersistenceName());
371 
372 } // namespace
373 
378 namespace {
379 int const CALIB_TABLE_CURRENT_VERSION = 2; // final version of Calib in ExposureTable
380 std::string const EXPTIME_FIELD_NAME = "exptime"; // name of exposure time field (no longer used)
381 
382 class CalibKeys {
383 public:
384  table::Schema schema;
385  table::Key<std::int64_t> midTime;
386  table::Key<double> expTime;
387  table::Key<double> fluxMag0;
388  table::Key<double> fluxMag0Err;
389 
390  // No copying
391  CalibKeys(const CalibKeys &) = delete;
392  CalibKeys &operator=(const CalibKeys &) = delete;
393 
394  // No moving
395  CalibKeys(CalibKeys &&) = delete;
396  CalibKeys &operator=(CalibKeys &&) = delete;
397 
398  CalibKeys(int tableVersion = CALIB_TABLE_CURRENT_VERSION)
399  : schema(), midTime(), expTime(), fluxMag0(), fluxMag0Err() {
400  if (tableVersion == 1) {
401  // obsolete fields
402  midTime = schema.addField<std::int64_t>(
403  "midtime", "middle of the time of the exposure relative to Unix epoch", "ns");
404  expTime = schema.addField<double>(EXPTIME_FIELD_NAME, "exposure time", "s");
405  }
406  fluxMag0 = schema.addField<double>("fluxmag0", "flux of a zero-magnitude object", "count");
407  fluxMag0Err = schema.addField<double>("fluxmag0.err", "1-sigma error on fluxmag0", "count");
408  }
409 };
410 
411 class CalibFactory : public table::io::PersistableFactory {
412 public:
413  std::shared_ptr<table::io::Persistable> read(InputArchive const &archive,
414  CatalogVector const &catalogs) const override {
415  // table version is not persisted, so we don't have a clean way to determine the version;
416  // the hack is version = 1 if exptime found, else current
417  int tableVersion = 1;
418  try {
419  catalogs.front().getSchema().find<double>(EXPTIME_FIELD_NAME);
420  } catch (pex::exceptions::NotFoundError) {
421  tableVersion = CALIB_TABLE_CURRENT_VERSION;
422  }
423 
424  CalibKeys const keys{tableVersion};
425  LSST_ARCHIVE_ASSERT(catalogs.size() == 1u);
426  LSST_ARCHIVE_ASSERT(catalogs.front().size() == 1u);
427  LSST_ARCHIVE_ASSERT(catalogs.front().getSchema() == keys.schema);
428  table::BaseRecord const &record = catalogs.front().front();
429 
430  double calibration = utils::referenceFlux / record.get(keys.fluxMag0);
431  double calibrationErr =
432  utils::referenceFlux * record.get(keys.fluxMag0Err) / std::pow(record.get(keys.fluxMag0), 2);
433  return std::make_shared<PhotoCalib>(calibration, calibrationErr);
434  }
435 
436  explicit CalibFactory(std::string const &name) : table::io::PersistableFactory(name) {}
437 };
438 
439 std::string getCalibPersistenceName() { return "Calib"; }
440 
441 CalibFactory calibRegistration(getCalibPersistenceName());
442 
443 } // namespace
444 
445 std::string PhotoCalib::getPersistenceName() const { return getPhotoCalibPersistenceName(); }
446 
447 void PhotoCalib::write(OutputArchiveHandle &handle) const {
448  PhotoCalibSchema const &keys = PhotoCalibSchema::get();
449  table::BaseCatalog catalog = handle.makeCatalog(keys.schema);
450  auto record = catalog.addNew();
451  record->set(keys.calibrationMean, _calibrationMean);
452  record->set(keys.calibrationErr, _calibrationErr);
453  record->set(keys.isConstant, _isConstant);
454  record->set(keys.field, handle.put(_calibration));
455  record->set(keys.version, SERIALIZATION_VERSION);
456  handle.saveCatalog(catalog);
457 }
458 
459 // ------------------- private/protected helpers -------------------
460 
461 double PhotoCalib::evaluate(lsst::geom::Point<double, 2> const &point) const {
462  if (_isConstant)
463  return _calibrationMean;
464  else
465  return _calibration->evaluate(point);
466 }
467 
468 void PhotoCalib::instFluxToNanojanskyArray(afw::table::SourceCatalog const &sourceCatalog,
469  std::string const &instFluxField,
470  ndarray::Array<double, 2, 2> result) const {
471  double instFlux, instFluxErr, nanojansky, calibration;
472  auto instFluxKey = sourceCatalog.getSchema().find<double>(instFluxField + "_instFlux").key;
473  auto instFluxErrKey = sourceCatalog.getSchema().find<double>(instFluxField + "_instFluxErr").key;
474  auto iter = result.begin();
475  for (auto const &rec : sourceCatalog) {
476  instFlux = rec.get(instFluxKey);
477  instFluxErr = rec.get(instFluxErrKey);
478  calibration = evaluate(rec.getCentroid());
479  nanojansky = toNanojansky(instFlux, calibration);
480  (*iter)[0] = nanojansky;
481  (*iter)[1] = toNanojanskyErr(instFlux, instFluxErr, calibration, _calibrationErr, nanojansky);
482  iter++;
483  }
484 }
485 
486 void PhotoCalib::instFluxToMagnitudeArray(afw::table::SourceCatalog const &sourceCatalog,
487  std::string const &instFluxField,
488  ndarray::Array<double, 2, 2> result) const {
489  double instFlux, instFluxErr, calibration;
490  auto instFluxKey = sourceCatalog.getSchema().find<double>(instFluxField + "_instFlux").key;
491  auto instFluxErrKey = sourceCatalog.getSchema().find<double>(instFluxField + "_instFluxErr").key;
492  auto iter = result.begin();
493  for (auto const &rec : sourceCatalog) {
494  instFlux = rec.get(instFluxKey);
495  instFluxErr = rec.get(instFluxErrKey);
496  calibration = evaluate(rec.getCentroid());
497  (*iter)[0] = toMagnitude(instFlux, calibration);
498  (*iter)[1] = toMagnitudeErr(instFlux, instFluxErr, calibration, _calibrationErr);
499  iter++;
500  }
501 }
502 
504  auto key = "FLUXMAG0";
505  if (metadata.exists(key)) {
506  double instFluxMag0 = metadata.getAsDouble(key);
507  if (strip) metadata.remove(key);
508 
509  double instFluxMag0Err = 0.0;
510  key = "FLUXMAG0ERR";
511  if (metadata.exists(key)) {
512  instFluxMag0Err = metadata.getAsDouble(key);
513  if (strip) metadata.remove(key);
514  }
515  return makePhotoCalibFromCalibZeroPoint(instFluxMag0, instFluxMag0Err);
516  } else {
517  return nullptr;
518  }
519 }
520 
521 std::shared_ptr<PhotoCalib> makePhotoCalibFromCalibZeroPoint(double instFluxMag0, double instFluxMag0Err) {
522  double calibration = utils::referenceFlux / instFluxMag0;
523  double calibrationErr = utils::referenceFlux * instFluxMag0Err / std::pow(instFluxMag0, 2);
524  return std::make_shared<PhotoCalib>(calibration, calibrationErr);
525 }
526 
527 } // namespace image
528 } // namespace afw
529 } // namespace lsst
double getAsDouble(std::string const &name) const
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:1091
std::shared_ptr< PhotoCalib > makePhotoCalibFromMetadata(daf::base::PropertySet &metadata, bool strip=false)
Construct a PhotoCalib from FITS FLUXMAG0/FLUXMAG0ERR keywords.
Definition: PhotoCalib.cc:503
table::Key< double > calibrationErr
Definition: PhotoCalib.cc:304
std::shared_ptr< PhotoCalib > makePhotoCalibFromCalibZeroPoint(double instFluxMag0, double instFluxMag0Err)
Construct a PhotoCalib from the deprecated Calib-style instFluxMag0/instFluxMag0Err values...
Definition: PhotoCalib.cc:521
def keys(self)
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...
An object passed to Persistable::write to allow it to persist itself.
The photometric calibration of an exposure.
Definition: PhotoCalib.h:115
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:48
table::Key< table::Flag > isConstant
Definition: PhotoCalib.cc:305
def scale(algorithm, min, max=None, frame=None)
Definition: ds9.py:109
T to_string(T... args)
static std::shared_ptr< T > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
Definition: Persistable.cc:18
A value and its error.
Definition: PhotoCalib.h:52
bool strip
Definition: fits.cc:883
table::Key< double > fluxMag0Err
Definition: PhotoCalib.cc:388
#define PTR(...)
virtual void remove(std::string const &name)
ItemVariant const * other
Definition: Schema.cc:56
table::Key< double > expTime
Definition: PhotoCalib.cc:386
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Definition: BaseRecord.h:125
table::Key< double > calibrationMean
Definition: PhotoCalib.cc:303
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:1058
STL class.
SchemaItem< T > find(std::string const &name) const
Find a SchemaItem in the Schema by name.
Definition: Schema.cc:656
A base class for image defects.
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:74
log
Key< U > key
Definition: Schema.cc:281
T str(T... args)
T make_pair(T... args)
Schema getSchema() const
Return the Schema that holds this record&#39;s fields and keys.
Definition: BaseRecord.h:54
bool exists(std::string const &name) const
table::Key< double > fluxMag0
Definition: PhotoCalib.cc:387
table::Key< std::int64_t > midTime
Definition: PhotoCalib.cc:385
std::unique_ptr< SchemaItem< U > > result
Definition: Schema.cc:195
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
table::Schema schema
Definition: PhotoCalib.cc:302
std::ostream & operator<<(std::ostream &os, PhotoCalib const &photoCalib)
Definition: PhotoCalib.cc:266
T find(T... args)
#define LSST_EXCEPT(type,...)
double nanojanskyToABMagnitude(double flux)
T pow(T... args)
Record class that contains measurements made on a single exposure.
Definition: Source.h:82
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
std::ostream * os
Definition: Schema.cc:746
const double referenceFlux
STL class.
double ABMagnitudeToNanojansky(double magnitude)
Implementation of the Photometric Calibration class.
CentroidSlotDefinition::MeasValue getCentroid() const
Get the value of the Centroid slot measurement.
Definition: Source.h:644
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
Definition: Catalog.h:472
table::Key< int > version
Definition: PhotoCalib.cc:307
table::Key< int > field
Definition: PhotoCalib.cc:306