65 """Return the colorterm corrected magnitudes for a given filter.
69 refCat : `lsst.afw.table.SimpleCatalog`
70 The reference catalog to apply color corrections to.
71 filterName : `str`, deprecated
72 The camera filter to correct the reference catalog into.
73 The ``filterName`` argument is unused and will be removed in v23.
78 The corrected AB magnitudes.
79 refMagErr : `np.ndarray`
80 The corrected AB magnitude errors.
85 Raised if the reference catalog does not have a flux uncertainty
90 WARNING: I do not know that we can trust the propagation of magnitude
91 errors returned by this method. They need more thorough tests.
93 if filterName !=
"deprecatedArgument":
94 msg =
"Colorterm.getCorrectedMagnitudes() `filterName` arg is unused and will be removed in v23."
95 warnings.warn(msg, category=FutureWarning, stacklevel=2)
97 def getFluxes(fluxField):
98 """Get the flux and fluxErr of this field from refCat.
103 Name of the source flux field to use.
108 refFluxErr : `Unknown`
113 Raised if reference catalog does not have flux uncertainties for the given flux field.
115 fluxKey = refCat.schema.find(fluxField).key
116 refFlux = refCat[fluxKey]
118 fluxErrKey = refCat.schema.find(fluxField +
"Err").key
119 refFluxErr = refCat[fluxErrKey]
120 except KeyError
as e:
121 raise KeyError(
"Reference catalog does not have flux uncertainties for %s" % fluxField)
from e
123 return refFlux, refFluxErr
125 primaryFlux, primaryErr = getFluxes(self.
primary +
"_flux")
126 secondaryFlux, secondaryErr = getFluxes(self.
secondary +
"_flux")
128 primaryMag = u.Quantity(primaryFlux, u.nJy).to_value(u.ABmag)
129 secondaryMag = u.Quantity(secondaryFlux, u.nJy).to_value(u.ABmag)
135 refMagErr = abMagErrFromFluxErr(refFluxErrArr*1e-9, primaryFlux*1e-9)
137 return refMag, refMagErr