Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-25768: Remove computeFluxScale function #162

Merged
merged 1 commit into from Aug 21, 2020
Merged

Conversation

taranu
Copy link
Contributor

@taranu taranu commented Aug 17, 2020

No description provided.

@taranu taranu force-pushed the tickets/DM-25768 branch 2 times, most recently from b1d7a44 to 51e65e7 Compare August 18, 2020 15:51
Copy link
Contributor

@isullivan isullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. My only comments are about small improvements in readability.

src/SdssShape.cc Outdated
double IxxIyy = result.getQuadrupole().getIxx() * result.getQuadrupole().getIyy();
double Ixy_sq = result.getQuadrupole().getIxy();
Ixy_sq *= Ixy_sq;
if (IxxIyy < (1.0 + 1.0e-6) * Ixy_sq)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make this:

epsilon = 1.0e-6
if (IxxIyy < (1.0 + epsilon) * Ixy_sq)

I like to see magic numbers defined on their own line, both to call attention to them and to make it obvious when they change.

src/SdssShape.cc Outdated
@@ -871,8 +857,8 @@ FluxResult SdssShapeAlgorithm::computeFixedMomentsFlux(ImageT const &image,
.str());
}
double var = ImageAdaptor<ImageT>().getVariance(image, ix, iy);
double i0Err = std::sqrt(var / wArea);
result.instFluxErr = i0Err * 2 * wArea;
// i0Err = std::sqrt(var / wArea); instFluxErr = 2 * wArea * i0Err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the commented-out code, but add a real comment to show where your final formula came from.

src/SdssShape.cc Outdated
double IxxIyy = result.getQuadrupole().getIxx() * result.getQuadrupole().getIyy();
double Ixy_sq = result.getQuadrupole().getIxy();
Ixy_sq *= Ixy_sq;
if (IxxIyy < (1.0 + 1.0e-6) * Ixy_sq)
// We are checking that Ixx*Iyy > (1 + epsilon)*Ixy*Ixy where epsilon is suitably small. The
// value of epsilon used here is a magic number. DM-5801 is supposed to figure out if we are
// to keep this value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can think of a better error message than the one below, please do so. But, it is outside the scope of this ticket, so don't feel you have to. If I got that error while processing data, I'd have to search the code for the message in order to figure out what went wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it slightly more useful. I haven't ever seen it actually pop up; it should be impossible. Also noted that DM-5801 was marked won't fix long ago.

@taranu taranu merged commit f5f79ae into master Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants