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

import unittest 

 

import lsst.utils.tests 

import lsst.afw.geom 

 

from lsst.skymap.ringsSkyMap import RingsSkyMap 

from helper import skyMapTestCase 

 

 

class RingsTestCase(skyMapTestCase.SkyMapTestCase): 

 

def setUp(self): 

config = RingsSkyMap.ConfigClass() 

config.numRings = 3 

self.setAttributes( 

SkyMapClass=RingsSkyMap, 

name="rings", 

config=config, 

numTracts=26, 

neighborAngularSeparation=None, # no uniform tract separation 

numNeighbors=None, # ignored because neighborAngularSeparation=None 

) 

 

def testPoles(self): 

"""Test that findAllTracts behaves at the poles 

 

Testing fix to DM-10686. 

""" 

skymap = self.getSkyMap() 

for ra in (0, 123, 321, 359.9): 

tracts = skymap.findAllTracts(lsst.afw.geom.SpherePoint(ra, 90, lsst.afw.geom.degrees)) 

self.assertListEqual(tracts, [skymap[len(skymap) - 1]]) 

tracts = skymap.findAllTracts(lsst.afw.geom.SpherePoint(ra, -90, lsst.afw.geom.degrees)) 

self.assertListEqual(tracts, [skymap[0]]) 

 

def testSha1Compare(self): 

"""Test that RingsSkyMap's extra state is included in its hash.""" 

defaultSkyMap = self.getSkyMap() 

for numRings in (4, 5): 

config = self.getConfig() 

config.numRings = numRings 

skyMap = self.getSkyMap(config=config) 

self.assertNotEqual(skyMap, defaultSkyMap) 

for raStart in (60.0, 75.0): 

config = self.getConfig() 

config.raStart = raStart 

skyMap = self.getSkyMap(config=config) 

self.assertNotEqual(skyMap, defaultSkyMap) 

 

 

class HscRingsTestCase(lsst.utils.tests.TestCase): 

def setUp(self): 

# This matches the HSC SSP configuration, on which the problem was discovered 

config = RingsSkyMap.ConfigClass() 

config.numRings = 120 

config.projection = "TAN" 

config.tractOverlap = 1.0/60 # Overlap between tracts (degrees) 

config.pixelScale = 0.168 

self.skymap = RingsSkyMap(config) 

 

def tearDown(self): 

del self.skymap 

 

def testDm7770(self): 

"""Test that DM-7770 has been fixed 

 

These operations previously caused: 

lsst::pex::exceptions::RuntimeError: 'Error: wcslib 

returned a status code of 9 at sky 30.18, -3.8 deg: 

One or more of the world coordinates were invalid' 

 

We are only testing function, and not the actual results. 

""" 

coordList = [lsst.afw.geom.SpherePoint(ra, dec, lsst.afw.geom.degrees) for 

ra, dec in [(30.18, -3.8), (31.3, -3.8), (31.3, -2.7), (30.18, -2.7)]] 

for coord in coordList: 

self.skymap.findAllTracts(coord) 

self.skymap.findTractPatchList(coordList) 

 

 

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

pass 

 

 

def setup_module(module): 

lsst.utils.tests.init() 

 

 

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

lsst.utils.tests.init() 

unittest.main()