From 83f255883b0b53b9580e8c89276c2f8cde0501fe Mon Sep 17 00:00:00 2001 From: Timothy Morton Date: Wed, 11 Mar 2020 05:52:49 +0000 Subject: [PATCH] Add option to have Mag use calibrated fluxes 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. --- python/lsst/pipe/tasks/functors.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/python/lsst/pipe/tasks/functors.py b/python/lsst/pipe/tasks/functors.py index f9708aedf6..cfa459c9bb 100644 --- a/python/lsst/pipe/tasks/functors.py +++ b/python/lsst/pipe/tasks/functors.py @@ -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 @@ -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):