Called to measure a single child source in an image.
Before this method is called, all neighbors will be replaced with noise, using the outputs of the deblender. Outputs should be saved in the given SourceRecord, which can also be used to obtain centroid (see SafeCentroidExtractor) and shape (see SafeShapeExtractor) information.
371 (
boost::format(
"No footprint for source %d") % source.getId()).str());
382 if (peakCatalog.size() == 0) {
384 (
boost::format(
"No peak for source %d") % source.getId()).str());
386 else if (peakCatalog.size() == 1) {
394 afw::detection::PeakRecord
const& positivePeak = peakCatalog.front();
395 afw::detection::PeakRecord
const& negativePeak = peakCatalog.back();
398 ROOT::Minuit2::MnUserParameters fitPar;
409 MinimizeDipoleChi2 minimizerFunc(*
this, source, exposure);
415 ROOT::Minuit2::MnMigrad migrad(minimizerFunc, fitPar);
422 float minChi2 = min.Fval();
423 bool const isValid = min.IsValid() &&
std::isfinite(minChi2);
425 if (
true || isValid) {
432 std::pair<double,int> fit =
chi2(source, exposure,
439 double evalChi2 = fit.first;
440 int nPix = fit.second;
445 source.set(
getNegativeKeys().getFluxSigma(), min.UserState().Error(NEGFLUXPAR));
450 source.set(
getPositiveKeys().getFluxSigma(), min.UserState().Error(POSFLUXPAR));
452 source.set(
_chi2dofKey, evalChi2 / (nPix - minimizerFunc.getNpar()));
453 source.set(
_negCentroid.getX(), minNegCentroid->getX());
454 source.set(
_negCentroid.getY(), minNegCentroid->getY());
455 source.set(
_posCentroid.getX(), minPosCentroid->getX());
456 source.set(
_posCentroid.getY(), minPosCentroid->getY());
457 source.set(
_avgCentroid.getX(), 0.5*(minNegCentroid->getX() + minPosCentroid->getX()));
458 source.set(
_avgCentroid.getY(), 0.5*(minNegCentroid->getY() + minPosCentroid->getY()));
afw::table::Key< float > _chi2dofKey
float stepSizeFlux
"Default initial step size for flux in non-linear fitter" ;
meas::base::CentroidResultKey _avgCentroid
Point< double, 2 > Point2D
meas::base::CentroidResultKey _negCentroid
MaskedImage< float, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel > MaskedImageT
ResultKey const & getPositiveKeys() const
Return the standard flux keys registered by this algorithm.
int maxPixels
"Maximum number of pixels to apply the measurement to" ;
meas::base::CentroidResultKey _posCentroid
afw::table::CatalogT< PeakRecord > PeakCatalog
ResultKey const & getNegativeKeys() const
if(width!=gim.getWidth()||height!=gim.getHeight()||x0!=gim.getX0()||y0!=gim.getY0())
double errorDef
"How many sigma the error bars of the non-linear fitter represent" ;
int maxFnCalls
"Maximum function calls for non-linear fitter; 0 = unlimited" ;
#define LSST_EXCEPT(type,...)
float stepSizeCoord
"Default initial step size for coordinates in non-linear fitter" ;
lsst::afw::detection::Footprint Footprint
std::pair< double, int > chi2(afw::table::SourceRecord &source, afw::image::Exposure< float > const &exposure, double negCenterX, double negCenterY, double negFlux, double posCenterX, double poCenterY, double posFlux) const
afw::table::Key< afw::table::Flag > _flagMaxPixelsKey