1
+ #!/usr/bin/env python3
2
+ import math
3
+ from astropy .coordinates import SkyCoord , EarthLocation , AltAz , Angle
4
+ from astropy import units as u
5
+ from astropy .time import Time
6
+ from astropy .utils import iers
7
+ import sys , subprocess
8
+
9
+ def polarcalibrate (mylat , mylong , myelev ):
10
+ #iers.conf.auto_download = False
11
+ #iers.conf.auto_max_age = None
12
+
13
+ #Create location object based on lat/long/elev
14
+ observing_location = EarthLocation (lat = mylat * u .deg , lon = mylong * u .deg , height = 177 * u .m )
15
+
16
+ p1RA = input ("Enter first RA value in 00h00m00.0s format: " )
17
+ p1DEC = input ("Enter first DEC value in 00d00m00.0s format: " )
18
+ p1Time = Time (input ("Enter first Time value in YYYY-MM-DD HH:MM:SS format: " ))
19
+ p2RA = input ("Enter second RA value in 00h00m00.0s format: " )
20
+ p2DEC = input ("Enter second DEC value in 00d00m00.0s format: " )
21
+ p2Time = Time (input ("Enter second Time value in YYYY-MM-DD HH:MM:SS format: " ))
22
+
23
+ p1 = SkyCoord (p1RA , p1DEC )
24
+ p2 = SkyCoord (p2RA , p2DEC )
25
+
26
+ p1AzAlt = p1 .transform_to (AltAz (obstime = p1Time ,location = observing_location ))
27
+ p2AzAlt = p2 .transform_to (AltAz (obstime = p2Time ,location = observing_location ))
28
+ print (f"First capture Az./Alt.: { p1AzAlt .az .to_string (u .hour , precision = 2 )} /{ p1AzAlt .alt .to_string (u .deg , precision = 2 )} ." )
29
+ print (f"Second capture Az./Alt.: { p2AzAlt .az .to_string (u .hour , precision = 2 )} /{ p2AzAlt .alt .to_string (u .deg , precision = 2 )} ." )
30
+
31
+ if p1AzAlt .az .deg > 180 :
32
+ p1Az = (360 - p1AzAlt .az .deg )* 60
33
+ else :
34
+ p1Az = p1AzAlt .az .deg * 60
35
+ if p2AzAlt .az .deg > 180 :
36
+ p2Az = (360 - p2AzAlt .az .deg )* 60
37
+ else :
38
+ p2Az = p2AzAlt .az .deg * 60
39
+
40
+ deltaAz = abs (p1Az - p2Az )
41
+ deltaAlt = abs (p1AzAlt .alt .arcmin - p2AzAlt .alt .arcmin )
42
+
43
+ print (f"Azimuth delta is: { deltaAz :.4f} arcminutes." )
44
+ print (f"Altitude delta is: { deltaAlt :.4f} arcminutes." )
45
+
46
+ return
47
+
48
+ #Latitude in degrees
49
+ mylat = float (sys .argv [1 ])
50
+
51
+ #Longitude in degrees
52
+ mylong = float (sys .argv [2 ])
53
+
54
+ #Elevation in meters
55
+ myelev = sys .argv [3 ]
56
+
57
+ polarcalibrate (mylat , mylong , myelev )
0 commit comments