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-11905 Convert photoCalib to multiplicative defintion #276
Conversation
77be4f7
to
d6e1de3
Compare
include/lsst/afw/image/PhotoCalib.h
Outdated
* | ||
* @see PhotoCalib::computeScaledZeroPoint(), getinstFluxMag0Err() | ||
* @see PhotoCalib::computeScaledcalibration(), getCalibrationErr(), getInstFluxMag0() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capital "C" in computeScaledCalibration() (here and other instances below)?
include/lsst/afw/image/PhotoCalib.h
Outdated
* @f] | ||
* and | ||
* @f[ | ||
* 2.5/log(10) * sqrt((instFluxErr/instFlux)^2 + (zeroPointErr/zeroPoint)^2) = magnitudeErr | ||
* 2.5/log(10) * sqrt((instFluxErr/instFlux)^2 + (calibrationErr/calibration)^2) = magnitudeErr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are inconsistent here in your use of spaces around operators (I'm not sure what the preference/requirement is for documentation, but consistency would be nice).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both our C++ and say to put spaces around +-
, and prefer no spaces around */
. I've made it more consistent with that.
The spaces in the math blocks here don't affect the spacing in the generated html.
include/lsst/afw/image/PhotoCalib.h
Outdated
* @param[in] instFluxMag0 The constant instFlux/magnitude zero point (instFlux at magnitude 0). | ||
* @param[in] instFluxMag0Err The error on the zero point. | ||
* @param[in] calibrationMean The spatially-constant calibration (equal to 1/(instFlux at magnitude 0)). | ||
* @param[in] calibrationError The error on the zero point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space after calibrationError
Also, it's a bit confusing to call this the error on the "zero point" since you do not refer to calibrationMean as the "zero point".
You also now seem to vary between Err and Error as the error suffiix (and below with calibrationError vs. _calibrationErr vs. self.calibrationErr vs. getCalibrationErr() vs. instFluxErr)
[and note your commit message says: instFluxMag0Err -> calibrationErr]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching these: I should be using Err
everywhere, per RFC-333.
include/lsst/afw/image/PhotoCalib.h
Outdated
* @param[in] isConstant Is this PhotoCalib spatially constant? | ||
* @param[in] calibrationMean The mean of the calibration() over its bounding box. | ||
* @param[in] calibration The spatially varying photometric zero point. | ||
* @param[in] calibrationError The error on the zero point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now here you do refer to calibration as a "zero point". Make all cases consistent (and, if it doesn't seem like overkill, you could emphasize in all these descriptions that it is a multiplicative factor, but I'm not imposing that if you think it's obvious).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching these: I've removed all the erroneous references to "zero point", because that's not a useful term here any more (except the one method that returns instFluxMag0
). I'm leaving the mathematical description for the class docstring at the top, so it only has to be written once.
include/lsst/afw/image/PhotoCalib.h
Outdated
* @see PhotoCalib::computeScaledcalibration(), getCalibrationMean() | ||
* | ||
* @returns The instFlux magnitude zero point. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation looks wrong (you should be describing getting an error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this one is correct: getInstFluxMag0()
returns an inverse calibration (the magnitude zero point), not an error. But my above inconsistencies regarding zero point and Err probably didn't help matters.
PhotoCalib::instFluxToMaggies, | ||
cls.def("instFluxToMaggies", | ||
(double (PhotoCalib::*)(double, afw::geom::Point<double, 2> const &) const) & | ||
PhotoCalib::instFluxToMaggies, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purely formatting changes should be on their own commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using an "auto clang-format on save" plugin in SublimeText, and it apparently prefers the latter. I'm not going to argue with it (the &
is right up on the 110 character boundary, which is probably the issue).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not questioning the formatting choices, just saying they should be on their own commit (you can do an initial "auto clang-format on save" before making any actual code changes to the file to keep them isolated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you in principle and will try to watch for other clang-format changes in the future, but I don't think it's worth cherry picking this out in this case.
include/lsst/afw/image/PhotoCalib.h
Outdated
* The spatially varying flux/magnitude zero point is defined such that, | ||
* at a position (x,y) in the domain of the boundedField zeroPoint | ||
* The spatially varying flux/magnitude zero point has units of maggies/ADU, and is defined such that, | ||
* at a position (x,y) in the domain of the boundedField calibration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume (x, y) here is taken as the object's (slot) centroid?
The line break here seems unnatural.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(x,y) is whatever position you pass in to whichever of the overloaded functions. The functions that take Record
use get('x')
as documented.
Reflowed the line: it's just under the 110 character limit.
PhotoCalib::instFluxToMaggies, | ||
cls.def("instFluxToMaggies", | ||
(double (PhotoCalib::*)(double, afw::geom::Point<double, 2> const &) const) & | ||
PhotoCalib::instFluxToMaggies, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not questioning the formatting choices, just saying they should be on their own commit (you can do an initial "auto clang-format on save" before making any actual code changes to the file to keep them isolated).
include/lsst/afw/image/PhotoCalib.h
Outdated
* | ||
* This value is defined such that for some instFluxErr, instFlux, and flux: | ||
* sqrt((instFluxErr/instFlux)^2 + (zeroPointErr/zeroPoint(x,y))^2)*flux = fluxErr (in maggies) | ||
* sqrt((instFluxErr/instFlux)^2 + (calibrationErr/calibration(x,y))^2)*flux = fluxErr (in maggies) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still seeing spacing inconsistencies: here vs. 312 vs. 337, vs...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've cleaned up all of these to make them proper math blocks, so they'll render properly in the final output, and also tried to make them consistent with our C++ guidelines.
src/image/PhotoCalib.cc
Outdated
schema.addField<double>("instFluxMag0Err", "1-err error on instFluxmag0", "count")), | ||
calibrationMean(schema.addField<double>( | ||
"calibrationMean", "mean calibration on this PhotoCalib's domain", "count")), | ||
calibrationErr(schema.addField<double>("calibrationErr", "1-sigma err error on calibrationMean", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"1-sigma err error"?!
34f6c47
to
bff48c2
Compare
Rename several things: instFluxMag0 -> calibrationMean zeroPoint() -> calibration() instFluxMag0Err -> calibrationErr Remove getInstFluxMag0Err Fix bug in test, where it was using self.instFlux0Err instead of the passed instFlux0Err (now calibrationErr). This bug was only noticeable when I was testing with non-physical errors (e.g. >10x calibration); I've checked the rest of the code for similar bugs, and found none.
069ca2a
to
7237e73
Compare
No description provided.