forked from PNL-MasonYu/WHAM_Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoGuiVersion2.py
More file actions
58 lines (37 loc) · 1.36 KB
/
noGuiVersion2.py
File metadata and controls
58 lines (37 loc) · 1.36 KB
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
# %%
#from MDSplus import * #Connection
from WhamRedPitaya import WhamRedPitaya
from WhamRedPitaya import WhamRedPitayaGroup
import numpy as np
from datetime import datetime
# Create fake data
cycles_1 = 1000 # how many sine cycles
resolution_1 = 2.5e6 # how many datapoints to generate
length_1 = np.pi * 2 * cycles_1
data_in_1 = np.sin(np.arange(0, length_1, length_1 / resolution_1))
# MDSplus node to write data to
DEVICE_NODE = "ECH:ECH_RAW:RP_1"
DEVICE_TREE = "ECH.ECH_RAW"
MDSPLUS_SERVER = "andrew.psl.wisc.edu"
MDSPLUS_TREE = "wham"
IP_LIST = [
("192.168.0.150", 5000),
("192.168.0.151", 5000)
]
#rpg = WhamRedPitayaGroup(num_device=2, ip_list=IP_LIST, device_tree=DEVICE_TREE, mdsplus_server=MDSPLUS_SERVER, mdsplus_tree=MDSPLUS_TREE)
rp = WhamRedPitaya(ip="192.168.0.150", port=5000, device_node=DEVICE_NODE, mdsplus_server=MDSPLUS_SERVER, mdsplus_tree=MDSPLUS_TREE)
# Change any settings here
rp.mdsplus_server = MDSPLUS_SERVER # server running mdsplus
rp.mdsplus_tree = MDSPLUS_TREE # name of top mdsplus tree (should always be "wham")
# Attempt to establish connection to the RP
#rp.connect()
# Configure the RP device
#rp.configure()
# Set the trigger on the RP and wait for data.
#rp.arm()
rp.data_in = data_in_1
rp.ip = str(datetime.now())
print(rp.data_in[1000])
print(data_in_1[1000])
# Store the data to MDSplus. plots, HDF5, etc...
rp.store()