comm module¶
Communication interface between Open Ephys and Python using ZeroMQ for networking and JSON message format.
Sends periodic heartbeat signals to the server, uses collector.Collector
to store data received over network.
Heavily based on Francesco Battaglia’s sample implementation.
-
class
opeth.comm.
CommProcess
(dataport=5556, eventport=5557)¶ Bases:
object
ZMQ communication process - stores data, called periodically from GUI process.
-
context
¶ Networking context for ZeroMQ
Type: zmq.Context
-
dataport
¶ TCP port of Open Ephys plugin for data reception
Type: int
-
eventport
¶ TCP port of Open Ephys plugin for events
Type: int
-
data_socket
¶ ZMQ subscriber for incoming data
Type: zmq.SUB socket
-
event_socket
¶ ZMQ REQ interface
Type: zmq.SUB socket
-
collector
¶ Data storage
Type: collector.Collector
Parameters: - dataport (int) – Open Ephys ZMQ plugin’s data port, default: 5556
- eventport (int) – Open Ephys ZMQ plugin’s event port, default: 5557
-
add_data
(n_arr)¶ Append data to our data collector.
-
add_event
(event)¶ Add/update event or timestamp.
-
add_spike
(spike)¶ Add spikes. Currently not used.
-
connect
()¶ Initial connection to ZMQ plugin.
Starts polling the interfaces.
-
send_event
(event_list=None, event_type=3, sample_num=0, event_id=2, event_channel=1)¶ Note
Not used just for testing.
-
send_heartbeat
()¶ Send heartbeat message to the event port so the ZMQ plugin can list our client.
-
timer_callback
()¶ Called periodically from GUI to process network messages.
All the most important network processing happens here.
- Sends heartbeat messages every two seconds.
- Collects data.
- Processes incoming events.
-
uuid
= None¶ unique ID used in heartbeat
-