-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
115 lines (88 loc) · 3.05 KB
/
test.py
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
from datetime import datetime
from math import degrees
import ephem
place = ephem.Observer()
place.lat = '31.7754'
place.lon = '76.9861'
place.elevation = 1000
place.date = datetime.now().strftime('%Y/%m/%d')
#print (place.date)
#print (datetime.now().date().strftime('%Y/%m/%d'))
test_place = place
objects_string = ["Polaris", "Vega", "Deneb", "Altair", "Caph", "Schedar",
"Scheat", "Algenib", "Fomalhaut", "Hamal", "Aldebaran", "Atlas",
"Capella", "Menkalinan", "Achernar", "Elnath", "Bellatrix", "Rigel",
"Mintaka", "Alnilam", "Betelgeuse", "Alnitak", "Saiph", "Castor", "Sirius", "Dubhe",
"Procyon", "Pollux", "Merak", "Canopus", "Megrez", "Phecda", "Alphard", "Algieba",
"Regulus", "Alioth", "Mizar", "Denebola", "Alcaid"
]
objects = []
for s in objects_string:
objects.append(ephem.star(s))
ruchbah = ephem.FixedBody()
ruchbah.name = "Ruchbah"
ruchbah._ra = '0:56:42.0'
ruchbah._dec = '60:43:00.0'
alpheratz = ephem.FixedBody()
alpheratz.name = "Alpheratz"
alpheratz._ra = '0:08:23.0'
alpheratz._dec = '29:05:26.0'
cursa = ephem.FixedBody()
cursa.name = "Cursa"
cursa._ra = '5:07:51.0'
cursa._dec = '-5:05:11.0'
rngc1980 = ephem.FixedBody()
rngc1980.name = "RNGC 1980"
rngc1980._ra = '5:36:27.0'
rngc1980._dec = '-5:54:35.0'
m42 = ephem.FixedBody()
m42.name = "M 42"
m42._ra = '5:35:21.0'
m42._dec = '-5:23:31.0'
m45 = ephem.FixedBody()
m45.name = "M 45"
m45._ra = '3:47:24.0'
m45._dec = '24:7:0.0'
other_objects = [ruchbah, alpheratz, cursa, rngc1980, m42, m45]
objects.append(ephem.Saturn())
objects.append(ephem.Mars())
objects.append(ephem.Moon())
objects.append(ephem.Jupiter())
objects.append(ephem.Uranus())
objects.append(ephem.Neptune())
objects.append(ephem.Mercury())
objects.append(ephem.Venus())
objects = objects + other_objects
planets = ["Saturn", "Mars", "Moon", "Jupiter",
"Uranus", "Neptune", "Mercury", "Venus"]
obj_req = input("Enter the name of object: ")
if obj_req not in objects + planets + objects_string:
print("**Entered object is not in the databse\n**Giving details of Moon by default")
obj_req = "Moon"
obj = ephem.FixedBody()
x = iter(planets)
for o in objects:
o.compute(place.date)
if o.name in planets:
for x in planets:
if o.name == x == obj_req:
obj.name = o.name
obj._ra = o.ra
obj._dec = o.dec
elif o.name == obj_req:
obj.name = o.name
obj._ra = o._ra
obj._dec = o._dec
test_place.date = ephem.now()
obj.compute(test_place)
val1 = degrees(obj.alt)
val2 = degrees(obj.az)
# Checking the status of the object, if it below or above the Horizon
if val1 < degrees(0):
print("Status: The Object is below the Horizon!")
elif val1 < 10:
print("Status: The Object is just above the Horizon and may not be visible from the current location")
else:
print("Status: The Object is above the Horizon")
print("Resultant Altitude: " + str(val1) + " degrees")
print("Resultant Azimuth: " + str(val2) + " degrees")