-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasses.py
More file actions
56 lines (46 loc) · 1.12 KB
/
classes.py
File metadata and controls
56 lines (46 loc) · 1.12 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
from math import radians
from skyfield.api import Time, EarthSatellite, wgs84
class Spacecraft:
def __init__(
self,
satellite: EarthSatellite,
field_of_regard: float = radians(30),
aq_prob: float = 1.0,
download_rate: float = 100.
):
self.satellite = satellite
self.for_ = field_of_regard
self.aq_prob = aq_prob
self.download_rate = download_rate
def __repr__(self):
return self.satellite.satellite.__str__()
class Location:
def __init__(
self,
name: str,
location: tuple
):
self.name = name
self.location = wgs84.latlon(location[0], location[1])
class Contact:
"""Space-to-Ground contact base class"""
def __init__(
self,
satellite: Spacecraft,
target: Location,
t_rise: Time,
t_peak: Time,
t_set: Time
):
self.satellite = satellite
self.target = target
self.t_rise = t_rise
self.t_peak = t_peak
self.t_set = t_set
@property
def duration(self):
return 24 * 60 * 60 * (self.t_set - self.t_rise)
def __lt__(self, other): # Define what is meant when comparing one contact to another
if self.t_peak.J <= other.t_peak.J:
return True
return False