Is it still possible to run this in 2020 to test the different gain values? I’ve tried and just get errors.
pi@piaware:~ $ #!/usr/bin/python2
pi@piaware:~ $ import time, socket, subprocess, fileinput, os
-bash: import: command not found
else:
print line,
os.system(“sudo systemctl restart dump1090-fa”)
time.sleep(2)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((‘localhost’,30003))
t = time.time()
d = ‘’
while 1:
d += s.recv(32)
if time.time() - t > measure_duration:
break
s.close()
messages = 0
positions = 0
planes = {}
pi@piaware:~ $
for l in d.split(‘\n’):
a = l.split(‘,’)
messages += 1
if len(a) > 4:
if a[1] == ‘3’:
positions += 1
planes[a[4]] = 1
print “gain=”,g, “messages=”, messages, “positions=”, positions, “planes=”, len(planes.keys())
results[g][0] += messages
results[g][1] += positions
for hex in planes.keys():
results[g][2][hex] = 1
print “\n===Totals===”
print “Gain, Messages, Positions, Aircraft”
for g in gains:
(messages,positions,planes) = results[g]
pi@piaware:~ $ measure_duration = 62 #duration of one pass, seconds
-bash: measure_duration: command not found
print g, messages, positions, len(planes.keys())
pi@piaware:~ $ ntests = 5 #number of tests
-bash: ntests: command not found
pi@piaware:~ $ gains = “20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6”.split()
-bash: syntax error near unexpected token `(’
pi@piaware:~ $ #gains = “20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4”.split()
pi@piaware:~ $ #gains = “36.4 38.6 40.2 42.1 44.5 48.0 49.6”.split()
pi@piaware:~ $
pi@piaware:~ $ gains.reverse()
results = {}
-bash: syntax error near unexpected token results' pi@piaware:~ $ pi@piaware:~ $ for i in range(ntests): -bash: syntax error near unexpected token
(’
pi@piaware:~ $ print “test”, i+1, “of”, ntests
Error: no such file “test,”
Error: no such file “i+1,”
Error: no such file “of,”
Error: no such file “ntests”
pi@piaware:~ $ for g in gains:
if g not in results:
-bash: syntax error near unexpected token if' pi@piaware:~ $ results[g] = [0,0,{}] #msgs, positions, aircraft -bash: results[g]: command not found pi@piaware:~ $ pi@piaware:~ $ for line in fileinput.input('/etc/default/dump1090-fa', inplace=1): -bash: syntax error near unexpected token
(’
pi@piaware:~ $ if line.startswith(‘RECEIVER_OPTIONS’):
-bash: syntax error near unexpected token 'RECEIVER_OPTIONS'' pi@piaware:~ $ print 'RECEIVER_OPTIONS="--device-index 0 --ppm 0 --gain ' + g + ' --net-bo-port 30005 --net-sbs-port 30003"' Error: no such file "RECEIVER_OPTIONS="--device-index 0 --ppm 0 --gain " Error: no such file "+" Error: no such file "g" Error: no such file "+" Error: no such file " --net-bo-port 30005 --net-sbs-port 30003"" pi@piaware:~ $ else: -bash: else:: command not found pi@piaware:~ $ print line, Error: no such file "line," pi@piaware:~ $ os.system("sudo systemctl restart dump1090-fa") -bash: syntax error near unexpected token
“sudo systemctl restart dump1090-fa”’
pi@piaware:~ $ time.sleep(2)
-bash: syntax error near unexpected token 2' pi@piaware:~ $ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -bash: syntax error near unexpected token
(’
pi@piaware:~ $ s.connect((‘localhost’,30003))
-bash: syntax error near unexpected token (' pi@piaware:~ $ t = time.time() -bash: syntax error near unexpected token
(’
pi@piaware:~ $ d = ‘’
-bash: d: command not found
pi@piaware:~ $ while 1:
d += s.recv(32)
-bash: syntax error near unexpected token (' pi@piaware:~ $ if time.time() - t > measure_duration: -bash: syntax error near unexpected token
-’
pi@piaware:~ $ break
-bash: break: only meaningful in a for',
while’, or until' loop pi@piaware:~ $ s.close() messages = 0 -bash: syntax error near unexpected token
messages’
pi@piaware:~ $ positions = 0
-bash: positions: command not found
pi@piaware:~ $ planes = {}
-bash: planes: command not found
pi@piaware:~ $ for l in d.split(‘\n’):
-bash: syntax error near unexpected token (' pi@piaware:~ $ a = l.split(',') -bash: syntax error near unexpected token
(’
pi@piaware:~ $ messages += 1
-bash: messages: command not found
pi@piaware:~ $ if len(a) > 4:
-bash: syntax error near unexpected token a' pi@piaware:~ $ if a[1] == '3': positions += 1 planes[a[4]] = 1 print "gain=",g, "messages=", messages, "positions=", positions, "planes=", len(planes.keys()) -bash: syntax error near unexpected token
(’
pi@piaware:~ $ results[g][0] += messages
-bash: results[g][0]: command not found
pi@piaware:~ $ results[g][1] += positions
-bash: results[g][1]: command not found
pi@piaware:~ $ for hex in planes.keys():
-bash: syntax error near unexpected token (' pi@piaware:~ $ results[g][2][hex] = 1 -bash: results[g][2][hex]: command not found pi@piaware:~ $ pi@piaware:~ $ print "\n===Totals===" Error: no such file "\n===Totals===" pi@piaware:~ $ print "Gain, Messages, Positions, Aircraft" Error: no such file "Gain, Messages, Positions, Aircraft" pi@piaware:~ $ for g in gains: (messages,positions,planes) = results[g] -bash: syntax error near unexpected token
(’
pi@piaware:~ $ print g, messages, positions, len(planes.keys())
-bash: syntax error near unexpected token `(’