Coverage for python/lsst/validate/drp/calcsrd/pf1.py : 40%

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# LSST Data Management System
2# Copyright 2016 AURA/LSST.
3#
4# This product includes software developed by the
5# LSST Project (http://www.lsst.org/).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the LSST License Statement and
18# the GNU General Public License along with this program. If not,
19# see <https://www.lsstcorp.org/LegalNotices/>.
22import numpy as np
23import astropy.units as u
25from lsst.verify import Measurement, Datum
28def measurePF1(metric, pa1, pa2_spec):
29 """Measurement of PF1: fraction of samples between median RMS (PA1) and
30 PA2 specification.
32 Parameters
33 ----------
34 metric : `lsst.verify.Metric`
35 A PF1 `~lsst.verify.Metric` instance.
36 pa1 : `lsst.verify.Measurement`
37 A PA1 measurement instance.
38 pa2_spec : `lsst.verify.Spec`
39 An `lsst.verify.Spec` that holds the threshold at which to measure PF1
41 Returns
42 -------
43 measurement : `lsst.verify.Measurement`
44 Measurement of PF1 and associated metadata.
46 Notes
47 -----
48 The LSST Science Requirements Document (LPM-17) is commonly referred
49 to as the SRD. The SRD puts a limit that no more than PF1 % of difference
50 will vary by more than PA2 millimag. The design, minimum, and stretch
51 goals are PF1 = (10, 20, 5) % at PA2 = (15, 15, 10) millimag following
52 LPM-17 as of 2011-07-06, available at http://ls.st/LPM-17.
53 """
55 datums = {}
56 datums['pa2_spec'] = Datum(quantity=pa2_spec.threshold, description="Threshold applied to PA2")
57 # Use first random sample from original PA1 measurement
58 magDiff = pa1.extras['magDiff'].quantity
59 magDiffs = magDiff[0, :]
61 quantity = 100 * np.mean(np.abs(magDiffs) > pa2_spec.threshold) * u.Unit('percent')
62 return Measurement(metric, quantity, extras=datums)