-
Notifications
You must be signed in to change notification settings - Fork 0
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.itap.purdue.edu/hoodlabpurdue…
- Loading branch information
Showing
28 changed files
with
866 additions
and
174 deletions.
There are no files selected for viewing
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,71 @@ | ||
import socket | ||
import sys | ||
import subprocess | ||
|
||
# Example command: python AWGCommand.py start 140 | ||
|
||
server_ip = "192.168.1.179" | ||
server_port = 5080 | ||
|
||
arg_message = sys.argv[1] | ||
|
||
if len(sys.argv)>2: | ||
data = sys.argv[2] | ||
else: | ||
data = '140' | ||
|
||
freq_add = '2;'+data | ||
freq_drop = '14;'+data | ||
channel0 = '12;0' | ||
channel1 = '12;1' | ||
|
||
if arg_message == '1chan_freq': # Set channel0 to freq MHz, channel1 is off (only works if AWG.ini is configured T,F,F,F) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(channel0, "utf-8"), (server_ip, server_port)) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(freq_add, "utf-8"), (server_ip, server_port)) | ||
|
||
elif arg_message == '2chan_freq': # Set channel1 to freq MHz, channel1 is freq MHz (only works if AWG.ini is configured T,T,F,F) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(channel0, "utf-8"), (server_ip, server_port)) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(freq_add, "utf-8"), (server_ip, server_port)) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(channel1, "utf-8"), (server_ip, server_port)) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(freq_add, "utf-8"), (server_ip, server_port)) | ||
|
||
elif arg_message == 'start': # Start server | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('6', "utf-8"), (server_ip, server_port)) | ||
|
||
elif arg_message == 'stop': # Stop server | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('7', "utf-8"), (server_ip, server_port)) | ||
|
||
elif arg_message == 'bootup': # Kill server | ||
try: | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('1', "utf-8"), (server_ip, server_port)) # Kills any running instance of server | ||
subprocess.check_output('ssh awglics@192.168.1.179 ". run_server.sh"') # Starts new server | ||
except: | ||
subprocess.check_output('ssh awglics@192.168.1.179 ". run_server.sh"') # Starts new server | ||
|
||
elif arg_message == 'kill': # Kill server | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('1', "utf-8"), (server_ip, server_port)) | ||
|
||
elif arg_message == 'sweep': # Give it array of good values AND total number of roi's. e.g. if out of 6 atoms, [0,1,4] are bad, give it the command 'python AWGCommand.py sweep 6;2;3;5' | ||
data_arr = data.split(';') | ||
message = '13' | ||
roi_correction = 0 | ||
for i in range(1,len(data_arr)): | ||
message += ';'+str(int(data_arr[i]) - roi_correction)+';'+str(i-1) | ||
roi_correction += 1 | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(message, "utf-8"), (server_ip, server_port)) | ||
|
||
else: | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(arg_message, "utf-8"), (server_ip, server_port)) | ||
|
||
############ For reference: ############ | ||
|
||
# EXIT: 1 | ||
# FREQ: 2 | ||
# ADD: 3 | ||
# MODIFY: 4 | ||
# START: 6 | ||
# STOP: 7 | ||
# CHAN: 12 | ||
# SWEEP: 13 | ||
# DUMP: 14 | ||
# RESTORE 15 |
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,57 @@ | ||
import socket | ||
import sys | ||
import subprocess | ||
|
||
arg_message = sys.argv[1] | ||
|
||
if len(sys.argv)>2: | ||
freq = sys.argv[2] | ||
else: | ||
freq = '140' | ||
|
||
freq_add = '2;'+freq | ||
freq_drop = '14;'+freq | ||
channel0 = '12;0' | ||
channel1 = '12;1' | ||
|
||
if arg_message == '1chan_start': # Set channel0 to freq MHz, channel1 is off (only works if AWG.ini is configured T,F,F,F) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(channel0, "utf-8"), ("192.168.1.179", 5080)) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(freq_add, "utf-8"), ("192.168.1.179", 5080)) | ||
|
||
elif arg_message == '2chan_start': # Set channel0 to freq MHz, channel1 is freq MHz | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(channel0, "utf-8"), ("192.168.1.179", 5080)) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(freq_add, "utf-8"), ("192.168.1.179", 5080)) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(channel1, "utf-8"), ("192.168.1.179", 5080)) | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(freq_add, "utf-8"), ("192.168.1.179", 5080)) | ||
|
||
elif arg_message == 'start': # Start server | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('6', "utf-8"), ("192.168.1.179", 5080)) | ||
|
||
elif arg_message == 'stop': # Stop server | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('7', "utf-8"), ("192.168.1.179", 5080)) | ||
|
||
elif arg_message == 'bootup': # Kill server | ||
try: | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('1', "utf-8"), ("192.168.1.179", 5080)) # Kills any running instance of server | ||
subprocess.check_output('ssh awglics@192.168.1.179 ". run_server.sh"') # Starts new server | ||
except: | ||
subprocess.check_output('ssh awglics@192.168.1.179 ". run_server.sh"') # Starts new server | ||
|
||
elif arg_message == 'kill': # Kill server | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('1', "utf-8"), ("192.168.1.179", 5080)) | ||
|
||
else: | ||
socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes(arg_message, "utf-8"), ("192.168.1.179", 5080)) | ||
|
||
############ For reference: ############ | ||
|
||
# EXIT: 1 | ||
# FREQ: 2 | ||
# ADD: 3 | ||
# MODIFY: 4 | ||
# START: 6 | ||
# STOP: 7 | ||
# CHAN: 12 | ||
# SWEEP: 13 | ||
# DUMP: 14 | ||
# RESTORE 15 |
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,28 @@ | ||
import socket | ||
import sys | ||
import subprocess | ||
import time | ||
|
||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP | ||
sock.sendto(bytes('12;0', "utf-8"), ("192.168.1.179", 5080)) | ||
sock.sendto(bytes('2;120', "utf-8"), ("192.168.1.179", 5080)) | ||
sock.sendto(bytes('6', "utf-8"), ("192.168.1.179", 5080)) | ||
|
||
# socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('12;0', "utf-8"), ("192.168.1.179", 5080)) | ||
# time.sleep(1) | ||
# socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('2;120', "utf-8"), ("192.168.1.179", 5080)) | ||
# time.sleep(1) | ||
# socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(bytes('6', "utf-8"), ("192.168.1.179", 5080)) | ||
# time.sleep(1) | ||
############ For reference: ############ | ||
|
||
# EXIT: 1 | ||
# FREQ: 2 | ||
# ADD: 3 | ||
# MODIFY: 4 | ||
# START: 6 | ||
# STOP: 7 | ||
# CHAN: 12 | ||
# SWEEP: 13 | ||
# DUMP: 14 | ||
# RESTORE 15 |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
Metadata-Version: 1.0 | ||
Metadata-Version: 2.1 | ||
Name: andor | ||
Version: 0.0.0 | ||
Summary: UNKNOWN | ||
Home-page: UNKNOWN | ||
Author: UNKNOWN | ||
Author-email: UNKNOWN | ||
License: UNKNOWN | ||
Description: UNKNOWN | ||
Platform: UNKNOWN | ||
|
||
UNKNOWN | ||
|
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.