It is a well known issue that our framebuilder is running slowly relative to our "real" time. However, we are physicists, so this is not entirely unprecedented. I have calculated that for every second we experience, the framebuilder experinces 0.89285 seconds, which means that fb4 must be travelling at 45% the speed of light.
However, despite the inevitable logistical issues associated with fb4 being used as a high energy experiment, it still stores valuable data for us in the CTN Lab. We would like to be able to access this data via python robustly, even if our times do not sync up. We can just get the time that fb4 thinks it is directly off of it.
First, we need direct access between ws1 and fb4 with no password. I followed the instructions from this site, and it worked. V easy.
Next, we need to use python to run an ssh command "caget -t -f10 C4:DAQ-DC0_GPS", where C4:DAQ-DC0_GPS is the channel representing the gpstime fb4 thinks it is. Followed the directions from this stackoverflow response on ws1. Boom. Code copied below for clarity.
In [1]: import subprocess
In [2]: import sys
In [3]: HOST="controls@10.0.1.156"
In [4]: COMMAND="caget -t -f10 C4:DAQ-DC0_GPS"
In [5]: ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],
...: shell=False,
...: stdout=subprocess.PIPE,
...: stderr=subprocess.PIPE)
In [6]: result = ssh.stdout.readlines()
In [7]: print result
['1205175551.0000000000\n']
In [11]: fb4gps = float(result[0].strip('\n'))
In [12]: fb4gps
Out[12]: 1205175551.0
Now we have the time that fb4 thinks it is. Finally we have to make sure we can plot data from fb4 using that gpstime. Following the directions from my old elog:
In [8]: import nds2
In [14]: from pylab import *
In [15]: ion()
In [13]: c = nds2.connection('10.0.1.156', 8088)
In [17]: chanName = 'C3:PSL-SCAV_FSS_SLOWOUT'
In [26]: fb4gps = int(fb4gps)
In [32]: data = c.fetch(fb4gps-60, fb4gps, [chanName])
In [33]: plot(data[0].data)
Out[33]: [<matplotlib.lines.Line2D at 0x7ff3c20431d0>]
This should display interactively the latest data from our south slow volt controller, no matter what time fb4 thinks it is. |