startup.py 1.74 KB
Newer Older
Tammo Jan Dijkema's avatar
Tammo Jan Dijkema committed
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
#!/usr/bin/env python
import hpib
import subprocess
import telescope
import math
import time
##import kapteyn


p=hpib.PROLOGIX_GPIB_USB()
sml=hpib.hpib_device(28,p)
smx=hpib.hpib_device(14,p)
esmc=hpib.hpib_device(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)