-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathegi_netstation.py
46 lines (27 loc) · 1.04 KB
/
egi_netstation.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
#!/usr/bin/env python
"""This demo comes from the simple_distilled example provided with pynetstation.
Note that egi pynetstation can also be used in a multi-threaded form.
See the pynetstation documentation for further information.
"""
# >>> import and initialization >>>
import egi.simple as egi
## import egi.threaded as egi
# ms_localtime = egi.egi_internal.ms_localtime
ms_localtime = egi.ms_localtime
ns = egi.Netstation()
ns.connect('11.0.0.42', 55513) # sample address and port -- change according to your network settings
## ns.initialize('11.0.0.42', 55513)
ns.BeginSession()
ns.sync()
ns.StartRecording()
# >>> send many events here >>>
## # optionally can perform additional synchronization
## ns.sync()
ns.send_event( 'evt_', label="event", timestamp=egi.ms_localtime(), table = {'fld1' : 123, 'fld2' : "abc", 'fld3' : 0.042} )
# >>> we have sent all we wanted, time to go home >>>
ns.StopRecording()
ns.EndSession()
ns.disconnect()
## ns.EndSession()
## ns.finalize()
# >>> that's it !