Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
__radd__ = __add__
def __neg__(self):
return -self.pos
def __sub__(self, a):
return self.pos - a.pos
def __rsub__(self, a):
return a.pos - self.pos
# _ _ _ _
# / \ _ __ _ __ __ _ _ _| | ___ ___ __ _| |_(_) ___ _ __
# / _ \ | '__| '__/ _` | | | | | / _ \ / __/ _` | __| |/ _ \| '_ \
# / ___ \| | | | | (_| | |_| | |__| (_) | (_| (_| | |_| | (_) | | | |
# /_/ \_\_| |_| \__,_|\__, |_____\___/ \___\__,_|\__|_|\___/|_| |_|
# |___/
class ArrayLocation(ephem.Observer):
"""Collected information about where and when an array is."""
def __init__(self, location=None, uv=None):
"""location: location of the array in (lat, long, [elev])
uv: Miriad UV file"""
ephem.Observer.__init__(self)
self.cache = 0
if not uv is None: self.from_uv(uv)
else:
if location is None:
raise ValueError('Must provide either uv or location.')
self.update_location(location)
def update_location(self, location):
"""Initialize the antenna array for the provided location. Locations
may be (lat, long) or (lat, long, elev)."""
if len(location) == 2: self.lat, self.long = location
else: self.lat, self.long, self.elev = location