31#include "Eigen/Sparse"
46 Eigen::VectorXd &
grad,
62 if (_fittingModel) _photometryModel->getMappingIndices(
ccdImage, indices);
80 Eigen::Index
l = indices[k];
86 Eigen::Index index =
measuredStar->getFittedStar()->getIndexInMatrix();
105 if (!_fittingFluxes)
return;
111 for (
auto const &
fittedStar : fittedStarList) {
113 if (
refStar ==
nullptr)
continue;
125 Eigen::Index index =
fittedStar->getIndexInMatrix();
139 for (
auto const &
ccdImage : ccdImageList) {
140 auto &catalog =
ccdImage->getCatalogForFit();
160 for (
auto const &
fittedStar : fittedStarList) {
162 if (
refStar ==
nullptr)
continue;
176 _photometryModel->getMappingIndices(
measuredStar.getCcdImage(), indices);
178 if (_fittingFluxes) {
180 Eigen::Index
fsIndex =
fs->getIndexInMatrix();
189 _fittingFluxes = (
_whatToFit.
find(
"Fluxes") != std::string::npos);
195 if (_fittingFluxes) {
214 "PhotometryFit::offsetParams : the provided vector length is not compatible with "
215 "the current whatToFit setting");
216 if (_fittingModel) _photometryModel->offsetParams(delta);
218 if (_fittingFluxes) {
223 Eigen::Index index =
fittedStar->getIndexInMatrix();
224 _photometryModel->offsetFittedStar(*
fittedStar, delta(index));
247 <<
"measured magnitude error" <<
separator;
255 ofile <<
"contribution to chi2 (1 dof)" <<
separator <<
"number of measurements of this FittedStar"
260 for (
auto const &
ccdImage : ccdImageList) {
265 double instFluxErr = _photometryModel->tweakFluxError(*
measuredStar);
303 ofile <<
"unique index of the fittedStar" <<
separator <<
"refStar contribution to chi2 (1 dof)"
308 for (
auto const &
fittedStar : fittedStarList) {
310 if (
refStar ==
nullptr)
continue;
#define LOGLS_INFO(logger, message)
#define LOGLS_DEBUG(logger, message)
#define LSST_EXCEPT(type,...)
afw::table::Key< double > sigma
Handler of an actual image from a single CCD.
Base class for Chi2Statistic and Chi2List, to allow addEntry inside Fitter for either class.
A list of FittedStar s. Such a list is typically constructed by Associations.
Eigen::Index _nModelParams
std::shared_ptr< Associations > _associations
Eigen::Index _nStarParams
Sources measured on images.
A list of MeasuredStar. They are usually filled in Associations::createCcdImage.
void accumulateStatRefStars(Chi2Accumulator &accum) const override
Compute the chi2 (per star or total, depending on which Chi2Accumulator is used) for RefStars.
void assignIndices(std::string const &whatToFit) override
Set parameters to fit and assign indices in the big matrix.
void accumulateStatImageList(CcdImageList const &ccdImageList, Chi2Accumulator &accum) const override
Compute the chi2 (per star or total, depending on which Chi2Accumulator is used) for measurements.
void leastSquareDerivativesReference(FittedStarList const &fittedStarList, TripletList &tripletList, Eigen::VectorXd &grad) const override
Compute the derivatives of the reference terms.
void getIndicesOfMeasuredStar(MeasuredStar const &measuredStar, IndexVector &indices) const override
this routine is to be used only in the framework of outlier removal
void saveChi2RefContributions(std::string const &filename) const override
Save a CSV file containing residuals of reference terms.
void leastSquareDerivativesMeasurement(CcdImage const &ccdImage, TripletList &tripletList, Eigen::VectorXd &grad, MeasuredStarList const *measuredStarList=nullptr) const override
Compute the derivatives of the measured stars and model for one CcdImage.
void saveChi2MeasContributions(std::string const &filename) const override
Save a CSV file containing residuals of measurement terms.
void offsetParams(Eigen::VectorXd const &delta) override
Offset the parameters by the requested quantities.
Objects used as position/flux anchors (e.g.
T setprecision(T... args)