71 addIsVariable=False, fullPositionInformation=False):
72 """Make a standard schema for reference object catalogs.
73
74 Parameters
75 ----------
76 filterNameList : `list` of `str`
77 List of filter names. Used to create <filterName>_flux fields.
78 addCentroid : `bool`
79 If True then add fields "centroid" and "hasCentroid".
80 addIsPhotometric : `bool`
81 If True then add field "photometric".
82 addIsResolved : `bool`
83 If True then add field "resolved".
84 addIsVariable : `bool`
85 If True then add field "variable".
86 fullPositionInformation : `bool`
87 If True then add epoch, proper motion, and parallax, along with the
88 full five-dimensional covariance between ra and dec coordinates,
89 proper motion in ra and dec, and parallax.
90
91 Returns
92 -------
93 schema : `lsst.afw.table.Schema`
94 Schema for reference catalog, an
95 `lsst.afw.table.SimpleCatalog`.
96 """
98 if addCentroid:
99 lsst.afw.table.Point2DKey.addFields(
100 schema,
101 "centroid",
102 "centroid on an exposure, if relevant",
103 "pixel",
104 )
105 schema.addField(
106 field="hasCentroid",
107 type="Flag",
108 doc="is position known?",
109 )
110 for filterName in filterNameList:
111 schema.addField(
112 field="%s_flux" % (filterName,),
113 type=numpy.float64,
114 doc="flux in filter %s" % (filterName,),
115 units="nJy",
116 )
117 for filterName in filterNameList:
118 schema.addField(
119 field="%s_fluxErr" % (filterName,),
120 type=numpy.float64,
121 doc="flux uncertainty in filter %s" % (filterName,),
122 units="nJy",
123 )
124 if addIsPhotometric:
125 schema.addField(
126 field="photometric",
127 type="Flag",
128 doc="set if the object can be used for photometric calibration",
129 )
130 if addIsResolved:
131 schema.addField(
132 field="resolved",
133 type="Flag",
134 doc="set if the object is spatially resolved",
135 )
136 if addIsVariable:
137 schema.addField(
138 field="variable",
139 type="Flag",
140 doc="set if the object has variable brightness",
141 )
142 lsst.afw.table.CovarianceMatrix2fKey.addFields(
143 schema=schema,
144 prefix="coord",
145 names=["ra", "dec"],
146 units=["rad", "rad"],
147 diagonalOnly=True,
148 )
149
150 if fullPositionInformation:
151 schema.addField(
152 field="epoch",
153 type=numpy.float64,
154 doc="date of observation (TAI, MJD)",
155 units="day",
156 )
157 schema.addField(
158 field="pm_ra",
159 type="Angle",
160 doc="proper motion in the right ascension direction = dra/dt * cos(dec)",
161 units="rad/year",
162 )
163 schema.addField(
164 field="pm_dec",
165 type="Angle",
166 doc="proper motion in the declination direction",
167 units="rad/year",
168 )
169 lsst.afw.table.CovarianceMatrix2fKey.addFields(
170 schema=schema,
171 prefix="pm",
172 names=["ra", "dec"],
173 units=["rad/year", "rad/year"],
174 diagonalOnly=True,
175 )
176 schema.addField(
177 field="pm_flag",
178 type="Flag",
179 doc="Set if proper motion or proper motion error is bad",
180 )
181 schema.addField(
182 field="parallax",
183 type="Angle",
184 doc="parallax",
185 units="rad",
186 )
187 schema.addField(
188 field="parallaxErr",
189 type="Angle",
190 doc="uncertainty in parallax",
191 units="rad",
192 )
193 schema.addField(
194 field="parallax_flag",
195 type="Flag",
196 doc="Set if parallax or parallax error is bad",
197 )
198
199 fields = ["coord_ra", "coord_dec", "pm_ra", "pm_dec", "parallax"]
200 units = ["rad", "rad", "rad/year", "rad/year", "rad"]
201 for field, unit in zip(itertools.combinations(fields, r=2), itertools.combinations(units, r=2)):
202 i_field = field[0]
203 i_unit = unit[0]
204 j_field = field[1]
205 j_unit = unit[1]
206 formatted_unit = "rad^2"
207 if ("year" in i_unit) and ("year" in j_unit):
208 formatted_unit += "/year^2"
209 elif ("year" in i_unit) or ("year" in j_unit):
210 formatted_unit += "/year"
211 schema.addField(
212 field=f"{i_field}_{j_field}_Cov",
213 type="F",
214 doc=f"Covariance between {i_field} and {j_field}",
215 units=formatted_unit
216 )
217 return schema
218
219
static Schema makeMinimalSchema()
Return a minimal schema for Simple tables and records.