11 LOG_LOGGER _log =
LOG_GET(
"jointcal.SimplePhotometryModel");
19 for (
auto const &
ccdImage : ccdImageList) {
20 auto photoCalib =
ccdImage->getPhotoCalib();
23 std::make_shared<PhotometryTransfoSpatiallyInvariant>(photoCalib->getCalibrationMean());
27 LOGLS_INFO(_log,
"SimplePhotometryModel got " << _myMap.
size() <<
" ccdImage mappings.");
31 unsigned ipar = firstIndex;
32 for (
auto const &i : _myMap) {
33 auto mapping = i.second.get();
34 mapping->setIndex(ipar);
35 ipar += mapping->getNpar();
41 for (
auto &i : _myMap) {
42 auto mapping = i.second.get();
43 mapping->offsetParams(delta.segment(mapping->getIndex(), mapping->getNpar()));
48 double instFlux)
const {
49 auto mapping = findMapping(ccdImage);
50 return mapping->transform(star, instFlux);
54 double instFluxErr)
const {
55 auto mapping = findMapping(ccdImage);
56 return mapping->transformError(star, instFluxErr);
60 for (
auto &i : _myMap) {
61 i.second->freezeErrorTransform();
67 auto mapping = findMapping(ccdImage);
68 if (indices.
size() < mapping->getNpar()) indices.
resize(mapping->getNpar());
69 indices[0] = mapping->getIndex();
74 for (
auto &i : _myMap) {
75 total += i.second->getNpar();
82 Eigen::VectorXd &derivatives)
const {
83 auto mapping = findMapping(ccdImage);
84 mapping->computeParameterDerivatives(measuredStar, measuredStar.
getInstFlux(), derivatives);
88 double calibration = (findMapping(ccdImage)->
getParameters()[0]);
95 for (
auto &i : _myMap) {
96 stream << i.first <<
": ";
97 i.second->dump(stream);
104 if (i == _myMap.
end())
106 "SimplePhotometryModel cannot find CcdImage " + ccdImage.
getName());
107 return i->second.get();
std::shared_ptr< afw::image::PhotoCalib > toPhotoCalib(CcdImage const &ccdImage) const override
Return the mapping of ccdImage represented as a PhotoCalib.
double transform(CcdImage const &ccdImage, MeasuredStar const &measuredStar, double instFlux) const override
Return the on-sky transformed flux for measuredStar on ccdImage.
Relates transfo(s) to their position in the fitting matrix and allows interaction with the transfo(s)...
virtual Eigen::VectorXd getParameters()=0
std::string getName() const
Return the _name that identifies this ccdImage.
int getTotalParameters() const override
Return the total number of parameters in this model.
SimplePhotometryModel(CcdImageList const &ccdImageList)
void computeParameterDerivatives(MeasuredStar const &measuredStar, CcdImage const &ccdImage, Eigen::VectorXd &derivatives) const override
Compute the parametric derivatives of this model.
#define LOGLS_INFO(logger, message)
void getMappingIndices(CcdImage const &ccdImage, std::vector< unsigned > &indices) const override
Get how this set of parameters (of length Npar()) map into the "grand" fit.
std::shared_ptr< afw::image::PhotoCalib > getPhotoCalib() const
Return the exposure's photometric calibration.
Class for a simple mapping implementing a generic Gtransfo.
double getInstFlux() const
objects measured on actual images.
double transformError(CcdImage const &ccdImage, MeasuredStar const &measuredStar, double instFluxErr) const override
Return the on-sky transformed flux uncertainty for measuredStar on ccdImage.
unsigned assignIndices(std::string const &whatToFit, unsigned firstIndex) override
Assign indices in the full matrix to the parameters being fit in the mappings, starting at firstIndex...
#define LSST_EXCEPT(type,...)
void offsetParams(Eigen::VectorXd const &delta) override
Offset the parameters by the provided amounts.
CcdImageKey getHashKey() const
void dump(std::ostream &stream=std::cout) const override
Dump the contents of the transfos, for debugging.
Handler of an actual image from a single CCD.
A mapping containing a single photometryTransfo.
void freezeErrorTransform() override
Once this routine has been called, the error transform is not modified by offsetParams().