def controller(source, t=30.0): """Updates position and re-point telescope every t seconds. Args: t (float, optional): number of seconds between updates. Defaults to 30.0 seconds. """ logger = logging.getLogger('interf') try: while(True): # Update the time and recompute position OBS.date = ephem.now() source.compute(OBS) logger.debug('Move to telescope to (alt, az): (%s,%s)', str(getAlt(source)), str(source.az)) radiolab.pntTo(az=source.az*180/np.pi, alt=getAlt(source)) time.sleep(t) except Exception, e: logger.error('Re-pointing failed for (alt,az): (%s,%s)', str(getAlt(source)), str(source.az)) logger.error(str(e))
def pnt_obj(obs, target): """Point to current object location (does not respect obs.date) prints point status with each pointing operation """ obs.date = ephem.now() target.compute(obs) print '\nStart pnt: %s (JD: %s)' % (pdt(obs.date), ral.getJulDay()) print 'New pos (alt,az): %s, %s' % (target.alt, target.az) ral.pntTo(rad2deg(target.alt), rad2deg(target.az)) print 'Finish pnt: %s (JD: %s)\n' % (pdt(ephem.now()), ral.getJulDay())
def track(): if time.localtime()[4]+time.localtime()[5]/60. == t: print 'Home! - at ' + str(time.localtime()[3]) + ':' + str(time.localtime()[4]) rlb.pntHome() rlb.pntTo(rot_func_pnt.convert()[1]*180./np.pi, rot_func_pnt.convert()[0]*180./np.pi) time.sleep(30) rlb.pntTo(rot_func_pnt.convert()[1]*180./np.pi, rot_func_pnt.convert()[0]*180./np.pi) time.sleep(30) rlb.pntTo(rot_func_pnt.convert()[1]*180./np.pi, rot_func_pnt.convert()[0]*180./np.pi) else: time.sleep(30) rlb.pntTo(rot_func_pnt.convert()[1]*180./np.pi, rot_func_pnt.convert()[0]*180./np.pi)
def point(self, az, alt): """Wrapper around radiolab.pntTo that also logs, pass as degrees""" logger.warning("Start pointing to (az, alt): {az} {alt}".format(az=az, alt=alt)) radiolab.pntTo(az=az, alt=alt) logger.warning("Finished pointing.")
def controller(t=30.0): """Re-point telescope every t seconds. Args: t (float, optional): number of seconds between updates. Defaults to 30.0 seconds. """ logger = logging.getLogger('interf') try: while(True): logger.debug('Move to telescope to (alt, az): (%s,%s)', str(getAlt()), str(sun.az)) radiolab.pntTo(az=sun.az*180/np.pi, alt=getAlt()) time.sleep(t) except Exception, e: logger.error('Re-pointing failed for (alt,az): (%d,%d)', str(getAlt()), str(sun.az)) logger.error(str(e))
def point(self, az, alt): logger.warning("Start pointing to (az, alt): {az} {alt}".format(az=az, alt=alt)) radiolab.pntTo(az=np.rad2deg(az), alt=np.rad2deg(alt)) logger.warning("Finished pointing.")
def controller(source, t=30.0): """Updates position and re-point telescope every t seconds. Args: t (float, optional): number of seconds between updates. Defaults to 30.0 seconds. """ logger = logging.getLogger('interf') try: while (True): # Update the time and recompute position OBS.date = ephem.now() source.compute(OBS) logger.debug('Move to telescope to (alt, az): (%s,%s)', str(getAlt(source)), str(source.az)) radiolab.pntTo(az=source.az * 180 / np.pi, alt=getAlt(source)) time.sleep(t) except Exception, e: logger.error('Re-pointing failed for (alt,az): (%s,%s)', str(getAlt(source)), str(source.az)) logger.error(str(e))