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

from __future__ import division 

import math 

import unittest 

 

import lsst.sims.utils as simsUtils 

from lsst.ts.dateloc import ObservatoryLocation 

import lsst.utils.tests 

 

class ObservatoryLocationTest(unittest.TestCase): 

 

def setUp(self): 

# Gemini North 

self.latitude_truth = 19.82396 

self.longitude_truth = -155.46984 

self.height_truth = 4213.0 

self.latitude_rad_truth = math.radians(self.latitude_truth) 

self.longitude_rad_truth = math.radians(self.longitude_truth) 

 

def test_information_after_standard_creation(self): 

location = ObservatoryLocation(self.latitude_rad_truth, 

self.longitude_rad_truth, 

self.height_truth) 

self.assertEqual(location.latitude, self.latitude_truth) 

self.assertEqual(location.longitude, self.longitude_truth) 

self.assertEqual(location.height, self.height_truth) 

 

def test_information_after_lsst_configuration(self): 

location = ObservatoryLocation() 

location.for_lsst() 

lsst = simsUtils.Site(name='LSST') 

self.assertAlmostEqual(location.latitude, lsst.latitude, places=4) 

self.assertEqual(location.longitude, lsst.longitude) 

self.assertEqual(location.height, lsst.height) 

 

def test_information_after_config_dictionary_configuration(self): 

condfdict = { 

'obs_site': { 

'latitude': self.latitude_truth, 

'longitude': self.longitude_truth, 

'height': self.height_truth 

} 

} 

location = ObservatoryLocation() 

location.configure(condfdict) 

self.assertEqual(location.latitude_rad, self.latitude_rad_truth) 

self.assertEqual(location.longitude_rad, self.longitude_rad_truth) 

self.assertEqual(location.height, self.height_truth) 

 

def test_information_after_reconfiguration(self): 

location = ObservatoryLocation() 

location.reconfigure(self.latitude_rad_truth, 

self.longitude_rad_truth, 

self.height_truth) 

self.assertEqual(location.latitude_rad, self.latitude_rad_truth) 

self.assertEqual(location.longitude_rad, self.longitude_rad_truth) 

self.assertEqual(location.height, self.height_truth) 

 

def test_get_configure_dict(self): 

cd = ObservatoryLocation.get_configure_dict() 

self.assertEqual(len(cd), 1) 

self.assertEqual(len(cd["obs_site"]), 3) 

 

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

pass 

 

def setup_module(module): 

lsst.utils.tests.init() 

 

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

lsst.utils.tests.init() 

unittest.main()