LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
sedterms.py
Go to the documentation of this file.
1 # This file is part of fgcmcal.
2 #
3 # Developed for the LSST Data Management System.
4 # This product includes software developed by the LSST Project
5 # (https://www.lsst.org).
6 # See the COPYRIGHT file at the top-level directory of this distribution
7 # for details of code ownership.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <https://www.gnu.org/licenses/>.
21 """Configuration for SED terms in fgcmcal.
22 Analogous to colorterms.
23 """
24 
25 from lsst.pex.config import Config, Field, ConfigDictField
26 
27 __all__ = ["Sedterm", "SedtermDict", "Sedboundaryterm", "SedboundarytermDict"]
28 
29 
31  """SED boundary term for a pair of bands.
32 
33  The SED slope (in flux units) at the boundary between two bands is given by:
34 
35  S = -0.921 * (primary - secondary) / (lambda_primary - lambda_secondary)
36 
37  To construct a Sedboundaryterm, use keyword arguments:
38  Sedboundaryterm(primary=primaryBandName, secondary=secondaryBandName)
39 
40  This is a subclass of Config. This follows the form of
41  `lsst.pipe.tasks.Colorterm`.
42  """
43  primary = Field(dtype=str, doc="name of primary band")
44  secondary = Field(dtype=str, doc="name of secondary band")
45 
46 
48  """A mapping of Sedboundaryterm name to Sedterm.
49 
50  To construct a SedboundarytermDict use keyword arguments:
51  SedboundarytermDict(data=dataDict)
52  where dataDict is a Python dict of name: Sedterm
53  For example::
54 
55  SedboundarytermDict(data={
56  'gr': Sedboundaryterm(primary="g", secondary="r"),
57  'ri': Sedboundaryterm(primary="r", secondary="i"),
58  })
59 
60  This is a subclass of Config. This follows the form of
61  `lsst.pipe.tasks.ColortermDict`.
62  """
64  doc="Mapping of Sedboundary term name to Sedboundaryterm",
65  keytype=str,
66  itemtype=Sedboundaryterm,
67  default={},
68  )
69 
70 
71 class Sedterm(Config):
72  """SED term for a single band.
73 
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).
77 
78  For interpolation, with a secondary term::
79 
80  F'_nu ~ constant * (primaryTerm + secondaryTerm) / 2.0
81 
82  For interpolation, without a secondary term::
83 
84  F'_nu ~ constant * primaryTerm
85 
86  For extrapolation::
87 
88  F'_nu ~ primaryTerm + constant * (((lambda_primaryBand - lambda_secondaryBand) /
89  (lambda_primaryBand - lambda_tertiaryBand)) *
90  (primaryTerm - secondaryTerm))
91 
92  where primaryTerm and secondaryTerm are names from a `SedboundarytermDict`, and
93  primaryBand, secondaryBand, and tertiaryBand are band names.
94 
95  To construct a Sedterm, use keyword arguments::
96 
97  Sedterm(primaryTerm=primaryTermName, secondaryTerm=secondaryTermName,
98  extrapolated=False, constant=1.0)
99 
100  or::
101 
102  Sedterm(primaryTerm=primaryTermName, secondaryTerm=secondaryTermName,
103  extrapolated=True, constant=1.0, primaryBand=primaryBandName,
104  secondaryBand=secondaryBandName, tertiaryBand=tertiaryBandName)
105 
106  This is a subclass of Config. This follows the form of
107  `lsst.pipe.tasks.Colorterm`.
108  """
109  primaryTerm = Field(dtype=str, doc="Name of primary Sedboundaryterm")
110  secondaryTerm = Field(dtype=str, default=None, optional=True,
111  doc="Name of secondary Sedboundaryterm")
112  extrapolated = Field(dtype=bool, default=False, doc="Extrapolate to compute SED slope")
113  constant = Field(dtype=float, default=1.0, doc="Adjustment constant for SED slope")
114  primaryBand = Field(dtype=str, default=None, optional=True,
115  doc="Primary band name for extrapolation")
116  secondaryBand = Field(dtype=str, default=None, optional=True,
117  doc="Secondary band name for extrapolation")
118  tertiaryBand = Field(dtype=str, default=None, optional=True,
119  doc="Tertiary band name for extrapolation")
120 
121  def validate(self):
122  Config.validate(self)
123  if self.extrapolated:
124  if self.primaryBand is None or \
125  self.secondaryBand is None or \
126  self.tertiaryBand is None:
127  raise RuntimeError("extrapolated requires primaryBand, secondaryBand, and "
128  "tertiaryBand are provided.")
129 
130 
132  """A mapping of bands to Sedterms.
133 
134  To construct a SedtermDict use keyword arguments::
135 
136  SedtermDict(data=dataDict)
137 
138  where dataDict is a Python dict of band to Sedterm
139  For example::
140 
141  SedtermDict(data={
142  'g': Sedterm(primaryTerm='gr', secondaryTerm='ri', extrapolated=True, constant=0.25,
143  primaryBand='g', secondaryBand='r', tertiaryBand='i'),
144  'r': Sedterm(primaryTerm='gr', secondaryTerm='ri', extrapolated=False)
145  })
146 
147  This is a subclass of Config. This follows the form of
148  `lsst.pipe.tasks.ColortermDict`.
149  """
151  doc="Mapping of band name to Sedterm",
152  keytype=str,
153  itemtype=Sedterm,
154  default={},
155  )
lsst.fgcmcal.sedterms.Sedterm.extrapolated
extrapolated
Definition: sedterms.py:112
lsst.fgcmcal.sedterms.Sedboundaryterm
Definition: sedterms.py:30
lsst.fgcmcal.sedterms.Sedterm.secondaryBand
secondaryBand
Definition: sedterms.py:116
lsst.pex.config
Definition: __init__.py:1
lsst.pex.config.configDictField.ConfigDictField
Definition: configDictField.py:92
lsst.fgcmcal.sedterms.SedboundarytermDict
Definition: sedterms.py:47
lsst.fgcmcal.sedterms.Sedterm.validate
def validate(self)
Definition: sedterms.py:121
lsst.fgcmcal.sedterms.Sedterm.tertiaryBand
tertiaryBand
Definition: sedterms.py:118
lsst.fgcmcal.sedterms.SedtermDict
Definition: sedterms.py:131
lsst.fgcmcal.sedterms.Sedterm.primaryBand
primaryBand
Definition: sedterms.py:114
lsst.pex.config.config.Config
Definition: config.py:736
lsst.fgcmcal.sedterms.Sedterm
Definition: sedterms.py:71
lsst.pex.config.config.Field
Definition: config.py:247