Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# This file is part of ap_association. 

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 

22"""Defines afw schemas and conversions for use in ap_association tasks. 

23 

24Until a more finalized interface between the alert production database (APDB) can 

25be established, we put many utility functions for converting `lsst.afw.table` and 

26`lsst.afw.image` objects to a PPD. This includes both mapping schemas between 

27different catalogs and the DB. 

28""" 

29 

30__all__ = ["make_dia_object_schema", 

31 "make_dia_source_schema", 

32 "make_dia_forced_source_schema", 

33 "getCcdVisitSchemaSql"] 

34 

35from collections import OrderedDict as oDict 

36 

37import lsst.afw.table as afwTable 

38 

39 

40def make_dia_object_schema(filter_names=None): 

41 """Define and create the minimal schema required for a DIAObject. 

42 

43 Parameters 

44 ---------- 

45 filter_names : `list` of `str` 

46 Names of the filters expect and compute means for. 

47 

48 Returns 

49 ------- 

50 schema : `lsst.afw.table.Schema` 

51 Minimal schema for DIAObjects. 

52 """ 

53 schema = afwTable.SourceTable.makeMinimalSchema() 

54 # For the MVP/S we currently only care about the position though 

55 # in the future we will add summary computations for fluxes etc. 

56 # as well as their errors. 

57 

58 # TODO: In the future we would like to store a covariance of the coordinate. 

59 # This functionality is not defined currently in the stack, so we will hold 

60 # off until it is implemented. This is to be addressed in DM-7101. 

61 

62 # Generated automatically from apdb-schema.yaml in dax_apdb/data. 

63 schema.addField('validityStart', type='L', 

64 doc='Time when validity of this diaObject starts.') 

65 schema.addField('validityEnd', type='L', 

66 doc='Time when validity of this diaObject ends.') 

67 schema.addField('raErr', type='Angle', 

68 doc='Uncertainty of ra.') 

69 schema.addField('declErr', type='Angle', 

70 doc='Uncertainty of decl.') 

71 schema.addField('ra_decl_Cov', type='F', 

72 doc='Covariance between ra and decl.') 

73 schema.addField('radecTai', type='D', 

74 doc='Time at which the object was at a position ra/decl.') 

75 schema.addField('pmRa', type='F', 

76 doc='Proper motion (ra).') 

77 schema.addField('pmRaErr', type='F', 

78 doc='Uncertainty of pmRa.') 

79 schema.addField('pmDecl', type='F', 

80 doc='Proper motion (decl).') 

81 schema.addField('pmDeclErr', type='F', 

82 doc='Uncertainty of pmDecl.') 

83 schema.addField('parallax', type='F', 

84 doc='Parallax.') 

85 schema.addField('parallaxErr', type='F', 

86 doc='Uncertainty of parallax.') 

87 schema.addField('pmRa_pmDecl_Cov', type='F', 

88 doc='Covariance of pmRa and pmDecl.') 

89 schema.addField('pmRa_parallax_Cov', type='F', 

90 doc='Covariance of pmRa and parallax.') 

91 schema.addField('pmDecl_parallax_Cov', type='F', 

92 doc='Covariance of pmDecl and parallax.') 

93 schema.addField('pmParallaxLnL', type='F', 

94 doc='Natural log of the likelihood of the linear proper motion parallax fit.') 

95 schema.addField('pmParallaxChi2', type='F', 

96 doc='Chi^2 static of the model fit.') 

97 schema.addField('pmParallaxNdata', type='I', 

98 doc='The number of data points used to fit the model.') 

99 schema.addField('uPSFluxMean', type='F', 

100 doc='Weighted mean point-source model magnitude for u filter.') 

101 schema.addField('uPSFluxMeanErr', type='F', 

102 doc='Standard error of uPSFluxMean.') 

103 schema.addField('uPSFluxSigma', type='F', 

104 doc='Standard deviation of the distribution of uPSFlux.') 

105 schema.addField('uPSFluxChi2', type='F', 

106 doc='Chi^2 statistic for the scatter of uPSFlux around uPSFluxMean.') 

107 schema.addField('uPSFluxNdata', type='I', 

108 doc='The number of data points used to compute uPSFluxChi2.') 

109 schema.addField('uFPFluxMean', type='F', 

110 doc='Weighted mean forced photometry flux for u filter.') 

111 schema.addField('uFPFluxMeanErr', type='F', 

112 doc='Standard error of uFPFluxMean.') 

113 schema.addField('uFPFluxSigma', type='F', 

114 doc='Standard deviation of the distribution of uFPFlux.') 

115 schema.addField('gPSFluxMean', type='F', 

116 doc='Weighted mean point-source model magnitude for g filter.') 

117 schema.addField('gPSFluxMeanErr', type='F', 

118 doc='Standard error of gPSFluxMean.') 

119 schema.addField('gPSFluxSigma', type='F', 

120 doc='Standard deviation of the distribution of gPSFlux.') 

121 schema.addField('gPSFluxChi2', type='F', 

122 doc='Chi^2 statistic for the scatter of gPSFlux around gPSFluxMean.') 

123 schema.addField('gPSFluxNdata', type='I', 

124 doc='The number of data points used to compute gPSFluxChi2.') 

125 schema.addField('gFPFluxMean', type='F', 

126 doc='Weighted mean forced photometry flux for g filter.') 

127 schema.addField('gFPFluxMeanErr', type='F', 

128 doc='Standard error of gFPFluxMean.') 

129 schema.addField('gFPFluxSigma', type='F', 

130 doc='Standard deviation of the distribution of gFPFlux.') 

131 schema.addField('rPSFluxMean', type='F', 

132 doc='Weighted mean point-source model magnitude for r filter.') 

133 schema.addField('rPSFluxMeanErr', type='F', 

134 doc='Standard error of rPSFluxMean.') 

135 schema.addField('rPSFluxSigma', type='F', 

136 doc='Standard deviation of the distribution of rPSFlux.') 

137 schema.addField('rPSFluxChi2', type='F', 

138 doc='Chi^2 statistic for the scatter of rPSFlux around rPSFluxMean.') 

139 schema.addField('rPSFluxNdata', type='I', 

140 doc='The number of data points used to compute rPSFluxChi2.') 

141 schema.addField('rFPFluxMean', type='F', 

142 doc='Weighted mean forced photometry flux for r filter.') 

143 schema.addField('rFPFluxMeanErr', type='F', 

144 doc='Standard error of rFPFluxMean.') 

145 schema.addField('rFPFluxSigma', type='F', 

146 doc='Standard deviation of the distribution of rFPFlux.') 

147 schema.addField('iPSFluxMean', type='F', 

148 doc='Weighted mean point-source model magnitude for i filter.') 

149 schema.addField('iPSFluxMeanErr', type='F', 

150 doc='Standard error of iPSFluxMean.') 

151 schema.addField('iPSFluxSigma', type='F', 

152 doc='Standard deviation of the distribution of iPSFlux.') 

153 schema.addField('iPSFluxChi2', type='F', 

154 doc='Chi^2 statistic for the scatter of iPSFlux around iPSFluxMean.') 

155 schema.addField('iPSFluxNdata', type='I', 

156 doc='The number of data points used to compute iPSFluxChi2.') 

157 schema.addField('iFPFluxMean', type='F', 

158 doc='Weighted mean forced photometry flux for i filter.') 

159 schema.addField('iFPFluxMeanErr', type='F', 

160 doc='Standard error of iFPFluxMean.') 

161 schema.addField('iFPFluxSigma', type='F', 

162 doc='Standard deviation of the distribution of iFPFlux.') 

163 schema.addField('zPSFluxMean', type='F', 

164 doc='Weighted mean point-source model magnitude for z filter.') 

165 schema.addField('zPSFluxMeanErr', type='F', 

166 doc='Standard error of zPSFluxMean.') 

167 schema.addField('zPSFluxSigma', type='F', 

168 doc='Standard deviation of the distribution of zPSFlux.') 

169 schema.addField('zPSFluxChi2', type='F', 

170 doc='Chi^2 statistic for the scatter of zPSFlux around zPSFluxMean.') 

171 schema.addField('zPSFluxNdata', type='I', 

172 doc='The number of data points used to compute zPSFluxChi2.') 

173 schema.addField('zFPFluxMean', type='F', 

174 doc='Weighted mean forced photometry flux for z filter.') 

175 schema.addField('zFPFluxMeanErr', type='F', 

176 doc='Standard error of zFPFluxMean.') 

177 schema.addField('zFPFluxSigma', type='F', 

178 doc='Standard deviation of the distribution of zFPFlux.') 

179 schema.addField('yPSFluxMean', type='F', 

180 doc='Weighted mean point-source model magnitude for y filter.') 

181 schema.addField('yPSFluxMeanErr', type='F', 

182 doc='Standard error of yPSFluxMean.') 

183 schema.addField('yPSFluxSigma', type='F', 

184 doc='Standard deviation of the distribution of yPSFlux.') 

185 schema.addField('yPSFluxChi2', type='F', 

186 doc='Chi^2 statistic for the scatter of yPSFlux around yPSFluxMean.') 

187 schema.addField('yPSFluxNdata', type='I', 

188 doc='The number of data points used to compute yPSFluxChi2.') 

189 schema.addField('yFPFluxMean', type='F', 

190 doc='Weighted mean forced photometry flux for y filter.') 

191 schema.addField('yFPFluxMeanErr', type='F', 

192 doc='Standard error of yFPFluxMean.') 

193 schema.addField('yFPFluxSigma', type='F', 

194 doc='Standard deviation of the distribution of yFPFlux.') 

195 # Mapping of arrays and BLOBs is not currently supported by the APDB so we 

196 # these columns out. 

197 # schema.addField('uLcPeriodic', type='ArrayF', 

198 # doc='Periodic features extracted from light-curves using generalized Lomb-Scargle ' 

199 # 'periodogram for u filter. [32 FLOAT].') 

200 # schema.addField('gLcPeriodic', type='ArrayF', 

201 # doc='Periodic features extracted from light-curves using generalized Lomb-Scargle ' 

202 # 'periodogram for g filter. [32 FLOAT].') 

203 # schema.addField('rLcPeriodic', type='ArrayF', 

204 # doc='Periodic features extracted from light-curves using generalized Lomb-Scargle ' 

205 # 'periodogram for r filter. [32 FLOAT].') 

206 # schema.addField('iLcPeriodic', type='ArrayF', 

207 # doc='Periodic features extracted from light-curves using generalized Lomb-Scargle ' 

208 # 'periodogram for i filter. [32 FLOAT].') 

209 # schema.addField('zLcPeriodic', type='ArrayF', 

210 # doc='Periodic features extracted from light-curves using generalized Lomb-Scargle ' 

211 # 'periodogram for z filter. [32 FLOAT].') 

212 # schema.addField('yLcPeriodic', type='ArrayF', 

213 # doc='Periodic features extracted from light-curves using generalized Lomb-Scargle ' 

214 # 'periodogram for y filter. [32 FLOAT].') 

215 # schema.addField('uLcNonPeriodic', type='ArrayF', 

216 # doc='Non-periodic features extracted from light-curves using generalized Lomb-Scargle ' 

217 # 'periodogram for u filter. [20 FLOAT].') 

218 # schema.addField('gLcNonPeriodic', type='ArrayF', 

219 # doc='Non-periodic features extracted from light-curves using generalized Lomb-Scargle ' 

220 # 'periodogram for g filter. [20 FLOAT].') 

221 # schema.addField('rLcNonPeriodic', type='ArrayF', 

222 # doc='Non-periodic features extracted from light-curves using generalized Lomb-Scargle ' 

223 # 'periodogram for r filter. [20 FLOAT].') 

224 # schema.addField('iLcNonPeriodic', type='ArrayF', 

225 # doc='Non-periodic features extracted from light-curves using generalized Lomb-Scargle ' 

226 # 'periodogram for i filter. [20 FLOAT].') 

227 # schema.addField('zLcNonPeriodic', type='ArrayF', 

228 # doc='Non-periodic features extracted from light-curves using generalized Lomb-Scargle ' 

229 # 'periodogram for z filter. [20 FLOAT].') 

230 # schema.addField('yLcNonPeriodic', type='ArrayF', 

231 # doc='Non-periodic features extracted from light-curves using generalized Lomb-Scargle ' 

232 # 'periodogram for y filter. [20 FLOAT].') 

233 schema.addField('nearbyObj1', type='L', 

234 doc='Id of the closest nearby object.') 

235 schema.addField('nearbyObj1Dist', type='F', 

236 doc='Distance to nearbyObj1.') 

237 schema.addField('nearbyObj1LnP', type='F', 

238 doc='Natural log of the probability that the observed diaObject is the same as the ' 

239 'nearbyObj1.') 

240 schema.addField('nearbyObj2', type='L', 

241 doc='Id of the second-closest nearby object.') 

242 schema.addField('nearbyObj2Dist', type='F', 

243 doc='Distance to nearbyObj2.') 

244 schema.addField('nearbyObj2LnP', type='F', 

245 doc='Natural log of the probability that the observed diaObject is the same as the ' 

246 'nearbyObj2.') 

247 schema.addField('nearbyObj3', type='L', 

248 doc='Id of the third-closest nearby object.') 

249 schema.addField('nearbyObj3Dist', type='F', 

250 doc='Distance to nearbyObj3.') 

251 schema.addField('nearbyObj3LnP', type='F', 

252 doc='Natural log of the probability that the observed diaObject is the same as the ' 

253 'nearbyObj3.') 

254 schema.addField('flags', type='L', 

255 doc='Flags, bitwise OR tbd.') 

256 schema.addField('pixelId', type='L', 

257 doc='HTM index.') 

258 schema.addField('lastNonForcedSource', type='L', 

259 doc='Last time when non-forced DIASource was seen for this object') 

260 schema.addField('nDiaSources', type='I', 

261 doc='Total number of DiaSources associated with this DiaObject.') 

262 schema.addField('uTOTFluxMean', type='F', 

263 doc='Weighted mean forced photometry flux for u filter.') 

264 schema.addField('uTOTFluxMeanErr', type='F', 

265 doc='Standard error of uTOTFluxMean.') 

266 schema.addField('uTOTFluxSigma', type='F', 

267 doc='Standard deviation of the distribution of uTOTFlux.') 

268 schema.addField('gTOTFluxMean', type='F', 

269 doc='Weighted mean forced photometry flux for g filter.') 

270 schema.addField('gTOTFluxMeanErr', type='F', 

271 doc='Standard error of uTOTFluxMean.') 

272 schema.addField('gTOTFluxSigma', type='F', 

273 doc='Standard deviation of the distribution of gTOTFlux.') 

274 schema.addField('rTOTFluxMean', type='F', 

275 doc='Weighted mean forced photometry flux for r filter.') 

276 schema.addField('rTOTFluxMeanErr', type='F', 

277 doc='Standard error of uTOTFluxMean.') 

278 schema.addField('rTOTFluxSigma', type='F', 

279 doc='Standard deviation of the distribution of rTOTFlux.') 

280 schema.addField('iTOTFluxMean', type='F', 

281 doc='Weighted mean forced photometry flux for i filter.') 

282 schema.addField('iTOTFluxMeanErr', type='F', 

283 doc='Standard error of uTOTFluxMean.') 

284 schema.addField('iTOTFluxSigma', type='F', 

285 doc='Standard deviation of the distribution of iTOTFlux.') 

286 schema.addField('zTOTFluxMean', type='F', 

287 doc='Weighted mean forced photometry flux for z filter.') 

288 schema.addField('zTOTFluxMeanErr', type='F', 

289 doc='Standard error of uTOTFluxMean.') 

290 schema.addField('zTOTFluxSigma', type='F', 

291 doc='Standard deviation of the distribution of zTOTFlux.') 

292 schema.addField('yTOTFluxMean', type='F', 

293 doc='Weighted mean forced photometry flux for y filter.') 

294 schema.addField('yTOTFluxMeanErr', type='F', 

295 doc='Standard error of uTOTFluxMean.') 

296 schema.addField('yTOTFluxSigma', type='F', 

297 doc='Standard deviation of the distribution of yTOTFlux.') 

298 schema.addField('uPSFluxMAD', type='F', 

299 doc='Median absolute deviation u band fluxes.') 

300 schema.addField('uPSFluxSkew', type='F', 

301 doc='Skewness of the u band fluxes.') 

302 schema.addField('uPSFluxPercentile05', type='F', 

303 doc='Value at the 5% percentile of the u band fluxes.') 

304 schema.addField('uPSFluxPercentile25', type='F', 

305 doc='Value at the 25% percentile of the u band fluxes.') 

306 schema.addField('uPSFluxPercentile50', type='F', 

307 doc='Value at the 50% percentile of the u band fluxes.') 

308 schema.addField('uPSFluxPercentile75', type='F', 

309 doc='Value at the 75% percentile of the u band fluxes.') 

310 schema.addField('uPSFluxPercentile95', type='F', 

311 doc='Value at the 95% percentile of the u band fluxes.') 

312 schema.addField('uPSFluxMin', type='F', 

313 doc='Minimum observed u band fluxes.') 

314 schema.addField('uPSFluxMax', type='F', 

315 doc='Maximum observed u band fluxes.') 

316 schema.addField('uPSFluxStetsonJ', type='F', 

317 doc='StetsonJ statistic for the u band fluxes.') 

318 schema.addField('uPSFluxLinearSlope', type='F', 

319 doc='Linear best fit slope of the u band fluxes.') 

320 schema.addField('uPSFluxLinearIntercept', type='F', 

321 doc='Linear best fit Intercept of the u band fluxes.') 

322 schema.addField('uPSFluxMaxSlope', type='F', 

323 doc='Maximum slope between u band flux observations max(delta_flux/delta_time)') 

324 schema.addField('uPSFluxErrMean', type='F', 

325 doc='Mean of the u band flux errors.') 

326 schema.addField('gPSFluxMAD', type='F', 

327 doc='Median absolute deviation g band fluxes.') 

328 schema.addField('gPSFluxSkew', type='F', 

329 doc='Skewness of the g band fluxes.') 

330 schema.addField('gPSFluxPercentile05', type='F', 

331 doc='Value at the 5% percentile of the g band fluxes.') 

332 schema.addField('gPSFluxPercentile25', type='F', 

333 doc='Value at the 25% percentile of the g band fluxes.') 

334 schema.addField('gPSFluxPercentile50', type='F', 

335 doc='Value at the 50% percentile of the g band fluxes.') 

336 schema.addField('gPSFluxPercentile75', type='F', 

337 doc='Value at the 75% percentile of the g band fluxes.') 

338 schema.addField('gPSFluxPercentile95', type='F', 

339 doc='Value at the 95% percentile of the g band fluxes.') 

340 schema.addField('gPSFluxMin', type='F', 

341 doc='Minimum observed g band fluxes.') 

342 schema.addField('gPSFluxMax', type='F', 

343 doc='Maximum observed g band fluxes.') 

344 schema.addField('gPSFluxStetsonJ', type='F', 

345 doc='StetsonJ statistic for the g band fluxes.') 

346 schema.addField('gPSFluxLinearSlope', type='F', 

347 doc='Linear best fit slope of the g band fluxes.') 

348 schema.addField('gPSFluxLinearIntercept', type='F', 

349 doc='Linear best fit Intercept of the g band fluxes.') 

350 schema.addField('gPSFluxMaxSlope', type='F', 

351 doc='Maximum slope between g band flux observations max(delta_flux/delta_time)') 

352 schema.addField('gPSFluxErrMean', type='F', 

353 doc='Mean of the g band flux errors.') 

354 schema.addField('rPSFluxMAD', type='F', 

355 doc='Median absolute deviation r band fluxes.') 

356 schema.addField('rPSFluxSkew', type='F', 

357 doc='Skewness of the r band fluxes.') 

358 schema.addField('rPSFluxPercentile05', type='F', 

359 doc='Value at the 5% percentile of the r band fluxes.') 

360 schema.addField('rPSFluxPercentile25', type='F', 

361 doc='Value at the 25% percentile of the r band fluxes.') 

362 schema.addField('rPSFluxPercentile50', type='F', 

363 doc='Value at the 50% percentile of the r band fluxes.') 

364 schema.addField('rPSFluxPercentile75', type='F', 

365 doc='Value at the 75% percentile of the r band fluxes.') 

366 schema.addField('rPSFluxPercentile95', type='F', 

367 doc='Value at the 95% percentile of the r band fluxes.') 

368 schema.addField('rPSFluxMin', type='F', 

369 doc='Minimum observed r band fluxes.') 

370 schema.addField('rPSFluxMax', type='F', 

371 doc='Maximum observed r band fluxes.') 

372 schema.addField('rPSFluxStetsonJ', type='F', 

373 doc='StetsonJ statistic for the r band fluxes.') 

374 schema.addField('rPSFluxLinearSlope', type='F', 

375 doc='Linear best fit slope of the r band fluxes.') 

376 schema.addField('rPSFluxLinearIntercept', type='F', 

377 doc='Linear best fit Intercept of the r band fluxes.') 

378 schema.addField('rPSFluxMaxSlope', type='F', 

379 doc='Maximum slope between r band flux observations max(delta_flux/delta_time)') 

380 schema.addField('rPSFluxErrMean', type='F', 

381 doc='Mean of the r band flux errors.') 

382 schema.addField('iPSFluxMAD', type='F', 

383 doc='Median absolute deviation i band fluxes.') 

384 schema.addField('iPSFluxSkew', type='F', 

385 doc='Skewness of the i band fluxes.') 

386 schema.addField('iPSFluxPercentile05', type='F', 

387 doc='Value at the 5% percentile of the i band fluxes.') 

388 schema.addField('iPSFluxPercentile25', type='F', 

389 doc='Value at the 25% percentile of the i band fluxes.') 

390 schema.addField('iPSFluxPercentile50', type='F', 

391 doc='Value at the 50% percentile of the i band fluxes.') 

392 schema.addField('iPSFluxPercentile75', type='F', 

393 doc='Value at the 75% percentile of the i band fluxes.') 

394 schema.addField('iPSFluxPercentile95', type='F', 

395 doc='Value at the 95% percentile of the i band fluxes.') 

396 schema.addField('iPSFluxMin', type='F', 

397 doc='Minimum observed i band fluxes.') 

398 schema.addField('iPSFluxMax', type='F', 

399 doc='Maximum observed i band fluxes.') 

400 schema.addField('iPSFluxStetsonJ', type='F', 

401 doc='StetsonJ statistic for the i band fluxes.') 

402 schema.addField('iPSFluxLinearSlope', type='F', 

403 doc='Linear best fit slope of the i band fluxes.') 

404 schema.addField('iPSFluxLinearIntercept', type='F', 

405 doc='Linear best fit Intercept of the i band fluxes.') 

406 schema.addField('iPSFluxMaxSlope', type='F', 

407 doc='Maximum slope between i band flux observations max(delta_flux/delta_time)') 

408 schema.addField('iPSFluxErrMean', type='F', 

409 doc='Mean of the i band flux errors.') 

410 schema.addField('zPSFluxMAD', type='F', 

411 doc='Median absolute deviation z band fluxes.') 

412 schema.addField('zPSFluxSkew', type='F', 

413 doc='Skewness of the z band fluxes.') 

414 schema.addField('zPSFluxPercentile05', type='F', 

415 doc='Value at the 5% percentile of the z band fluxes.') 

416 schema.addField('zPSFluxPercentile25', type='F', 

417 doc='Value at the 25% percentile of the z band fluxes.') 

418 schema.addField('zPSFluxPercentile50', type='F', 

419 doc='Value at the 50% percentile of the z band fluxes.') 

420 schema.addField('zPSFluxPercentile75', type='F', 

421 doc='Value at the 75% percentile of the z band fluxes.') 

422 schema.addField('zPSFluxPercentile95', type='F', 

423 doc='Value at the 95% percentile of the z band fluxes.') 

424 schema.addField('zPSFluxMin', type='F', 

425 doc='Minimum observed z band fluxes.') 

426 schema.addField('zPSFluxMax', type='F', 

427 doc='Maximum observed z band fluxes.') 

428 schema.addField('zPSFluxStetsonJ', type='F', 

429 doc='StetsonJ statistic for the z band fluxes.') 

430 schema.addField('zPSFluxLinearSlope', type='F', 

431 doc='Linear best fit slope of the z band fluxes.') 

432 schema.addField('zPSFluxLinearIntercept', type='F', 

433 doc='Linear best fit Intercept of the z band fluxes.') 

434 schema.addField('zPSFluxMaxSlope', type='F', 

435 doc='Maximum slope between z band flux observations max(delta_flux/delta_time)') 

436 schema.addField('zPSFluxErrMean', type='F', 

437 doc='Mean of the z band flux errors.') 

438 schema.addField('yPSFluxMAD', type='F', 

439 doc='Median absolute deviation y band fluxes.') 

440 schema.addField('yPSFluxSkew', type='F', 

441 doc='Skewness of the y band fluxes.') 

442 schema.addField('yPSFluxPercentile05', type='F', 

443 doc='Value at the 5% percentile of the y band fluxes.') 

444 schema.addField('yPSFluxPercentile25', type='F', 

445 doc='Value at the 25% percentile of the y band fluxes.') 

446 schema.addField('yPSFluxPercentile50', type='F', 

447 doc='Value at the 50% percentile of the y band fluxes.') 

448 schema.addField('yPSFluxPercentile75', type='F', 

449 doc='Value at the 75% percentile of the y band fluxes.') 

450 schema.addField('yPSFluxPercentile95', type='F', 

451 doc='Value at the 95% percentile of the y band fluxes.') 

452 schema.addField('yPSFluxMin', type='F', 

453 doc='Minimum observed y band fluxes.') 

454 schema.addField('yPSFluxMax', type='F', 

455 doc='Maximum observed y band fluxes.') 

456 schema.addField('yPSFluxStetsonJ', type='F', 

457 doc='StetsonJ statistic for the y band fluxes.') 

458 schema.addField('yPSFluxLinearSlope', type='F', 

459 doc='Linear best fit slope of the y band fluxes.') 

460 schema.addField('yPSFluxLinearIntercept', type='F', 

461 doc='Linear best fit Intercept of the y band fluxes.') 

462 schema.addField('yPSFluxMaxSlope', type='F', 

463 doc='Maximum slope between y band flux observations max(delta_flux/delta_time)') 

464 schema.addField('yPSFluxErrMean', type='F', 

465 doc='Mean of the y band flux errors.') 

466 

467 return schema 

468 

469 

470def make_dia_source_schema(): 

471 """ Define and create the minimal schema required for a DIASource. 

472 

473 Returns 

474 ------- 

475 schema : `lsst.afw.table.Schema` 

476 Minimal schema for DiaSources. 

477 """ 

478 

479 # Generated automatically from apdb-schema.yaml in dax_apdb/data. 

480 schema = afwTable.SourceTable.makeMinimalSchema() 

481 schema.addField('ccdVisitId', type='L', 

482 doc='Id of the ccdVisit where this diaSource was measured. Note that we are allowing a ' 

483 'diaSource to belong to multiple amplifiers, but it may not span multiple ccds.') 

484 schema.addField('diaObjectId', type='L', 

485 doc='Id of the diaObject this source was associated with, if any. If not, it is set to ' 

486 'NULL (each diaSource will be associated with either a diaObject or ssObject).') 

487 schema.addField('ssObjectId', type='L', 

488 doc='Id of the ssObject this source was associated with, if any. If not, it is set to ' 

489 'NULL (each diaSource will be associated with either a diaObject or ssObject).') 

490 schema.addField('prv_procOrder', type='I', 

491 doc='Position of this diaSource in the processing order relative to other diaSources ' 

492 'within a given diaObjectId or ssObjectId.') 

493 schema.addField('ssObjectReassocTime', type='D', 

494 doc='Time when this diaSource was reassociated from diaObject to ssObject (if such ' 

495 'reassociation happens, otherwise NULL).') 

496 schema.addField('midPointTai', type='D', 

497 doc='Effective mid-exposure time for this diaSource.') 

498 schema.addField('raErr', type='D', 

499 doc='Uncertainty of ra.') 

500 schema.addField('declErr', type='D', 

501 doc='Uncertainty of decl.') 

502 schema.addField('ra_decl_Cov', type='D', 

503 doc='Covariance between ra and decl.') 

504 schema.addField('x', type='D', 

505 doc='x position computed by a centroiding algorithm.') 

506 schema.addField('xErr', type='F', 

507 doc='Uncertainty of x.') 

508 schema.addField('y', type='D', 

509 doc='y position computed by a centroiding algorithm.') 

510 schema.addField('yErr', type='F', 

511 doc='Uncertainty of y.') 

512 schema.addField('x_y_Cov', type='D', 

513 doc='Covariance between x and y.') 

514 schema.addField('apFlux', type='D', 

515 doc='Calibrated aperture flux. Note that this actually measures the difference between ' 

516 'the template and the visit image.') 

517 schema.addField('apFluxErr', type='D', 

518 doc='Estimated uncertainty of apFlux.') 

519 schema.addField('snr', type='D', 

520 doc='The signal-to-noise ratio at which this source was detected in the difference ' 

521 'image.') 

522 schema.addField('psFlux', type='D', 

523 doc='Calibrated flux for Point Source model. Note this actually measures the flux ' 

524 'difference between the template and the visit image.') 

525 schema.addField('psFluxErr', type='D', 

526 doc='Uncertainty of psFlux.') 

527 schema.addField('psRa', type='D', 

528 doc=' RA-coordinate of centroid for point source model.') 

529 schema.addField('psRaErr', type='D', 

530 doc='Uncertainty of psRa.') 

531 schema.addField('psDecl', type='D', 

532 doc=' Decl-coordinate of centroid for point source model.') 

533 schema.addField('psDeclErr', type='D', 

534 doc='Uncertainty of psDecl.') 

535 schema.addField('psFlux_psRa_Cov', type='D', 

536 doc='Covariance between psFlux and psRa.') 

537 schema.addField('psFlux_psDecl_Cov', type='D', 

538 doc='Covariance between psFlux and psDecl.') 

539 schema.addField('psRa_psDecl_Cov', type='D', 

540 doc='Covariance between psRa and psDecl.') 

541 schema.addField('psLnL', type='D', 

542 doc='Natural log likelihood of the observed data given the Point Source model.') 

543 schema.addField('psChi2', type='D', 

544 doc='Chi^2 statistic of the model fit.') 

545 schema.addField('psNdata', type='I', 

546 doc='The number of data points (pixels) used to fit the model.') 

547 schema.addField('trailFlux', type='D', 

548 doc='Calibrated flux for a trailed source model. Note this actually measures the flux ' 

549 'difference between the template and the visit image.') 

550 schema.addField('trailFluxErr', type='D', 

551 doc='Uncertainty of trailFlux.') 

552 schema.addField('trailRa', type='D', 

553 doc=' RA-coordinate of centroid for trailed source model.') 

554 schema.addField('trailRaErr', type='D', 

555 doc='Uncertainty of trailRa.') 

556 schema.addField('trailDecl', type='D', 

557 doc=' Decl-coordinate of centroid for trailed source model.') 

558 schema.addField('trailDeclErr', type='D', 

559 doc='Uncertainty of trailDecl.') 

560 schema.addField('trailLength', type='D', 

561 doc='Maximum likelihood fit of trail length.') 

562 schema.addField('trailLengthErr', type='D', 

563 doc='Uncertainty of trailLength.') 

564 schema.addField('trailAngle', type='D', 

565 doc='Maximum likelihood fit of the angle between the meridian through the centroid and ' 

566 'the trail direction (bearing).') 

567 schema.addField('trailAngleErr', type='D', 

568 doc='Uncertainty of trailAngle.') 

569 schema.addField('trailFlux_trailRa_Cov', type='D', 

570 doc='Covariance of trailFlux and trailRa.') 

571 schema.addField('trailFlux_trailDecl_Cov', type='D', 

572 doc='Covariance of trailFlux and trailDecl.') 

573 schema.addField('trailFlux_trailLength_Cov', type='D', 

574 doc='Covariance of trailFlux and trailLength') 

575 schema.addField('trailFlux_trailAngle_Cov', type='D', 

576 doc='Covariance of trailFlux and trailAngle') 

577 schema.addField('trailRa_trailDecl_Cov', type='D', 

578 doc='Covariance of trailRa and trailDecl.') 

579 schema.addField('trailRa_trailLength_Cov', type='D', 

580 doc='Covariance of trailRa and trailLength.') 

581 schema.addField('trailRa_trailAngle_Cov', type='D', 

582 doc='Covariance of trailRa and trailAngle.') 

583 schema.addField('trailDecl_trailLength_Cov', type='D', 

584 doc='Covariance of trailDecl and trailLength.') 

585 schema.addField('trailDecl_trailAngle_Cov', type='D', 

586 doc='Covariance of trailDecl and trailAngle.') 

587 schema.addField('trailLength_trailAngle_Cov', type='D', 

588 doc='Covariance of trailLength and trailAngle') 

589 schema.addField('trailLnL', type='D', 

590 doc='Natural log likelihood of the observed data given the trailed source model.') 

591 schema.addField('trailChi2', type='D', 

592 doc='Chi^2 statistic of the model fit.') 

593 schema.addField('trailNdata', type='I', 

594 doc='The number of data points (pixels) used to fit the model.') 

595 schema.addField('dipMeanFlux', type='D', 

596 doc='Maximum likelihood value for the mean absolute flux of the two lobes for a dipole ' 

597 'model.') 

598 schema.addField('dipMeanFluxErr', type='D', 

599 doc='Uncertainty of dipMeanFlux.') 

600 schema.addField('dipFluxDiff', type='D', 

601 doc='Maximum likelihood value for the difference of absolute fluxes of the two lobes for ' 

602 'a dipole model.') 

603 schema.addField('dipFluxDiffErr', type='D', 

604 doc='Uncertainty of dipFluxDiff.') 

605 schema.addField('dipRa', type='D', 

606 doc=' RA-coordinate of centroid for dipole model.') 

607 schema.addField('dipRaErr', type='D', 

608 doc='Uncertainty of trailRa.') 

609 schema.addField('dipDecl', type='D', 

610 doc=' Decl-coordinate of centroid for dipole model.') 

611 schema.addField('dipDeclErr', type='D', 

612 doc='Uncertainty of dipDecl.') 

613 schema.addField('dipLength', type='D', 

614 doc='Maximum likelihood value for the lobe separation in dipole model.') 

615 schema.addField('dipLengthErr', type='D', 

616 doc='Uncertainty of dipLength.') 

617 schema.addField('dipAngle', type='D', 

618 doc='Maximum likelihood fit of the angle between the meridian through the centroid and ' 

619 'the dipole direction (bearing, from negative to positive lobe).') 

620 schema.addField('dipAngleErr', type='D', 

621 doc='Uncertainty of dipAngle.') 

622 schema.addField('dipMeanFlux_dipFluxDiff_Cov', type='D', 

623 doc='Covariance of dipMeanFlux and dipFluxDiff.') 

624 schema.addField('dipMeanFlux_dipRa_Cov', type='D', 

625 doc='Covariance of dipMeanFlux and dipRa.') 

626 schema.addField('dipMeanFlux_dipDecl_Cov', type='D', 

627 doc='Covariance of dipMeanFlux and dipDecl.') 

628 schema.addField('dipMeanFlux_dipLength_Cov', type='D', 

629 doc='Covariance of dipMeanFlux and dipLength.') 

630 schema.addField('dipMeanFlux_dipAngle_Cov', type='D', 

631 doc='Covariance of dipMeanFlux and dipAngle.') 

632 schema.addField('dipFluxDiff_dipRa_Cov', type='D', 

633 doc='Covariance of dipFluxDiff and dipRa.') 

634 schema.addField('dipFluxDiff_dipDecl_Cov', type='D', 

635 doc='Covariance of dipFluxDiff and dipDecl.') 

636 schema.addField('dipFluxDiff_dipLength_Cov', type='D', 

637 doc='Covariance of dipFluxDiff and dipLength.') 

638 schema.addField('dipFluxDiff_dipAngle_Cov', type='D', 

639 doc='Covariance of dipFluxDiff and dipAngle.') 

640 schema.addField('dipRa_dipDecl_Cov', type='D', 

641 doc='Covariance of dipRa and dipDecl.') 

642 schema.addField('dipRa_dipLength_Cov', type='D', 

643 doc='Covariance of dipRa and dipLength.') 

644 schema.addField('dipRa_dipAngle_Cov', type='D', 

645 doc='Covariance of dipRa and dipAngle.') 

646 schema.addField('dipDecl_dipLength_Cov', type='D', 

647 doc='Covariance of dipDecl and dipLength.') 

648 schema.addField('dipDecl_dipAngle_Cov', type='D', 

649 doc='Covariance of dipDecl and dipAngle.') 

650 schema.addField('dipLength_dipAngle_Cov', type='D', 

651 doc='Covariance of dipLength and dipAngle.') 

652 schema.addField('dipLnL', type='D', 

653 doc='Natural log likelihood of the observed data given the dipole source model.') 

654 schema.addField('dipChi2', type='D', 

655 doc='Chi^2 statistic of the model fit.') 

656 schema.addField('dipNdata', type='I', 

657 doc='The number of data points (pixels) used to fit the model.') 

658 schema.addField('totFlux', type='D', 

659 doc='Calibrated flux for Point Source model measured on the visit image centered at the ' 

660 'centroid measured on the difference image (forced photometry flux).') 

661 schema.addField('totFluxErr', type='D', 

662 doc='Estimated uncertainty of totFlux.') 

663 schema.addField('diffFlux', type='D', 

664 doc='Calibrated flux for Point Source model centered on radec but measured on the ' 

665 'difference of snaps comprising this visit.') 

666 schema.addField('diffFluxErr', type='D', 

667 doc='Estimated uncertainty of diffFlux.') 

668 schema.addField('fpBkgd', type='D', 

669 doc='Estimated sky background at the position (centroid) of the object.') 

670 schema.addField('fpBkgdErr', type='D', 

671 doc='Estimated uncertainty of fpBkgd.') 

672 schema.addField('ixx', type='D', 

673 doc='Adaptive second moment of the source intensity.') 

674 schema.addField('ixxErr', type='F', 

675 doc='Uncertainty of ixx.') 

676 schema.addField('iyy', type='D', 

677 doc='Adaptive second moment of the source intensity.') 

678 schema.addField('iyyErr', type='F', 

679 doc='Uncertainty of iyy.') 

680 schema.addField('ixy', type='D', 

681 doc='Adaptive second moment of the source intensity.') 

682 schema.addField('ixyErr', type='F', 

683 doc='Uncertainty of ixy.') 

684 schema.addField('ixx_iyy_Cov', type='D', 

685 doc='Covariance of ixx and iyy.') 

686 schema.addField('ixx_ixy_Cov', type='D', 

687 doc='Covariance of ixx and ixy.') 

688 schema.addField('iyy_ixy_Cov', type='D', 

689 doc='Covariance of iyy and ixy.') 

690 schema.addField('ixxPSF', type='D', 

691 doc='Adaptive second moment for the PSF.') 

692 schema.addField('iyyPSF', type='D', 

693 doc='Adaptive second moment for the PSF.') 

694 schema.addField('ixyPSF', type='D', 

695 doc='Adaptive second moment for the PSF.') 

696 schema.addField('extendedness', type='D', 

697 doc='A measure of extendedness, Computed using a combination of available moments and ' 

698 'model fluxes or from a likelihood ratio of point/trailed source models (exact ' 

699 'algorithm TBD). extendedness = 1 implies a high degree of confidence that the ' 

700 'source is extended. extendedness = 0 implies a high degree of confidence that the ' 

701 'source is point-like.') 

702 schema.addField('spuriousness', type='D', 

703 doc='A measure of spuriousness, computed using information from the source and image ' 

704 'characterization, as well as the information on the Telescope and Camera system ' 

705 '(e.g., ghost maps, defect maps, etc.).') 

706 schema.addField('flags', type='L', 

707 doc='Flags, bitwise OR tbd.') 

708 schema.addField('pixelId', type='L', 

709 doc='HTM index.') 

710 schema.addField("filterName", type='String', size=10, 

711 doc='String name of the filter this source was observed ' 

712 'in.') 

713 schema.addField("filterId", type='L', 

714 doc='Obs package id of the filter this source was ' 

715 'observed in.') 

716 schema.addField("isDipole", type='Flag', 

717 doc='Object determined to be a dipole.') 

718 return schema 

719 

720 

721def make_dia_forced_source_schema(): 

722 """ Define and create the minimal schema required for a DiaForcedSource. 

723 

724 Returns 

725 ------- 

726 schema : `lsst.afw.table.Schema` 

727 Minimal schema for DiaForcedSources. 

728 """ 

729 

730 # Generated automatically from apdb-schema.yaml in dax_apdb/data. 

731 schema = afwTable.SourceTable.makeMinimalSchema() 

732 schema.addField('ccdVisitId', type='L', 

733 doc='Id of the ccdVisit where this diaSource was measured. Note that we are allowing a ' 

734 'diaSource to belong to multiple amplifiers, but it may not span multiple ccds.') 

735 schema.addField('psFlux', type='D', 

736 doc='Calibrated flux for Point Source model. Note this actually measures the flux ' 

737 'difference between the template and the visit image.') 

738 schema.addField('psFluxErr', type='D', 

739 doc='Uncertainty of psFlux.') 

740 schema.addField('totFlux', type='D', 

741 doc='Calibrated flux measured in direct image.') 

742 schema.addField('totFluxErr', type='D', 

743 doc='Uncertainty of totFlux.') 

744 schema.addField('x', type='D', 

745 doc='x position at which psFlux has been measured.') 

746 schema.addField('y', type='D', 

747 doc='y position at which psFlux has been measured.') 

748 schema.addField('flags', type='L', 

749 doc='Flags from measurement on the difference image, ' 

750 'bitwise OR tbd') 

751 schema.addField('flagsDirectIm', type='L', 

752 doc='Flags from measurement on the direct image, bitwise ' 

753 'OR tbd') 

754 return schema 

755 

756 

757def getCcdVisitSchemaSql(): 

758 """Define the schema for the CcdVisit table. 

759 

760 Returns 

761 ------- 

762 ccdVisitNames : `collections.OrderedDict` 

763 Names of columns in the ccdVisit table. 

764 """ 

765 return oDict([("ccdVisitId", "INTEGER PRIMARY KEY"), 

766 ("ccdNum", "INTEGER"), 

767 ("filterName", "TEXT"), 

768 ("filterId", "INTEGER"), 

769 ("ra", "REAL"), 

770 ("decl", "REAL"), 

771 ("expTime", "REAL"), 

772 ("expMidptMJD", "REAL"), 

773 ("calibrationMean", "REAL"), 

774 ("calibrationErr", "REAL")])