|
| 1 | +# This file is part of analysis_tools. |
| 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 | +from ..actions.scalar import ( |
| 23 | + FullRangeAction, |
| 24 | + MaxAction, |
| 25 | + MeanAction, |
| 26 | + MedianAction, |
| 27 | + MinAction, |
| 28 | + SigmaMadAction, |
| 29 | + StdevAction, |
| 30 | +) |
| 31 | +from ..actions.vector import AngularSeparation, DivideVector |
| 32 | +from ..interfaces import AnalysisTool |
| 33 | + |
| 34 | +__all__ = ("AstrometryStatistics",) |
| 35 | + |
| 36 | + |
| 37 | +class AstrometryStatistics(AnalysisTool): |
| 38 | + """Calculate astrometry metrics from the visit_summary table.""" |
| 39 | + |
| 40 | + def setDefaults(self): |
| 41 | + super().setDefaults() |
| 42 | + |
| 43 | + self.process.buildActions.cornersep = AngularSeparation( |
| 44 | + raKey_A="raCorners_0", |
| 45 | + decKey_A="decCorners_0", |
| 46 | + raKey_B="raCorners_2", |
| 47 | + decKey_B="decCorners_2", |
| 48 | + outputUnit="arcminute", |
| 49 | + ) |
| 50 | + self.process.buildActions.ratio = DivideVector() |
| 51 | + self.process.buildActions.ratio.actionA = AngularSeparation( |
| 52 | + raKey_A="raCorners_0", |
| 53 | + decKey_A="decCorners_0", |
| 54 | + raKey_B="raCorners_2", |
| 55 | + decKey_B="decCorners_2", |
| 56 | + outputUnit="arcminute", |
| 57 | + ) |
| 58 | + self.process.buildActions.ratio.actionB = AngularSeparation( |
| 59 | + raKey_A="raCorners_1", |
| 60 | + decKey_A="decCorners_1", |
| 61 | + raKey_B="raCorners_3", |
| 62 | + decKey_B="decCorners_3", |
| 63 | + outputUnit="arcminute", |
| 64 | + ) |
| 65 | + |
| 66 | + self.process.calculateActions.minCornerSeparation = MinAction(vectorKey="cornersep") |
| 67 | + self.process.calculateActions.maxCornerSeparation = MaxAction(vectorKey="cornersep") |
| 68 | + self.process.calculateActions.minCornerSeparationRatio = MinAction(vectorKey="ratio") |
| 69 | + self.process.calculateActions.maxCornerSeparationRatio = MaxAction(vectorKey="ratio") |
| 70 | + self.process.calculateActions.minPixelScale = MinAction(vectorKey="pixelScale") |
| 71 | + self.process.calculateActions.maxPixelScale = MaxAction(vectorKey="pixelScale") |
| 72 | + self.process.calculateActions.fullRangePixelScale = FullRangeAction(vectorKey="pixelScale") |
| 73 | + self.process.calculateActions.medianPixelScale = MedianAction(vectorKey="pixelScale") |
| 74 | + self.process.calculateActions.sigmaMADPixelScale = SigmaMadAction(vectorKey="pixelScale") |
| 75 | + self.process.calculateActions.meanPixelScale = MeanAction(vectorKey="pixelScale") |
| 76 | + self.process.calculateActions.stdevPixelScale = StdevAction(vectorKey="pixelScale") |
| 77 | + |
| 78 | + self.produce.metric.units = { |
| 79 | + "minCornerSeparation": "arcmin", |
| 80 | + "maxCornerSeparation": "arcmin", |
| 81 | + "minCornerSeparationRatio": "", |
| 82 | + "maxCornerSeparationRatio": "", |
| 83 | + "minPixelScale": "arcsec", |
| 84 | + "maxPixelScale": "arcsec", |
| 85 | + "medianPixelScale": "arcsec", |
| 86 | + "sigmaMADPixelScale": "arcsec", |
| 87 | + "meanPixelScale": "arcsec", |
| 88 | + "stdevPixelScale": "arcsec", |
| 89 | + } |
0 commit comments