Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if opt.schedule:
d = sat_rise.tuple()
rise_time = "%04d%02d%02d_%02d%02d" % (d[0], d[1], d[2], d[3], d[4])
offset_rise = ephem.date(sat_rise - ephem.minute)
d = offset_rise.tuple()
offset_rise_time = "%04d-%02d-%02dT%02d:%02d:%02dZ" % (
d[0],
d[1],
d[2],
d[3],
d[4],
int(d[5]),
)
offset_set = ephem.date(sat_set + ephem.minute)
d = offset_set.tuple()
offset_set_time = "%04d-%02d-%02dT%02d:%02d:%02dZ" % (
d[0],
d[1],
d[2],
d[3],
d[4],
int(d[5]),
)
cmd_lines = []
radio_channel = string.split(site["radio"]["channel"][1:-1], ",")
radio_gain = string.split(site["radio"]["gain"][1:-1], ",")
radio_address = string.split(site["radio"]["address"][1:-1], ",")
recorder_channels = string.split(
site["recorder"]["channels"][1:-1], ","
def gregorian_to_jd(greg):
"""
Convert gregorian date in format YYYY/MM/DD HH:MM:SS.SS to JD
"""
date = ephem.date(greg)
jd = date + 2415020.
return jd
def juldate2ephem(self, num):
"""
Convert Julian date to ephem date, measured from noon, Dec. 31, 1899.
Args:
num: Julian date
Returns:
ephem date, measured from noon, Dec. 31, 1899.
"""
return ephem.date(num - 2415020.)
def update_mjd(self, mjd):
"""
observer : ephem.Observer object
"""
self.observer.date = ephem.date(time.Time(mjd, format='mjd').datetime)
self.altitudes_rad = []
self.azimuth_rad = []
self.eclip = []
for sat in self.sat_list:
try:
sat.compute(self.observer)
except ValueError:
self.advance_epoch()
sat.compute(self.observer)
self.altitudes_rad.append(sat.alt)
self.azimuth_rad.append(sat.az)
self.eclip.append(sat.eclipsed)
self.altitudes_rad = np.array(self.altitudes_rad)
self.azimuth_rad = np.array(self.azimuth_rad)
def juldate2ephem(num):
"""Convert Julian date to an ephem date, which is measured from noon,
Jan. 1, 1900."""
return ephem.date(num - 2415020)
def juldate2ephem(num):
"""Convert Julian date to an ephem date, which is measured from noon,
Jan. 1, 1900."""
return ephem.date(num - 2415020)
def juldate2ephem(num):
"""Convert Julian date to ephem date, measured from noon, Dec. 31, 1899."""
return ephem.date(num - 2415020.)
def mouseReleaseEvent(self, evt):
if self.editing is not None:
rect = self.rx[self.editing].rect()
pos = evt.pos()
self.rx[self.editing].setRect(rect.x(), rect.y(), rect.width(), pos.y()-rect.y()+ self.verticalScrollBar().value())
rect = self.rx[self.editing].rect()
print 'release', self.rx[self.editing].rect()
if rect.height() / self.scale_y > 0.1:
print 'Start time', str(ephem.date(ephem.now() + ((rect.y() - self.orig_y) / self.scale_y) * ephem.minute))
print 'Duration', rect.height() / self.scale_y
print 'Centre Frequency', (rect.x() + rect.width()/2 - self.orig_x) / self.scale_x + (self.fx0 * 1e6)
self.rx[self.editing].setParams(ephem.date(ephem.now() + ((rect.y() - self.orig_y) / self.scale_y) * ephem.minute),
rect.height() / self.scale_y,
(rect.x() + rect.width()/2 - self.orig_x) / self.scale_x + (self.fx0 * 1e6))
for f in self.scene().items(rect):
print f
if isinstance(f, PlannerSat):
print f.name, f.mode, f.freq, f.params
self.rx[self.editing].addChannel(f.name, f.mode, f.freq, f.tle, f.params)
else:
self.rx[self.editing].hide()
self.rx[self.editing] = None
self.rx = self.rx[:-1]
self.editing = None
else:
QtGui.QGraphicsView.mouseReleaseEvent(self, evt)
#QtCore.QEvent.ignore(evt)
if len(sys.argv) > 1 and sys.argv[1] == "-v":
verbose = True
sys.argv = sys.argv[1:]
if len(sys.argv) > 1 and sys.argv[1] == "-c":
output_format = "csv"
sys.argv = sys.argv[1:]
elif len(sys.argv) > 1 and sys.argv[1] == "-s":
output_format = "sql"
sys.argv = sys.argv[1:]
else:
output_format = "text"
if len(sys.argv) > 1:
start = ephem.date(sys.argv[1])
else:
start = ephem.date('2014/8/15 04:00')
if len(sys.argv) > 2:
end = ephem.date(sys.argv[2])
else:
end = ephem.date('2017/1/1')
# Loop from start date to end date,
# using a time of 10pm MST, which is 4am GMT the following day.
# end = ephem.date('2016/1/1')
# For testing, this spans a Mars/Moon/Venus conjunction:
# d = ephem.date('2015/2/10 04:00')
# end = ephem.date('2015/3/10')
observer = ephem.Observer()
observer.name = "Los Alamos"