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

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

#!/usr/bin/env python 

# 

# LSST Data Management System 

# 

# This product includes software developed by the 

# LSST Project (http://www.lsst.org/). 

# 

# See COPYRIGHT file at the top of the source tree. 

# 

# This program is free software: you can redistribute it and/or modify 

# it under the terms of the GNU General Public License as published by 

# the Free Software Foundation, either version 3 of the License, or 

# (at your option) any later version. 

# 

# This program is distributed in the hope that it will be useful, 

# but WITHOUT ANY WARRANTY; without even the implied warranty of 

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

# GNU General Public License for more details. 

# 

# You should have received a copy of the LSST License Statement and 

# the GNU General Public License along with this program. If not, 

# see <https://www.lsstcorp.org/LegalNotices/>. 

# 

""" 

Validate the contents of an LSST Verification Framework metrics package. 

 

A metrics package contains, minimally, two root directories: 

 

1. metrics/ - contains one YAML file per LSST Science Pipelines package 

that define metrics measured by that package. 

 

2. specs/ - contains sub-directories named after LSST Science Pipelines 

packages. Specifications are defined in YAML files within those 

sub-directories. 

""" 

 

import argparse 

 

import lsst.pex.exceptions 

from lsst.utils import getPackageDir 

from lsst.verify import MetricSet, SpecificationSet 

 

 

def main(): 

try: 

default_metrics_package_dir = getPackageDir('verify_metrics') 

except lsst.pex.exceptions.NotFoundError: 

default_metrics_package_dir = None 

 

parser = argparse.ArgumentParser( 

description=__doc__, 

formatter_class=argparse.RawDescriptionHelpFormatter) 

parser.add_argument( 

"package_dir", 

default=default_metrics_package_dir, 

type=str, 

nargs='?', 

help="Filepath of the metrics package to be checked.") 

args = parser.parse_args() 

 

print('Linting {}.'.format(args.package_dir)) 

 

metric_repo = MetricSet.load_metrics_package(args.package_dir) 

print('Passed: metrics/') 

print('\tParsed {0:d} metric sets.'.format(len(metric_repo))) 

 

spec_set = SpecificationSet.load_metrics_package(args.package_dir) 

print('Passed: specs/') 

print('\tParsed {0:d} specifications.'.format(len(spec_set))) 

 

print("\nAll tests passed.") 

 

 

74 ↛ 75line 74 didn't jump to line 75, because the condition on line 74 was never trueif __name__ == "__main__": 

main()