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

1import math 

2 

3__all__ = ["ObservatoryPosition"] 

4 

5class ObservatoryPosition(object): 

6 """Class for providing base pointing position information. 

7 """ 

8 

9 def __init__(self, time=0.0, ra_rad=0.0, dec_rad=0.0, ang_rad=0.0, 

10 band_filter='r', tracking=False, alt_rad=1.5, az_rad=0.0, 

11 pa_rad=0.0, rot_rad=0.0): 

12 """Initialize the class. 

13 

14 Parameters 

15 ---------- 

16 time : float 

17 The UTC timestamp (seconds) for the given pointing position 

18 information. 

19 ra_rad : float 

20 The right ascension (radians) for the pointing position. 

21 dec_rad : float 

22 The declination (radians) for the pointing position. 

23 ang_rad : float 

24 

25 band_filter : str 

26 The band filter being used during the pointing. 

27 tracking : bool 

28 The tracking state of the pointing. 

29 alt_rad : float 

30 The altitude (radians) of the pointing. 

31 az_rad : float 

32 The azimuth (radians) of the pointing. 

33 pa_rad : float 

34 The parallactic angle (radians) of the pointing. 

35 rot_rad : float 

36 

37 """ 

38 self.time = time 

39 self.ra_rad = ra_rad 

40 self.dec_rad = dec_rad 

41 self.ang_rad = ang_rad 

42 self.filter = band_filter 

43 self.tracking = tracking 

44 self.alt_rad = alt_rad 

45 self.az_rad = az_rad 

46 self.pa_rad = pa_rad 

47 self.rot_rad = rot_rad 

48 

49 def __str__(self): 

50 """str: The string representation of the instance.""" 

51 return "t=%.1f ra=%.3f dec=%.3f ang=%.3f filter=%s track=%s alt=%.3f "\ 

52 "az=%.3f pa=%.3f rot=%.3f" % \ 

53 (self.time, self.ra, self.dec, self.ang, self.filter, 

54 self.tracking, self.alt, self.az, self.pa, self.rot) 

55 

56 @property 

57 def alt(self): 

58 """float: Return the altitude (degrees) of the pointing position.""" 

59 return math.degrees(self.alt_rad) 

60 

61 @property 

62 def ang(self): 

63 return math.degrees(self.ang_rad) 

64 

65 @property 

66 def az(self): 

67 """float: Return the azimuth (degrees) of the pointing position.""" 

68 return math.degrees(self.az_rad) 

69 

70 @property 

71 def dec(self): 

72 """float: Return the declination (degrees) of the pointing 

73 position.""" 

74 return math.degrees(self.dec_rad) 

75 

76 @property 

77 def pa(self): 

78 """float: Return the parallactic angle (degrees) of the pointing 

79 position.""" 

80 return math.degrees(self.pa_rad) 

81 

82 @property 

83 def ra(self): 

84 """float: Return the right ascension (degrees) of the pointing 

85 position.""" 

86 return math.degrees(self.ra_rad) 

87 

88 @property 

89 def rot(self): 

90 return math.degrees(self.rot_rad)