-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleMagnetClient.py
executable file
·61 lines (42 loc) · 1.26 KB
/
SimpleMagnetClient.py
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
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Sub programs for doing the measurements
author : Eoin O'Farrell
email : phyoec@nus.edu.sg
last edited : July 2013
Explantion:
There are 3 variables in our instrument:
1 Temperature
2 Field
3 Device parameter; e.g. Backgate V, Topgate V, Current, Angle (one day)
Typically a measurement will fix two of these and vary the other.
The controls for temperature and field are controlled by external
services that can be called by the measurement. The measurement
invokes a localhost for each of these services and can then
access certain methods
The generic ports for these are
Magnet: 18861
Temperature: 18871
Data from these processes can also be accessed through named pipes
Device parameters are so far controlled in situ in the measurement
loop. This should probably also be changed to be consistent
ToDo:
InitializeInstruments
ScanInstruments
InitializeDataFile
WriteDataFile
CloseDataFile
GraphData
"""
import time
import asyncore
import SocketUtils as SocketUtils
TClient = SocketUtils.SockClient('localhost', 18871)
while 1:
for i in range(8):
asyncore.loop(count=1,timeout=0.001)
TString = TClient.received_data
print TString
time.sleep(2)
time.sleep(8)