-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearch_info_celestial_targets.py
More file actions
195 lines (146 loc) · 5.98 KB
/
Search_info_celestial_targets.py
File metadata and controls
195 lines (146 loc) · 5.98 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
from jinja2 import clear_caches
import numpy as np
from astropy import units as u
from astropy.time import Time
from astropy.coordinates import SkyCoord
from astropy.coordinates import EarthLocation
import pytz
from astroplan import Observer, FixedTarget
from astropy.utils.iers import conf
conf.auto_max_age = None
from astroplan import download_IERS_A
from astropy.coordinates import get_sun, get_moon, get_body
from astroplan import moon_illumination
from astroplan.plots import plot_finder_image
from astroquery.skyview import SkyView
download_IERS_A()
import pandas as pd
import math
now = Time.now()
from astropy.table import QTable
import astropy.units as u
import numpy as np
import os.path
from os import path
def time_in_india():
date = now + 5 * u.h + 30 * u.min
return date
def observatory_setup():
longitude = "73d48m53s"
latitude = "18d31m7s"
elevation = 560 * u.m
location = EarthLocation(longitude, latitude, elevation)
ioMIT = Observer(
location=location,
timezone="Asia/Kolkata",
name="MIT-Telescope",
description="GSO-Newtonian Telescope MIT World Peace University",
)
return ioMIT
def sunset(observatory):
sunset_ioMIT = observatory.sun_set_time(now, which="nearest")
return sunset_ioMIT
def evening_twilight(observatory):
eve_twil_ioMIT = observatory.twilight_evening_astronomical(now, which="nearest")
return eve_twil_ioMIT
def midnight(observatory):
midnight_ioMIT = observatory.midnight(now, which="nearest")
return midnight_ioMIT
def morn_twilight(observatory):
morn_twil_ioMIT = observatory.twilight_morning_astronomical(now, which="nearest")
return morn_twil_ioMIT
def sunrise(observatory):
sunrise_ioMIT = observatory.sun_rise_time(now, which='next')
with open('dataset.txt', 'a') as f:
f.write(f"Sunrise : {sunrise_ioMIT}")
return sunrise_ioMIT
def local_sidereal_time_now (observatory):
lst_now = observatory.local_sidereal_time(now)
return lst_now
def local_sidereal_time_midnight(observatory):
midnight_ioMIT = observatory.midnight(now, which="nearest")
lst_mid = observatory.local_sidereal_time(midnight_ioMIT)
return lst_mid
observatory = observatory_setup()
class InformationObjects:
def __init__(self,coord1,coord2,celsobj):
self.coord1 = coord1
self.coord2 = coord2
self.celsobj = celsobj
@property
def checking_mid_twilight(self):
coords = SkyCoord(self.coord1,self.coord2, frame = 'icrs')
object = FixedTarget(name = self.celsobj, coord = coords)
eve_twi = observatory.target_is_up(evening_twilight(observatory),object)
midnit = observatory.target_is_up(midnight(observatory),object)
morn_twi = observatory.target_is_up(morn_twilight(observatory),object)
data1 = {"Evening Twilight" : eve_twi,
"Midnight" : midnit,
"Morning Twilight": morn_twi
}
with open('dataset.txt', 'a') as f:
f.write(f"\nVisibility : {data1}")
return data1
@property
def rise_times(self):
coords = SkyCoord(self.coord1,self.coord2, frame = 'icrs')
object = FixedTarget(name = self.celsobj, coord = coords)
objectrise = observatory.target_rise_time(now, object , which = 'nearest', horizon = 0 * u.deg)
with open('dataset.txt', 'a') as f:
f.write(f"\nRise Time : {objectrise.iso}")
return objectrise.iso
@property
def set_time(self):
coords = SkyCoord(self.coord1,self.coord2, frame = 'icrs')
object = FixedTarget(name = self.celsobj, coord = coords)
# time=observer.target_set_time(now,target).iso
objectset = observatory.target_set_time(now, object , which = 'nearest', horizon = 0 * u.deg)
with open('dataset.txt', 'a') as f:
f.write(f"\nSet time : {objectset.iso}")
return objectset.iso
@property
def ra(self):
target = FixedTarget.from_name(self.celsobj)
with open('dataset.txt', 'a') as f:
f.write(f"\nRight Ascenion : {target.ra.degree}")
return target.coord
@property
def dec(self):
target = FixedTarget.from_name(self.celsobj)
with open('dataset.txt', 'a') as f:
f.write(f"\nDeclination : {target.dec.degree}")
return target.coord
@property
def target_up_at_midnight(self):
coords = SkyCoord(self.coord1,self.coord2, frame = 'icrs')
object = FixedTarget(name = self.celsobj, coord = coords)
midnight_ioMIT = observatory.midnight(now, which="nearest")
obs = observatory.target_is_up(midnight_ioMIT,object)
return obs
@property
def airmass (self):
coords = SkyCoord(self.coord1,self.coord2, frame = 'icrs')
object = FixedTarget(name = self.celsobj, coord = coords)
target_altaz = observatory.altaz(midnight(observatory), object)
with open('dataset.txt', 'a') as f:
f.write(f"\nAir mass : {target_altaz.secz}")
return target_altaz.secz
if path.exists("dataset.txt"):
celes_object = input("Enter the name of the target : ")
target = FixedTarget.from_name(celes_object)
RA = target.ra
DEC = target.dec
intel = InformationObjects(RA,DEC,celes_object)
with open('dataset.txt', 'a') as f:
f.write(f'\n\nName : {celes_object}')
intel.ra
intel.dec
intel.rise_times
intel.set_time
intel.airmass
intel.checking_mid_twilight
else:
with open('dataset.txt', 'a') as f:
f.write(" Info about the Celestial Objects ")
print("DataSet Document Created....")
print("Run the Program Again")