-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/open-ephys/GUI
- Loading branch information
Showing
28 changed files
with
501 additions
and
51 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
""" | ||
A zmq client to test remote control of open-ephys GUI | ||
""" | ||
|
||
import zmq | ||
import os | ||
import time | ||
|
||
|
||
def run_client(): | ||
|
||
# Basic start/stop commands | ||
start_cmd = 'StartRecord' | ||
stop_cmd = 'StopRecord' | ||
|
||
# Example settings | ||
rec_dir = os.path.join(os.getcwd(), 'Output_RecordControl') | ||
print "Saving data to:", rec_dir | ||
|
||
# Some commands | ||
commands = [start_cmd + ' RecDir=%s' % rec_dir, | ||
start_cmd + ' PrependText=Session01 AppendText=Condition01', | ||
start_cmd + ' PrependText=Session01 AppendText=Condition02', | ||
start_cmd + ' PrependText=Session02 AppendText=Condition01', | ||
start_cmd, | ||
start_cmd + ' CreateNewDir=1'] | ||
|
||
# Connect network handler | ||
ip = '127.0.0.1' | ||
port = 5556 | ||
timeout = 1. | ||
|
||
url = "tcp://%s:%d" % (ip, port) | ||
|
||
with zmq.Context() as context: | ||
with context.socket(zmq.REQ) as socket: | ||
socket.RCVTIMEO = int(timeout * 1000) # timeout in milliseconds | ||
socket.connect(url) | ||
|
||
# Finally, start data acquisition | ||
socket.send('StartAcquisition') | ||
answer = socket.recv() | ||
print answer | ||
time.sleep(5) | ||
|
||
for start_cmd in commands: | ||
|
||
for cmd in [start_cmd, stop_cmd]: | ||
socket.send(cmd) | ||
answer = socket.recv() | ||
print answer | ||
|
||
if 'StartRecord' in cmd: | ||
# Record data for 5 seconds | ||
time.sleep(5) | ||
else: | ||
# Stop for 1 second | ||
time.sleep(1) | ||
|
||
# Finally, stop data acquisition; it might be a good idea to | ||
# wait a little bit until all data have been written to hard drive | ||
time.sleep(0.5) | ||
socket.send('StopAcquisition') | ||
answer = socket.recv() | ||
print answer | ||
|
||
|
||
if __name__ == '__main__': | ||
run_client() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.