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

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

# 

# LSST Data Management System 

# Copyright 2008, 2009, 2010 LSST Corporation. 

# 

# This product includes software developed by the 

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

# 

# 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 <http://www.lsstcorp.org/LegalNotices/>. 

# 

 

import unittest 

 

import lsst.daf.base as dafBase 

import lsst.utils.tests 

from lsst.afw.geom import makeSkyWcs 

 

 

def headerToPropertyList(header): 

pl = dafBase.PropertyList() 

for key, value in header.items(): 

pl.add(key, value) 

return pl 

 

 

class WcsTestCase(unittest.TestCase): 

 

def setUp(self): 

# Actual WCS from processing Suprime-Cam 

self.width = 2048 

self.height = 4177 

self.header = {'NAXIS': 2, 

'EQUINOX': 2000.0000000000, 

'RADESYS': "FK5", 

'CRPIX1': -3232.7544925483, 

'CRPIX2': 4184.4881091129, 

'CD1_1': -5.6123808607273e-05, 

'CD1_2': 2.8951544956703e-07, 

'CD2_1': 2.7343044348306e-07, 

'CD2_2': 5.6100888336445e-05, 

'CRVAL1': 5.6066137655191, 

'CRVAL2': -0.60804032498548, 

'CUNIT1': "deg", 

'CUNIT2': "deg", 

'A_ORDER': 5, 

'A_0_2': 1.9749832126246e-08, 

'A_0_3': 9.3734869173527e-12, 

'A_0_4': 1.8812994578840e-17, 

'A_0_5': -2.3524013652433e-19, 

'A_1_1': -9.8443908806559e-10, 

'A_1_2': -4.9278297504858e-10, 

'A_1_3': -2.8491604610001e-16, 

'A_1_4': 2.3185723720750e-18, 

'A_2_0': 4.9546089730708e-08, 

'A_2_1': -8.8592221672777e-12, 

'A_2_2': 3.3560100338765e-16, 

'A_2_3': 3.0469486185035e-21, 

'A_3_0': -4.9332471706700e-10, 

'A_3_1': -5.3126029725748e-16, 

'A_3_2': 4.7795824885726e-18, 

'A_4_0': 1.3128844828963e-16, 

'A_4_1': 4.4014452170715e-19, 

'A_5_0': 2.1781986904162e-18, 

'B_ORDER': 5, 

'B_0_2': -1.0607653075899e-08, 

'B_0_3': -4.8693887937365e-10, 

'B_0_4': -1.0363305097301e-15, 

'B_0_5': 1.9621640066919e-18, 

'B_1_1': 3.0340657679481e-08, 

'B_1_2': -5.0763819284853e-12, 

'B_1_3': 2.8987281654754e-16, 

'B_1_4': 1.8253389678593e-19, 

'B_2_0': -2.4772849184248e-08, 

'B_2_1': -4.9775588352207e-10, 

'B_2_2': -3.6806326254887e-16, 

'B_2_3': 4.4136985315418e-18, 

'B_3_0': -1.7807191001742e-11, 

'B_3_1': -2.4136396882531e-16, 

'B_3_2': 2.9165413645768e-19, 

'B_4_0': 4.1029951148438e-16, 

'B_4_1': 2.3711874424169e-18, 

'B_5_0': 4.9333635889310e-19, 

'AP_ORDER': 5, 

'AP_0_1': -5.9740855298291e-06, 

'AP_0_2': -2.0433429597268e-08, 

'AP_0_3': -8.6810071023434e-12, 

'AP_0_4': -2.4974690826778e-17, 

'AP_0_5': 1.9819631102516e-19, 

'AP_1_0': -4.5896648256716e-05, 

'AP_1_1': -1.5248993348644e-09, 

'AP_1_2': 5.0283116166943e-10, 

'AP_1_3': 4.3796281513144e-16, 

'AP_1_4': -2.1447889127908e-18, 

'AP_2_0': -4.7550300344365e-08, 

'AP_2_1': 1.0924172283232e-11, 

'AP_2_2': -4.9862026098260e-16, 

'AP_2_3': -5.4470851768869e-20, 

'AP_3_0': 5.0130654116966e-10, 

'AP_3_1': 6.8649554020012e-16, 

'AP_3_2': -4.2759588436342e-18, 

'AP_4_0': -3.6306802581471e-16, 

'AP_4_1': -5.3885285875084e-19, 

'AP_5_0': -1.8802693525108e-18, 

'BP_ORDER': 5, 

'BP_0_1': -2.6627855995942e-05, 

'BP_0_2': 1.1143451873584e-08, 

'BP_0_3': 4.9323396530135e-10, 

'BP_0_4': 1.1785185735421e-15, 

'BP_0_5': -1.6169957016415e-18, 

'BP_1_0': -5.7914490267576e-06, 

'BP_1_1': -3.0565765766244e-08, 

'BP_1_2': 5.7727475030971e-12, 

'BP_1_3': -4.0586821113726e-16, 

'BP_1_4': -2.0662723654322e-19, 

'BP_2_0': 2.3705520015164e-08, 

'BP_2_1': 5.0530823594352e-10, 

'BP_2_2': 3.8904979943489e-16, 

'BP_2_3': -3.8346209540986e-18, 

'BP_3_0': 1.9505421473262e-11, 

'BP_3_1': 1.7583146713289e-16, 

'BP_3_2': -3.4876779564534e-19, 

'BP_4_0': -3.3690937119054e-16, 

'BP_4_1': -2.0853007589561e-18, 

'BP_5_0': -5.5344298912288e-19, 

'CTYPE1': "RA---TAN-SIP", 

'CTYPE2': "DEC--TAN-SIP", 

} 

 

def testInputInvariance(self): 

pl = headerToPropertyList(self.header) 

makeSkyWcs(pl, strip=False) 

for key, value in self.header.items(): 

self.assertEqual(value, pl.getScalar(key), 

f"{key} not invariant: {value} vs {pl.getScalar(key)}") 

 

def testRepeat(self): 

pl = headerToPropertyList(self.header) 

wcs1 = makeSkyWcs(pl, strip=False) 

wcs2 = makeSkyWcs(pl, strip=False) 

self.assertEqual(wcs1, wcs2) 

 

 

class MemoryTester(lsst.utils.tests.MemoryTestCase): 

pass 

 

 

def setup_module(module): 

lsst.utils.tests.init() 

 

 

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

lsst.utils.tests.init() 

unittest.main()