#!/usr/bin/env python import hpib import subprocess import telescope import math import time ##import kapteyn p=hpib.PrologixGpibUsb() sml=hpib.HpibDevice(28, p) smx=hpib.HpibDevice(14, p) esmc=hpib.HpibDevice(1, p) DT=telescope.telescope(math.radians(52.812019), math.radians(6.396169), 25.0,connect=True) print sml.query("*IDN?") print esmc.query("*IDN?") print smx.query("*IDN?") freq=1420.405751 def stepoverrange(start=0,end=360,delay=1): for rastep in range(start,end): ra=math.radians(rastep) #ra=0 argString = str(ra)+" 0 2000 "+str(time.time())+" "+str(DT.lat())+" "+str(DT.long())+" 25 " vlsrStr="vlsr " + argString dopplerStr="doppler " + argString + str(freq) speed=subprocess.Popen(vlsrStr, stdout=subprocess.PIPE, shell=True).stdout.read() dfreq=1000.0+freq-float(subprocess.Popen(dopplerStr, stdout=subprocess.PIPE, shell=True).stdout.read()) sml.command("freq "+str(dfreq)+" MHz") qfreq=sml.query("freq?") print str(time.time()), dfreq, qfreq time.sleep(delay) #mset=subprocess.Popen(msStr, stdout=subprocess.PIPE, shell=True).stdout.read() def doforever(delay=1): while 1: #ra=math.radians(rastep) ra=0 argString = str(ra)+" 0 2000 "+str(time.time())+" "+str(DT.lat())+" "+str(DT.long())+" 25 " vlsrStr="vlsr " + argString dopplerStr="doppler " + argString + str(freq) speed=subprocess.Popen(vlsrStr, stdout=subprocess.PIPE, shell=True).stdout.read() dfreq=1000.0+freq-float(subprocess.Popen(dopplerStr, stdout=subprocess.PIPE, shell=True).stdout.read()) sml.command("freq "+str(dfreq)+" MHz") qfreq=sml.query("freq?") print str(time.time()), dfreq, qfreq time.sleep(delay)