Compare commits

..

No commits in common. '3f0739f6ff6ca4220d355dc63f984ba5b2a7996b' and '5517ad06ee215f2a9732b29dd2f57865e933a5ce' have entirely different histories.

@ -1,94 +0,0 @@
map = [
(1,9),
(1,1),
(3,8),
(1,4),
(3,6),
(2,4),
(1,7),
(3,10),
(1,8),
(2,10),
(2,8),
(3,4),
(2,7),
(1,5),
(3,7),
(2,1),
(2,6),
(3,3),
(1,6),
(2,3),
(2,9),
(1,3),
(3,9),
(3,2),
(3,5),
(2,2),
(2,5),
(1,2),
(1,10),
(3,1),
(4,7),
(5,8),
(4,6),
(6,2),
(5,5),
(6,3),
(4,1),
(5,7),
(4,4),
(5,6),
(4,5),
(6,4),
(4,2),
(6,5),
(4,3),
(5,9),
(5,4),
(6,1),
(5,3),
(6,6),
(4,8),
(6,7),
(4,9),
(6,8),
(5,2),
(6,9),
(5,1),
(6,10),
(4,10),
(5,10),
(7,2),
(7,10),
(9,3),
(7,7),
(9,5),
(8,7),
(7,4),
(9,1),
(7,3),
(8,1),
(8,3),
(9,7),
(8,4),
(7,6),
(9,4),
(8,10),
(8,5),
(9,8),
(7,5),
(8,8),
(8,2),
(7,8),
(9,2),
(9,9),
(9,6),
(8,9),
(8,6),
(7,9),
(7,1),
(9,10)
]

@ -24,13 +24,10 @@ import socket
import struct import struct
import math import math
import time import time
import argparse
import numpy as np import numpy as np
from matplotlib import pyplot from matplotlib import pyplot
import channels
echoCmd = 0 echoCmd = 0
def instrConnect(mySocket, myAddress, myPort, timeOut, doReset, doIdQuery): def instrConnect(mySocket, myAddress, myPort, timeOut, doReset, doIdQuery):
@ -98,10 +95,105 @@ def diff_4W_mess(s, ch1, ch2):
return float(instrQuery(s, "print(dmm.measure())", 64)) return float(instrQuery(s, "print(dmm.measure())", 64))
def get_mapped(arr): def get_mapped(arr):
map = [
(1,9),
(1,1),
(3,8),
(1,4),
(3,6),
(2,4),
(1,7),
(3,10),
(1,8),
(2,10),
(2,8),
(3,4),
(2,7),
(1,5),
(3,7),
(2,1),
(2,6),
(3,3),
(1,6),
(2,3),
(2,9),
(1,3),
(3,9),
(3,2),
(3,5),
(2,2),
(2,5),
(1,2),
(1,10),
(3,1),
(4,7),
(5,8),
(4,6),
(6,2),
(5,5),
(6,3),
(4,1),
(5,7),
(4,4),
(5,6),
(4,5),
(6,4),
(4,2),
(6,5),
(4,3),
(5,9),
(5,4),
(6,1),
(5,3),
(6,6),
(4,8),
(6,7),
(4,9),
(6,8),
(5,2),
(6,9),
(5,1),
(6,10),
(4,10),
(5,10),
(7,2),
(7,10),
(9,3),
(7,7),
(9,5),
(8,7),
(7,4),
(9,1),
(7,3),
(8,1),
(8,3),
(9,7),
(8,4),
(7,6),
(9,4),
(8,10),
(8,5),
(9,8),
(7,5),
(8,8),
(8,2),
(7,8),
(9,2),
(9,9),
(9,6),
(8,9),
(8,6),
(7,9),
(7,1),
(9,10)
]
out = np.zeros(shape=(9, 10)) out = np.zeros(shape=(9, 10))
for i in range(0,90): for i in range(0,90):
x, y = channels.map[i] x, y = map[i]
out[x-1][y-1] = arr[i] out[x-1][y-1] = arr[i]
return out return out
@ -126,69 +218,49 @@ def done():
instrSend(s, "beeper.beep(0.150, 523)") instrSend(s, "beeper.beep(0.150, 523)")
instrSend(s, "beeper.beep(1.000, 440)") instrSend(s, "beeper.beep(1.000, 440)")
def calc_vector(x, y, arr):
pass
""" ============================================================================================================== """ ==============================================================================================================
MAIN CODE STARTS HERE MAIN CODE STARTS HERE
============================================================================================================== """ ============================================================================================================== """
ip_address = "192.168.0.53" # Place your instrument's IP address here.
my_port = 5025
parser = argparse.ArgumentParser() output_data_path = time.strftime("data_%Y-%m-%d_%H-%M-%S.csv") # This is the output file that is created which
parser.add_argument('-fromfile') # will hold your readings provided in ASCII
parser.add_argument('-tofile') # format in a text file.
parser.add_argument('-ip', default="192.168.0.53")
parser.add_argument('-port', default=5025)
args = parser.parse_args()
ip_address = args.ip
port = args.port
print(ip_address) s = socket.socket() # Establish a TCP/IP socket object
# Open the socket connection
# reserve space for matrixes instrConnect(s, ip_address, my_port, 20000, 0, 0)
full_matrix = np.zeros(shape=(90, 90))
point_specific_matrix = np.zeros(shape=(9, 10))
pyplot.ion()
fig, ax = pyplot.subplots()
axim = ax.imshow(full_matrix, interpolation='nearest', cmap='gray', vmin=0, vmax=30)
t1 = time.time() # Start the timer... t1 = time.time() # Start the timer...
if args.fromfile: Configure_Backplane(s)
#TODO check bounds of imported matrix
full_matrix = np.genfromtxt(args.fromfile, delimiter='\t')
for row in full_matrix:
point_specific_matrix=get_mapped(row)
axim.set_data(point_specific_matrix)
fig.canvas.flush_events()
else:
s = socket.socket() # Establish a TCP/IP socket object
instrConnect(s, ip_address, port, 20000, 0, 0)
Configure_Backplane(s)
x = 0 a = np.zeros(shape=(90, 90))
y = 0 b = np.zeros(shape=(9, 10))
print()
for ch1 in [*range(1001, 1031)] + [*range(2001, 2031)] + [*range(3001, 3031)]:
for ch2 in [*range(1031, 1061)] + [*range(2031, 2061)] + [*range(3031, 3061)]:
full_matrix[x][y]=diff_4W_mess(s, ch1, ch2)
point_specific_matrix=get_mapped(full_matrix[x])
axim.set_data(point_specific_matrix)
fig.canvas.flush_events()
y+=1
y=0
x+=1
done() pyplot.ion()
fig, ax = pyplot.subplots()
# Close the socket connection axim = ax.imshow(a, interpolation='nearest', cmap='gray', vmin=0, vmax=30)
instrDisconnect(s)
if args.tofile: x = 0
np.savetxt(args.tofile, full_matrix, delimiter="\t") y = 0
print()
for ch1 in [*range(1001, 1031)] + [*range(2001, 2031)] + [*range(3001, 3031)]:
for ch2 in [*range(1031, 1061)] + [*range(2031, 2061)] + [*range(3031, 3061)]:
a[x][y]=diff_4W_mess(s, ch1, ch2)
b=get_mapped(a[x])
axim.set_data(b)
fig.canvas.flush_events()
y+=1
y=0
x+=1
done();
# Close the socket connection
instrDisconnect(s)
t2 = time.time() t2 = time.time()
# Notify the user of completion and the data streaming rate achieved. # Notify the user of completion and the data streaming rate achieved.

Loading…
Cancel
Save