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-16650: Update to nanojansky photocalib definition #5

Merged
merged 2 commits into from
Dec 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions python/lsst/fgcmcal/fgcmOutputProducts.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import numpy as np
import healpy as hp
import esutil
from astropy import units

import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase
Expand Down Expand Up @@ -743,7 +744,7 @@ def _getChebyshevPhotoCalib(self, coefficients, err, xyMax, offset, scaling):
# Take the zeropoint, apply the absolute relative calibration offset,
# and whatever flat-field scaling was applied
pars[:, :] = (coefficients.reshape(orderPlus1, orderPlus1) *
10.**(offset / (-2.5)) * scaling)
(offset*units.ABmag).to_value(units.nJy) * scaling)
Copy link
Contributor

Choose a reason for hiding this comment

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

The offset here is delta-mag, not ABmag. So an offset of say delta_mag = 0.1 should be applying a factor of 0.91 (original code), and now will apply an offset of 3311311214825.901.
Basically, the key is that the code will match whatever the units of the reference catalog are.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I finally figured out for myself what's going on here, and it's correct, but it works because the units of the original returned coefficients from fgcm. I'll have to document that better on the fgcm side, or change that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Methods like this are perfect use cases for simple unittests. I can help you write one, if you want.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is DM-16525


field = afwMath.ChebyshevBoundedField(bbox, pars)
calibMean = field.mean()
Expand Down Expand Up @@ -777,7 +778,7 @@ def _getConstantPhotoCalib(self, zeropoint, err, offset, scaling):
# Take the zeropoint, apply the absolute relative calibration offset,
# and whatever flat-field scaling was applied

calibMean = 10.**(zeropoint / (-2.5)) * 10.**(offset / (-2.5)) * scaling
calibMean = ((zeropoint + offset)*units.ABmag).to_value(units.nJy) * scaling
calibErr = (np.log(10.) / 2.5) * calibMean * err
photoCalib = afwImage.PhotoCalib(calibMean, calibErr)

Expand Down