LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
ConstrainedPhotometryModel.cc
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 /*
3  * This file is part of jointcal.
4  *
5  * Developed for the LSST Data Management System.
6  * This product includes software developed by the LSST Project
7  * (https://www.lsst.org).
8  * See the COPYRIGHT file at the top-level directory of this distribution
9  * for details of code ownership.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
25 #include <map>
26 #include <limits>
27 #include <vector>
28 #include <string>
29 
30 #include "lsst/log/Log.h"
31 
32 #include "astshim.h"
33 #include "astshim/ChebyMap.h"
34 #include "lsst/geom.h"
38 #include "lsst/jointcal/CcdImage.h"
41 
42 namespace lsst {
43 namespace jointcal {
44 
46  Eigen::Index firstIndex) {
47  Eigen::Index index = firstIndex;
48  if (whatToFit.find("Model") == std::string::npos) {
49  LOGLS_WARN(_log, "assignIndices was called and Model is *not* in whatToFit");
50  return index;
51  }
52 
53  // If we got here, "Model" is definitely in whatToFit.
54  _fittingChips = (whatToFit.find("ModelChip") != std::string::npos);
55  _fittingVisits = (whatToFit.find("ModelVisit") != std::string::npos);
56  // If nothing more than "Model" is specified, it means fit everything.
57  if ((!_fittingChips) && (!_fittingVisits)) {
58  _fittingChips = _fittingVisits = true;
59  }
60 
61  if (_fittingChips) {
62  for (auto &idMapping : _chipMap) {
63  auto mapping = idMapping.second.get();
64  // Don't assign indices for fixed parameters.
65  if (mapping->isFixed()) continue;
66  mapping->setIndex(index);
67  index += mapping->getNpar();
68  }
69  }
70  if (_fittingVisits) {
71  for (auto &idMapping : _visitMap) {
72  auto mapping = idMapping.second.get();
73  mapping->setIndex(index);
74  index += mapping->getNpar();
75  }
76  }
77  for (auto &idMapping : _chipVisitMap) {
78  idMapping.second->setWhatToFit(_fittingChips, _fittingVisits);
79  }
80  return index;
81 }
82 
83 void ConstrainedPhotometryModel::offsetParams(Eigen::VectorXd const &delta) {
84  if (_fittingChips) {
85  for (auto &idMapping : _chipMap) {
86  auto mapping = idMapping.second.get();
87  // Don't offset indices for fixed parameters.
88  if (mapping->isFixed()) continue;
89  mapping->offsetParams(delta.segment(mapping->getIndex(), mapping->getNpar()));
90  }
91  }
92  if (_fittingVisits) {
93  for (auto &idMapping : _visitMap) {
94  auto mapping = idMapping.second.get();
95  mapping->offsetParams(delta.segment(mapping->getIndex(), mapping->getNpar()));
96  }
97  }
98 }
99 
101  for (auto &idMapping : _chipMap) {
102  idMapping.second.get()->freezeErrorTransform();
103  }
104  for (auto &idMapping : _visitMap) {
105  idMapping.second.get()->freezeErrorTransform();
106  }
107 }
108 
110  auto mapping = findMapping(ccdImage);
111  mapping->getMappingIndices(indices);
112 }
113 
115  std::size_t total = 0;
116  for (auto &idMapping : _chipMap) {
117  total += idMapping.second->getNpar();
118  }
119  for (auto &idMapping : _visitMap) {
120  total += idMapping.second->getNpar();
121  }
122  return total;
123 }
124 
126  CcdImage const &ccdImage,
127  Eigen::VectorXd &derivatives) const {
128  auto mapping = findMapping(ccdImage);
129  mapping->computeParameterDerivatives(measuredStar, measuredStar.getInstFlux(), derivatives);
130 }
131 
132 namespace {
133 // Convert photoTransform's way of storing Chebyshev coefficients into the format wanted by ChebyMap.
134 ndarray::Array<double, 2, 2> toChebyMapCoeffs(std::shared_ptr<PhotometryTransformChebyshev> transform) {
135  auto coeffs = transform->getCoefficients();
136  // 4 x nPar: ChebyMap wants rows that look like (a_ij, 1, i, j) for out += a_ij*T_i(x)*T_j(y)
137  ndarray::Array<double, 2, 2> chebyCoeffs =
138  allocate(ndarray::makeVector(transform->getNpar(), std::size_t(4)));
139  Eigen::VectorXd::Index k = 0;
140  auto order = transform->getOrder();
141  for (ndarray::Size j = 0; j <= order; ++j) {
142  ndarray::Size const iMax = order - j; // to save re-computing `i+j <= order` every inner step.
143  for (ndarray::Size i = 0; i <= iMax; ++i, ++k) {
144  chebyCoeffs[k][0] = coeffs[j][i];
145  chebyCoeffs[k][1] = 1;
146  chebyCoeffs[k][2] = i;
147  chebyCoeffs[k][3] = j;
148  }
149  }
150  return chebyCoeffs;
151 }
152 } // namespace
153 
155  for (auto &idMapping : _chipMap) {
156  out << "Sensor: " << idMapping.first << std::endl;
157  idMapping.second->print(out);
158  out << std::endl;
159  }
160  out << std::endl;
161  for (auto &idMapping : _visitMap) {
162  out << "Visit: " << idMapping.first << std::endl;
163  idMapping.second->print(out);
164  out << std::endl;
165  }
166 }
167 
169  auto idMapping = _chipVisitMap.find(ccdImage.getHashKey());
170  if (idMapping == _chipVisitMap.end())
172  "ConstrainedPhotometryModel cannot find CcdImage " + ccdImage.getName());
173  return idMapping->second.get();
174 }
175 
176 template <class ChipTransform, class VisitTransform, class ChipVisitMapping>
178  geom::Box2D const &focalPlaneBBox, int visitOrder) {
179  // keep track of which chip we want to constrain (the one closest to the middle of the focal plane)
180  double minRadius2 = std::numeric_limits<double>::infinity();
181  CcdIdType constrainedChip = -1;
182 
183  // First initialize all visit and ccd transforms, before we make the ccdImage mappings.
184  for (auto const &ccdImage : ccdImageList) {
185  auto visit = ccdImage->getVisit();
186  auto chip = ccdImage->getCcdId();
187  auto visitPair = _visitMap.find(visit);
188  auto chipPair = _chipMap.find(chip);
189 
190  // If the chip is not in the map, add it, otherwise continue.
191  if (chipPair == _chipMap.end()) {
192  auto center = ccdImage->getDetector()->getCenter(afw::cameraGeom::FOCAL_PLANE);
193  double radius2 = std::pow(center.getX(), 2) + std::pow(center.getY(), 2);
194  if (radius2 < minRadius2) {
195  minRadius2 = radius2;
196  constrainedChip = chip;
197  }
198  auto photoCalib = ccdImage->getPhotoCalib();
199  // Use the single-frame processing calibration from the PhotoCalib as the default.
200  auto chipTransform = std::make_unique<ChipTransform>(initialChipCalibration(photoCalib));
201  _chipMap[chip] = std::make_shared<PhotometryMapping>(std::move(chipTransform));
202  }
203  // If the visit is not in the map, add it, otherwise continue.
204  if (visitPair == _visitMap.end()) {
205  auto visitTransform = std::make_unique<VisitTransform>(visitOrder, focalPlaneBBox);
206  _visitMap[visit] = std::make_shared<PhotometryMapping>(std::move(visitTransform));
207  }
208  }
209 
210  // Fix one chip mapping, to remove the degeneracy from the system.
211  _chipMap.at(constrainedChip)->setFixed(true);
212 
213  // Now create the ccdImage mappings, which are combinations of the chip/visit mappings above.
214  for (auto const &ccdImage : ccdImageList) {
215  auto visit = ccdImage->getVisit();
216  auto chip = ccdImage->getCcdId();
217  _chipVisitMap.emplace(ccdImage->getHashKey(),
218  std::make_unique<ChipVisitMapping>(_chipMap[chip], _visitMap[visit]));
219  }
220  LOGLS_INFO(_log, "Got " << _chipMap.size() << " chip mappings and " << _visitMap.size()
221  << " visit mappings; holding chip " << constrainedChip << " fixed ("
222  << getTotalParameters() << " total parameters).");
223  LOGLS_DEBUG(_log, "CcdImage map has " << _chipVisitMap.size() << " mappings, with "
224  << _chipVisitMap.bucket_count() << " buckets and a load factor of "
226 }
227 
229  CcdImage const &ccdImage) const {
230  auto detector = ccdImage.getDetector();
231  auto ccdBBox = detector->getBBox();
232  ChipVisitPhotometryMapping *mapping = dynamic_cast<ChipVisitPhotometryMapping *>(findMapping(ccdImage));
233 
234  // There should be no way in which we can get to this point and not have a ChipVisitMapping,
235  // so blow up if we don't.
236  assert(mapping != nullptr);
237  // We know it's a Chebyshev transform because we created it as such, so blow up if it's not.
238  auto visitPhotometryTransform = std::dynamic_pointer_cast<PhotometryTransformChebyshev>(
239  mapping->getVisitMapping()->getTransform());
240  assert(visitPhotometryTransform != nullptr);
241  auto focalBBox = visitPhotometryTransform->getBBox();
242 
243  // Unravel our chebyshev coefficients to build an astshim::ChebyMap.
244  auto coeff_f = toChebyMapCoeffs(std::dynamic_pointer_cast<PhotometryTransformChebyshev>(
245  mapping->getVisitMapping()->getTransform()));
246  // Bounds are the bbox
247  std::vector<double> lowerBound = {focalBBox.getMinX(), focalBBox.getMinY()};
248  std::vector<double> upperBound = {focalBBox.getMaxX(), focalBBox.getMaxY()};
249  afw::geom::TransformPoint2ToGeneric visitTransform(ast::ChebyMap(coeff_f, 1, lowerBound, upperBound));
250 
251  double chipConstant = mapping->getChipMapping()->getParameters()[0];
252 
253  // Compute a box that covers the area of the ccd in focal plane coordinates.
254  // This is the box over which we want to compute the mean of the visit transform.
255  auto pixToFocal = detector->getTransform(afw::cameraGeom::PIXELS, afw::cameraGeom::FOCAL_PLANE);
256  geom::Box2D ccdBBoxInFocal;
257  for (auto const &point : pixToFocal->applyForward(geom::Box2D(ccdBBox).getCorners())) {
258  ccdBBoxInFocal.include(point);
259  }
260  double visitMean = visitPhotometryTransform->mean(ccdBBoxInFocal);
261 
262  return {chipConstant, visitTransform, pixToFocal, visitMean};
263 }
264 
265 // ConstrainedFluxModel methods
266 
268  MeasuredStar const &measuredStar) const {
269  return transform(ccdImage, measuredStar) - measuredStar.getFittedStar()->getFlux();
270 }
271 
272 double ConstrainedFluxModel::transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const {
273  auto mapping = findMapping(ccdImage);
274  return mapping->transform(measuredStar, measuredStar.getInstFlux());
275 }
276 
278  MeasuredStar const &measuredStar) const {
279  auto mapping = findMapping(ccdImage);
280  double tempErr = tweakFluxError(measuredStar);
281  return mapping->transformError(measuredStar, measuredStar.getInstFlux(), tempErr);
282 }
283 
285  auto ccdBBox = ccdImage.getDetector()->getBBox();
286  auto prep = prepPhotoCalib(ccdImage);
287 
288  // The chip part is easy: zoom map with the single value as the "zoom" factor
290  ast::ZoomMap(1, prep.chipConstant));
291 
292  // Now stitch them all together.
293  auto transform = prep.pixToFocal->then(prep.visitTransform)->then(zoomTransform);
294 
295  // NOTE: TransformBoundedField does not implement mean(), so we have to compute it here.
296  double mean = prep.chipConstant * prep.visitMean;
297 
298  auto boundedField = std::make_shared<afw::math::TransformBoundedField>(ccdBBox, *transform);
299  return std::make_shared<afw::image::PhotoCalib>(mean, ccdImage.getPhotoCalib()->getCalibrationErr(),
300  boundedField, false);
301 }
302 
304  out << "ConstrainedFluxModel:" << std::endl;
306 }
307 
308 // ConstrainedMagnitudeModel methods
309 
311  MeasuredStar const &measuredStar) const {
312  return transform(ccdImage, measuredStar) - measuredStar.getFittedStar()->getMag();
313 }
314 
316  MeasuredStar const &measuredStar) const {
317  auto mapping = findMapping(ccdImage);
318  return mapping->transform(measuredStar, measuredStar.getInstMag());
319 }
320 
322  MeasuredStar const &measuredStar) const {
323  auto mapping = findMapping(ccdImage);
324  double tempErr = tweakFluxError(measuredStar);
325  return mapping->transformError(measuredStar, measuredStar.getInstFlux(), tempErr);
326 }
327 
329  CcdImage const &ccdImage) const {
330  auto ccdBBox = ccdImage.getDetector()->getBBox();
331  auto prep = prepPhotoCalib(ccdImage);
332 
333  using namespace std::string_literals; // for operator""s to convert string literal->std::string
335  ast::MathMap(1, 1, {"y=pow(10.0,x/-2.5)"s}, {"x=-2.5*log10(y)"s}));
336 
337  // The chip part is easy: zoom map with the value (converted to a flux) as the "zoom" factor.
338  double chipCalibration = utils::ABMagnitudeToNanojansky(prep.chipConstant);
340  ast::ZoomMap(1, chipCalibration));
341 
342  // Now stitch them all together.
343  auto transform = prep.pixToFocal->then(prep.visitTransform)->then(logTransform)->then(zoomTransform);
344 
345  // NOTE: TransformBoundedField does not implement mean(), so we have to compute it here.
346  double mean = chipCalibration * std::pow(10, prep.visitMean / -2.5);
347 
348  auto boundedField = std::make_shared<afw::math::TransformBoundedField>(ccdBBox, *transform);
349  return std::make_shared<afw::image::PhotoCalib>(mean, ccdImage.getPhotoCalib()->getCalibrationErr(),
350  boundedField, false);
351 }
352 
354  out << "ConstrainedMagnitudeModel (" << _chipVisitMap.size() << " composite mappings; " << _chipMap.size()
355  << " sensor mappings, " << _visitMap.size() << " visit mappings):" << std::endl;
357 }
358 
359 // explicit instantiation of templated function, so pybind11 can
362  geom::Box2D const &, int);
365  CcdImageList const &, geom::Box2D const &, int);
366 
367 } // namespace jointcal
368 } // namespace lsst
lsst::jointcal::CcdImage::getHashKey
CcdImageKey getHashKey() const
Definition: CcdImage.h:152
lsst::jointcal::MeasuredStar
objects measured on actual images.
Definition: MeasuredStar.h:46
lsst::jointcal::ConstrainedMagnitudeModel::transform
double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override
Return the on-sky transformed flux for measuredStar on ccdImage.
Definition: ConstrainedPhotometryModel.cc:315
lsst::jointcal::ConstrainedFluxModel::toPhotoCalib
std::shared_ptr< afw::image::PhotoCalib > toPhotoCalib(CcdImage const &ccdImage) const override
Return the mapping of ccdImage represented as a PhotoCalib.
Definition: ConstrainedPhotometryModel.cc:284
std::string
STL class.
TransformBoundedField.h
std::shared_ptr
STL class.
std::list< std::shared_ptr< CcdImage > >
CcdImage.h
std::move
T move(T... args)
lsst::jointcal::FluxTransformSpatiallyInvariant
Photometric offset independent of position, defined as (fluxMag0)^-1.
Definition: PhotometryTransform.h:146
lsst::jointcal::MeasuredStar::getInstFlux
double getInstFlux() const
Definition: MeasuredStar.h:97
lsst::afw::geom::Transform
Transform LSST spatial data, such as lsst::geom::Point2D and lsst::geom::SpherePoint,...
Definition: Transform.h:68
lsst::jointcal::CcdIdType
int CcdIdType
Definition: CcdImage.h:49
lsst::jointcal::ChipVisitPhotometryMapping
A two-level photometric transform: one for the ccd and one for the visit.
Definition: PhotometryMapping.h:218
std::vector
STL class.
std::string::find
T find(T... args)
std::map::size
T size(T... args)
lsst::jointcal::ConstrainedMagnitudeModel::toPhotoCalib
std::shared_ptr< afw::image::PhotoCalib > toPhotoCalib(CcdImage const &ccdImage) const override
Return the mapping of ccdImage represented as a PhotoCalib.
Definition: ConstrainedPhotometryModel.cc:328
lsst::jointcal::ConstrainedFluxModel::transformError
double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override
Return the on-sky transformed flux uncertainty for measuredStar on ccdImage.
Definition: ConstrainedPhotometryModel.cc:277
ConstrainedPhotometryModel.h
lsst::jointcal::ChipVisitMagnitudeMapping
Definition: PhotometryMapping.h:303
std::unordered_map::emplace
T emplace(T... args)
LOGLS_INFO
#define LOGLS_INFO(logger, message)
Definition: Log.h:628
ast::ZoomMap
A Mapping which "zooms" a set of points about the origin by multiplying all coordinate values by the ...
Definition: ZoomMap.h:45
lsst::jointcal::ConstrainedPhotometryModel::PrepPhotoCalib
To hold the return of prepPhotoCalib.
Definition: ConstrainedPhotometryModel.h:121
lsst::jointcal::MagnitudeTransformSpatiallyInvariant
Photometric offset independent of position, defined as -2.5 * log(flux / fluxMag0).
Definition: PhotometryTransform.h:178
lsst::jointcal::ConstrainedMagnitudeModel::computeResidual
double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override
Compute the residual between the model applied to a star and its associated fittedStar.
Definition: ConstrainedPhotometryModel.cc:310
astshim.h
lsst::geom::Box2D::getCorners
std::vector< Point2D > getCorners() const
Get the corner points.
Definition: Box.cc:496
lsst::jointcal::PhotometryMappingBase
Relates transform(s) to their position in the fitting matrix and allows interaction with the transfor...
Definition: PhotometryMapping.h:44
lsst::jointcal::CcdImage::getName
std::string getName() const
Return the _name that identifies this ccdImage.
Definition: CcdImage.h:79
lsst::jointcal::ConstrainedFluxModel::computeResidual
double computeResidual(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override
Compute the residual between the model applied to a star and its associated fittedStar.
Definition: ConstrainedPhotometryModel.cc:267
LOGLS_WARN
#define LOGLS_WARN(logger, message)
Definition: Log.h:648
lsst::jointcal::PhotometryModel::tweakFluxError
double tweakFluxError(jointcal::MeasuredStar const &measuredStar) const
Add a fraction of the instrumental flux to the instrumental flux error, in quadrature.
Definition: PhotometryModel.h:199
lsst::jointcal::ConstrainedPhotometryModel::getMappingIndices
void getMappingIndices(CcdImage const &ccdImage, IndexVector &indices) const override
Get how this set of parameters (of length Npar()) map into the "grand" fit.
Definition: ConstrainedPhotometryModel.cc:109
std::map::at
T at(T... args)
std::numeric_limits::infinity
T infinity(T... args)
std::ostream
STL class.
ChebyMap.h
lsst::jointcal::CcdImage
Handler of an actual image from a single CCD.
Definition: CcdImage.h:64
lsst::jointcal::ConstrainedPhotometryModel::initialChipCalibration
virtual double initialChipCalibration(std::shared_ptr< afw::image::PhotoCalib const > photoCalib)=0
Return the initial calibration to use from this photoCalib.
lsst::jointcal::ConstrainedPhotometryModel::freezeErrorTransform
void freezeErrorTransform() override
Once this routine has been called, the error transform is not modified by offsetParams().
Definition: ConstrainedPhotometryModel.cc:100
lsst::jointcal::ChipVisitPhotometryMapping::getVisitMapping
std::shared_ptr< PhotometryMapping > getVisitMapping() const
Definition: PhotometryMapping.h:275
lsst::jointcal::ChipVisitPhotometryMapping::getChipMapping
std::shared_ptr< PhotometryMapping > getChipMapping() const
Definition: PhotometryMapping.h:274
Transform.h
lsst::jointcal::ConstrainedFluxModel::print
void print(std::ostream &out) const override
Print a string representation of the contents of this mapping, for debugging.
Definition: ConstrainedPhotometryModel.cc:303
lsst::jointcal::ConstrainedPhotometryModel::_visitMap
VisitMapType _visitMap
Definition: ConstrainedPhotometryModel.h:106
lsst::jointcal::MeasuredStar::getFittedStar
std::shared_ptr< FittedStar > getFittedStar() const
Definition: MeasuredStar.h:113
lsst::jointcal
Definition: Associations.h:49
lsst::jointcal::MeasuredStar::getInstMag
double getInstMag() const
Definition: MeasuredStar.h:99
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
LOGLS_DEBUG
#define LOGLS_DEBUG(logger, message)
Definition: Log.h:608
ast::ChebyMap
A ChebyMap is a form of Mapping which performs a Chebyshev polynomial transformation.
Definition: ChebyMap.h:97
photoCalib
Key< int > photoCalib
Definition: Exposure.cc:67
lsst::jointcal::ConstrainedPhotometryModel::assignIndices
Eigen::Index assignIndices(std::string const &whatToFit, Eigen::Index firstIndex) override
Assign indices in the full matrix to the parameters being fit in the mappings, starting at firstIndex...
Definition: ConstrainedPhotometryModel.cc:45
lsst::afw::cameraGeom::FOCAL_PLANE
CameraSys const FOCAL_PLANE
Focal plane coordinates: Position on a 2-d planar approximation to the focal plane (x,...
Definition: CameraSys.cc:30
lsst::jointcal::ChipVisitFluxMapping
Definition: PhotometryMapping.h:289
lsst::jointcal::ConstrainedMagnitudeModel::transformError
double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override
Return the on-sky transformed flux uncertainty for measuredStar on ccdImage.
Definition: ConstrainedPhotometryModel.cc:321
std::endl
T endl(T... args)
std::unordered_map::load_factor
T load_factor(T... args)
lsst.pex::exceptions::InvalidParameterError
Reports invalid arguments.
Definition: Runtime.h:66
lsst::jointcal::PhotometryModel::_log
LOG_LOGGER _log
lsst.logging instance, to be created by a subclass so that messages have consistent name.
Definition: PhotometryModel.h:221
PhotoCalib.h
Implementation of the Photometric Calibration class.
lsst::jointcal::ConstrainedPhotometryModel::computeParameterDerivatives
void computeParameterDerivatives(MeasuredStar const &measuredStar, CcdImage const &ccdImage, Eigen::VectorXd &derivatives) const override
Compute the parametric derivatives of this model.
Definition: ConstrainedPhotometryModel.cc:125
lsst::jointcal::ConstrainedFluxModel::transform
double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar) const override
Return the on-sky transformed flux for measuredStar on ccdImage.
Definition: ConstrainedPhotometryModel.cc:272
std::unordered_map::bucket_count
T bucket_count(T... args)
detector
table::Key< int > detector
Definition: DetectorCollection.cc:172
lsst::utils::ABMagnitudeToNanojansky
double ABMagnitudeToNanojansky(double magnitude)
Convert an AB magnitude to a flux in nanojansky.
Definition: Magnitude.cc:32
lsst::jointcal::ConstrainedPhotometryModel::print
void print(std::ostream &out) const override
Print a string representation of the contents of this mapping, for debugging.
Definition: ConstrainedPhotometryModel.cc:154
lsst::geom::Box2D::include
void include(Point2D const &point) noexcept
Expand this to ensure that this->contains(point).
Definition: Box.cc:380
lsst::jointcal::CcdImage::getDetector
std::shared_ptr< afw::cameraGeom::Detector > getDetector() const
Definition: CcdImage.h:150
transform
table::Key< int > transform
Definition: TransformMap.cc:299
lsst::jointcal::ConstrainedPhotometryModel::prepPhotoCalib
PrepPhotoCalib prepPhotoCalib(CcdImage const &ccdImage) const
Helper for preparing toPhotoCalib()
Definition: ConstrainedPhotometryModel.cc:228
ast::MathMap
A MathMap is a Mapping which allows you to specify a set of forward and/or inverse transformation fun...
Definition: MathMap.h:61
std::size_t
lsst::jointcal::MagnitudeTransformChebyshev
nth-order 2d Chebyshev photometry transform, plus the input flux.
Definition: PhotometryTransform.h:331
std::unordered_map::end
T end(T... args)
lsst::jointcal::FluxTransformChebyshev
nth-order 2d Chebyshev photometry transform, times the input flux.
Definition: PhotometryTransform.h:302
lsst::geom::Box2D
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
lsst.pipe.tasks.assembleCoadd.visit
visit
Definition: assembleCoadd.py:343
lsst::jointcal::ConstrainedPhotometryModel::_chipMap
ChipMapType _chipMap
Definition: ConstrainedPhotometryModel.h:109
lsst::jointcal::ConstrainedPhotometryModel::findMapping
PhotometryMappingBase * findMapping(CcdImage const &ccdImage) const override
Return a pointer to the mapping associated with this ccdImage.
Definition: ConstrainedPhotometryModel.cc:168
lsst::jointcal::ConstrainedMagnitudeModel::print
void print(std::ostream &out) const override
Print a string representation of the contents of this mapping, for debugging.
Definition: ConstrainedPhotometryModel.cc:353
lsst::jointcal::CcdImage::getPhotoCalib
std::shared_ptr< afw::image::PhotoCalib > getPhotoCalib() const
Return the exposure's photometric calibration.
Definition: CcdImage.h:161
lsst::afw::cameraGeom::PIXELS
CameraSysPrefix const PIXELS
Pixel coordinates: Nominal position on the entry surface of a given detector (x, y unbinned pixels).
Definition: CameraSys.cc:34
geom.h
Log.h
LSST DM logging module built on log4cxx.
PhotometryMapping.h
lsst::jointcal::ConstrainedPhotometryModel::offsetParams
void offsetParams(Eigen::VectorXd const &delta) override
Offset the parameters by the provided amounts (by -delta).
Definition: ConstrainedPhotometryModel.cc:83
lsst::jointcal::ConstrainedPhotometryModel::_chipVisitMap
MapType _chipVisitMap
Definition: ConstrainedPhotometryModel.h:102
lsst::jointcal::ConstrainedPhotometryModel::getTotalParameters
std::size_t getTotalParameters() const override
Return the total number of parameters in this model.
Definition: ConstrainedPhotometryModel.cc:114
lsst::jointcal::ConstrainedPhotometryModel::initialize
void initialize(CcdImageList const &ccdImageList, geom::Box2D const &focalPlaneBBox, int visitOrder)
Initialize the chip, visit, and chipVisit mappings by creating appropriate transforms and mappings.
Definition: ConstrainedPhotometryModel.cc:177
std::pow
T pow(T... args)