Skip to content

Commit

Permalink
Add edge flag for NaiveFlux, to account for cases when aperture doesn…
Browse files Browse the repository at this point in the history
…'t fit in frame
  • Loading branch information
TallJimbo committed Oct 13, 2014
1 parent 3307cc4 commit 6cae377
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion include/lsst/meas/base/NaiveFlux.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class NaiveFluxAlgorithm {
* Inspect getFlagDefinitions() for more detailed explanations of each flag.
*/
enum FlagBits {
EDGE,
N_FLAGS
};

Expand All @@ -85,7 +86,9 @@ class NaiveFluxAlgorithm {
* in catalog schemas.
*/
static boost::array<FlagDef,N_FLAGS> const & getFlagDefinitions() {
static boost::array<FlagDef,N_FLAGS> const flagDefs = {};
static boost::array<FlagDef,N_FLAGS> const flagDefs = {{
{"edge", "source is too close to the edge of the field to compute the given aperture"}
}};
return flagDefs;
}

Expand Down
10 changes: 9 additions & 1 deletion src/NaiveFlux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,15 @@ void NaiveFluxAlgorithm::apply(
ctrl.radius,
imageBBox
);
fluxFunctor.apply(foot);
try {
fluxFunctor.apply(foot);
} catch (pex::exceptions::LengthError &) {
throw LSST_EXCEPT(
MeasurementError,
getFlagDefinitions()[EDGE].doc,
EDGE
);
}

result.flux = fluxFunctor.getSum();
result.fluxSigma = ::sqrt(fluxFunctor.getSumVar());
Expand Down

0 comments on commit 6cae377

Please sign in to comment.