Skip to content

Commit 1e47eea

Browse files
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.
1 parent 7d0e58e commit 1e47eea

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Diff for: python/lsst/pipe/tasks/functors.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,17 @@ class Mag(Functor):
521521
`'modelfit_CModel'` instead of `'modelfit_CModel_instFlux'`) and it will
522522
understand.
523523
calib : `lsst.afw.image.calib.Calib` (optional)
524-
Object that knows zero point.
524+
Object that knows zero point. If `False`, then flux column is assumed
525+
to be already calibrated (e.g., ZP=1.).
525526
"""
526527
_defaultDataset = 'meas'
527528

528529
def __init__(self, col, calib=None, **kwargs):
529530
self.col = fluxName(col)
530531
self.calib = calib
531-
if calib is not None:
532+
if calib is False:
533+
self.fluxMag0 = 1.
534+
elif calib is not None:
532535
self.fluxMag0 = calib.getFluxMag0()[0]
533536
else:
534537
# TO DO: DM-21955 Replace hard coded photometic calibration values
@@ -560,15 +563,16 @@ class MagErr(Mag):
560563
col : `str`
561564
Name of flux column
562565
calib : `lsst.afw.image.calib.Calib` (optional)
563-
Object that knows zero point.
566+
Object that knows zero point. If `False` or `None` (default),
567+
then flux ZP error is assumed to be zero.
564568
"""
565569

566570
def __init__(self, *args, **kwargs):
567571
super().__init__(*args, **kwargs)
568-
if self.calib is not None:
569-
self.fluxMag0Err = self.calib.getFluxMag0()[1]
570-
else:
572+
if not self.calib:
571573
self.fluxMag0Err = 0.
574+
else:
575+
self.fluxMag0Err = self.calib.getFluxMag0()[1]
572576

573577
@property
574578
def columns(self):

0 commit comments

Comments
 (0)