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

1from __future__ import print_function 

2from builtins import str 

3import os 

4import unittest 

5import shutil 

6import unittest 

7import yaml 

8from fundamentals import tools 

9from astrocalc.utKit import utKit 

10from os.path import expanduser 

11home = expanduser("~") 

12 

13packageDirectory = utKit("").get_project_root() 

14settingsFile = packageDirectory + "/test_settings.yaml" 

15su = tools( 

16 arguments={"settingsFile": settingsFile}, 

17 docString=__doc__, 

18 logLevel="DEBUG", 

19 options_first=False, 

20 projectName=None, 

21 defaultSettingsFile=False 

22) 

23arguments, settings, log, dbConn = su.setup() 

24 

25# SETUP PATHS TO COMMON DIRECTORIES FOR TEST DATA 

26moduleDirectory = os.path.dirname(__file__) 

27pathToInputDir = moduleDirectory + "/input/" 

28pathToOutputDir = moduleDirectory + "/output/" 

29 

30try: 

31 shutil.rmtree(pathToOutputDir) 

32except: 

33 pass 

34# COPY INPUT TO OUTPUT DIR 

35shutil.copytree(pathToInputDir, pathToOutputDir) 

36 

37# Recursively create missing directories 

38if not os.path.exists(pathToOutputDir): 

39 os.makedirs(pathToOutputDir) 

40 

41 

42class test_translate(unittest.TestCase): 

43 

44 def test_translate_function01(self): 

45 

46 from astrocalc.coords import translate 

47 ra, dec = translate( 

48 log=log, 

49 settings=settings, 

50 ra="14:45:32.3432", 

51 dec="-45:34:23.3434", 

52 northArcsec=45, 

53 eastArcsec=68 

54 ).get() 

55 

56 print(ra, dec) 

57 

58 def test_translate_function02(self): 

59 

60 from astrocalc.coords import translate 

61 ra, dec = translate( 

62 log=log, 

63 settings=settings, 

64 ra="14.546", 

65 dec="-45.34232334", 

66 northArcsec=4560, 

67 eastArcsec=-5678 

68 ).get() 

69 

70 print(ra, dec) 

71 

72 def test_translate_ra_gt_360(self): 

73 

74 from astrocalc.coords import translate 

75 ra, dec = translate( 

76 log=log, 

77 settings=settings, 

78 ra="14.546438", 

79 dec="-45.34232", 

80 northArcsec=4560, 

81 eastArcsec=+967800 

82 ).get() 

83 

84 print(ra, dec) 

85 

86 def test_translate_ra_lt_360(self): 

87 

88 from astrocalc.coords import translate 

89 ra, dec = translate( 

90 log=log, 

91 settings=settings, 

92 ra="14.546438", 

93 dec="-45.34232334", 

94 northArcsec=4560, 

95 eastArcsec=-967800 

96 ).get() 

97 

98 print(ra, dec) 

99 

100 def test_translate_dec_lt_m90(self): 

101 

102 from astrocalc.coords import translate 

103 ra, dec = translate( 

104 log=log, 

105 settings=settings, 

106 ra="14.546438", 

107 dec="-85.34", 

108 northArcsec=-43560, 

109 eastArcsec=-967800 

110 ).get() 

111 

112 print(ra, dec) 

113 

114 def test_translate_dec_gt_90(self): 

115 

116 from astrocalc.coords import translate 

117 ra, dec = translate( 

118 log=log, 

119 settings=settings, 

120 ra="14.546438", 

121 dec="85.34232334", 

122 northArcsec=45600, 

123 eastArcsec=-967800 

124 ).get() 

125 

126 print(ra, dec) 

127 

128 # x-print-testpage-for-pessto-marshall-web-object 

129 

130 # x-class-to-test-named-worker-function