21 """Configuration for SED terms in fgcmcal. 
   22 Analogous to colorterms. 
   25 from lsst.pex.config 
import Config, Field, ConfigDictField
 
   27 __all__ = [
"Sedterm", 
"SedtermDict", 
"Sedboundaryterm", 
"SedboundarytermDict"]
 
   31     """SED boundary term for a pair of bands. 
   33     The SED slope (in flux units) at the boundary between two bands is given by: 
   35         S = -0.921 * (primary - secondary) / (lambda_primary - lambda_secondary) 
   37     To construct a Sedboundaryterm, use keyword arguments: 
   38     Sedboundaryterm(primary=primaryBandName, secondary=secondaryBandName) 
   40     This is a subclass of Config.  This follows the form of 
   41     `lsst.pipe.tasks.Colorterm`. 
   43     primary = Field(dtype=str, doc=
"name of primary band")
 
   44     secondary = Field(dtype=str, doc=
"name of secondary band")
 
   48     """A mapping of Sedboundaryterm name to Sedterm. 
   50     To construct a SedboundarytermDict use keyword arguments: 
   51     SedboundarytermDict(data=dataDict) 
   52     where dataDict is a Python dict of name: Sedterm 
   55     SedboundarytermDict(data={ 
   56         'gr': Sedboundaryterm(primary="g", secondary="r"), 
   57         'ri': Sedboundaryterm(primary="r", secondary="i"), 
   60     This is a subclass of Config.  This follows the form of 
   61     `lsst.pipe.tasks.ColortermDict`. 
   63     data = ConfigDictField(
 
   64         doc=
"Mapping of Sedboundary term name to Sedboundaryterm",
 
   66         itemtype=Sedboundaryterm,
 
   72     """SED term for a single band. 
   74     The SED slope (in flux units) in the middle of a band is computed either 
   75     as an "interpolated" or "extrapolated" computation.  See Burke et al. 2018 
   76     Appendix A (https://ui.adsabs.harvard.edu/abs/2018AJ....155...41B). 
   78     For interpolation, with a secondary term: 
   79        F'_nu ~ constant * (primaryTerm + secondaryTerm) / 2.0 
   81     For interpolation, without a secondary term: 
   82        F'_nu ~ constant * primaryTerm 
   85        F'_nu ~ primaryTerm + constant * (((lambda_primaryBand - lambda_secondaryBand) / 
   86                                          (lambda_primaryBand - lambda_tertiaryBand)) * 
   87                                          (primaryTerm - secondaryTerm)) 
   89     where primaryTerm and secondaryTerm are names from a `SedboundarytermDict`, and 
   90     primaryBand, secondaryBand, and tertiaryBand are band names. 
   92     To construct a Sedterm, use keyword arguments: 
   94     Sedterm(primaryTerm=primaryTermName, secondaryTerm=secondaryTermName, 
   95             extrapolated=False, constant=1.0) 
   99     Sedterm(primaryTerm=primaryTermName, secondaryTerm=secondaryTermName, 
  100             extrapolated=True, constant=1.0, primaryBand=primaryBandName, 
  101             secondaryBand=secondaryBandName, tertiaryBand=tertiaryBandName) 
  103     This is a subclass of Config.  This follows the form of 
  104     `lsst.pipe.tasks.Colorterm`. 
  106     primaryTerm = Field(dtype=str, doc=
"Name of primary Sedboundaryterm")
 
  107     secondaryTerm = Field(dtype=str, default=
None, optional=
True,
 
  108                           doc=
"Name of secondary Sedboundaryterm")
 
  109     extrapolated = Field(dtype=bool, default=
False, doc=
"Extrapolate to compute SED slope")
 
  110     constant = Field(dtype=float, default=1.0, doc=
"Adjustment constant for SED slope")
 
  111     primaryBand = Field(dtype=str, default=
None, optional=
True,
 
  112                         doc=
"Primary band name for extrapolation")
 
  113     secondaryBand = Field(dtype=str, default=
None, optional=
True,
 
  114                           doc=
"Secondary band name for extrapolation")
 
  115     tertiaryBand = Field(dtype=str, default=
None, optional=
True,
 
  116                          doc=
"Tertiary band name for extrapolation")
 
  119         Config.validate(self)
 
  124                 raise RuntimeError(
"extrapolated requires primaryBand, secondaryBand, and " 
  125                                    "tertiaryBand are provided.")
 
  129     """A mapping of bands to Sedterms. 
  131     To construct a SedtermDict use keyword arguments: 
  132     SedtermDict(data=dataDict) 
  133     where dataDict is a Python dict of band to Sedterm 
  137         'g': Sedterm(primaryTerm='gr', secondaryTerm='ri', extrapolated=True, constant=0.25, 
  138                      primaryBand='g', secondaryBand='r', tertiaryBand='i'), 
  139         'r': Sedterm(primaryTerm='gr', secondaryTerm='ri', extrapolated=False) 
  142     This is a subclass of Config.  This follows the form of 
  143     `lsst.pipe.tasks.ColortermDict`. 
  145     data = ConfigDictField(
 
  146         doc=
"Mapping of band name to Sedterm",