NanoVNA
NanoVNA copied to clipboard
Extra "0." in string returned from data() method
I have (infrequently) been getting exceptions when calling data() method. I added some debug logging:
def data(self, array = 0):
self.send_command("data %d\r" % array)
data = self.fetch_data()
x = []
for line in data.split('\n'):
if line:
try: # added try..catch block to debug
d = line.strip().split(' ')
x.append(float(d[0])+float(d[1])*1.j)
except Exception as e:
print(e)
print("line was " + line)
return np.array(x)
And when the problem occurs:
could not convert string to float: '0.0.1359530' line was 0.108219824 0.0.1359530