Skip to content

Commit

Permalink
Add option to have Mag use calibrated fluxes
Browse files Browse the repository at this point in the history
Previously, Mag required either a calib object
or calib=None, when a default zero-point would be used.
Now, since the pipe-analysis parquet tables are writing
calibrated fluxes, if we want to compute mags from them,
then there needs to be an option for the Mag calculation
to have a ZP of one; this allows this if calib=False.
  • Loading branch information
timothydmorton committed Mar 11, 2020
1 parent 53bcf5f commit 83f2558
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions python/lsst/pipe/tasks/functors.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,14 +521,17 @@ class Mag(Functor):
`'modelfit_CModel'` instead of `'modelfit_CModel_instFlux'`) and it will
understand.
calib : `lsst.afw.image.calib.Calib` (optional)
Object that knows zero point.
Object that knows zero point. If `False`, then flux column is assumed
to be already calibrated (e.g., ZP=1.).
"""
_defaultDataset = 'meas'

def __init__(self, col, calib=None, **kwargs):
self.col = fluxName(col)
self.calib = calib
if calib is not None:
if calib is False:
self.fluxMag0 = 1.
elif calib is not None:
self.fluxMag0 = calib.getFluxMag0()[0]
else:
# TO DO: DM-21955 Replace hard coded photometic calibration values
Expand Down Expand Up @@ -560,15 +563,16 @@ class MagErr(Mag):
col : `str`
Name of flux column
calib : `lsst.afw.image.calib.Calib` (optional)
Object that knows zero point.
Object that knows zero point. If `False` or `None` (default),
then flux ZP error is assumed to be zero.
"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.calib is not None:
self.fluxMag0Err = self.calib.getFluxMag0()[1]
else:
if not self.calib:
self.fluxMag0Err = 0.
else:
self.fluxMag0Err = self.calib.getFluxMag0()[1]

@property
def columns(self):
Expand Down

0 comments on commit 83f2558

Please sign in to comment.