kopia lustrzana https://github.com/projecthorus/radiosonde_auto_rx
Add extra fields to logging output. Update plot_sonde_log to match log output.
rodzic
2bdae57774
commit
85c53d4483
|
@ -436,7 +436,7 @@ class SondeDecoder(object):
|
|||
|
||||
"""
|
||||
|
||||
self.log_info("Using experimental decoder chain.")
|
||||
self.log_info("Using fsk_demod decoder chain.")
|
||||
# Common options to rtl_fm
|
||||
|
||||
# Add a -T option if bias is enabled
|
||||
|
|
|
@ -101,6 +101,9 @@ def sonde_telemetry_to_sentence(telemetry, payload_callsign=None, comment=None):
|
|||
if (telemetry['bt'] != -1) and (telemetry['bt'] != 65535):
|
||||
_sentence += " BT %s" % time.strftime("%H:%M:%S", time.gmtime(telemetry['bt']))
|
||||
|
||||
if 'batt' in telemetry:
|
||||
_sentence += " %.1fV" % telemetry['batt']
|
||||
|
||||
# Add on any custom comment data if provided.
|
||||
if comment != None:
|
||||
comment = comment.replace(',','_')
|
||||
|
|
|
@ -38,7 +38,7 @@ class TelemetryLogger(object):
|
|||
# We require the following fields to be present in the input telemetry dict.
|
||||
REQUIRED_FIELDS = ['frame', 'id', 'datetime', 'lat', 'lon', 'alt', 'temp', 'humidity', 'type', 'freq', 'datetime_dt', 'vel_v', 'vel_h', 'heading']
|
||||
|
||||
LOG_HEADER = "timestamp,serial,frame,lat,lon,alt,vel_v,vel_h,heading,temp,humidity,type,freq,other\n"
|
||||
LOG_HEADER = "timestamp,serial,frame,lat,lon,alt,vel_v,vel_h,heading,temp,humidity,type,freq_mhz,snr,f_error_hz,sats,batt_v,burst_timer,aux_data\n"
|
||||
|
||||
def __init__(self,
|
||||
log_directory = "./log"):
|
||||
|
@ -136,25 +136,39 @@ class TelemetryLogger(object):
|
|||
|
||||
# Other fields that may not always be present.
|
||||
if 'snr' in telemetry:
|
||||
_log_line += ",SNR %.1f" % telemetry['snr']
|
||||
_log_line += ",%.1f" % telemetry['snr']
|
||||
else:
|
||||
_log_line += ",-99.0"
|
||||
|
||||
if 'f_error' in telemetry:
|
||||
_log_line += ",FERROR %d" % int(telemetry['f_error'])
|
||||
_log_line += ",%d" % int(telemetry['f_error'])
|
||||
else:
|
||||
_log_line += ",0"
|
||||
|
||||
if 'sats' in telemetry:
|
||||
_log_line += ",SATS %d" % telemetry['sats']
|
||||
_log_line += ",%d" % telemetry['sats']
|
||||
else:
|
||||
_log_line += ",-1"
|
||||
|
||||
if 'batt' in telemetry:
|
||||
_log_line += ",BATT %.1f" % telemetry['batt']
|
||||
_log_line += ",%.1f" % telemetry['batt']
|
||||
else:
|
||||
_log_line += ",-1"
|
||||
|
||||
# Check for Burst/Kill timer data, and add in.
|
||||
if 'bt' in telemetry:
|
||||
if (telemetry['bt'] != -1) and (telemetry['bt'] != 65535):
|
||||
_log_line += ",BT %s" % time.strftime("%H:%M:%S", time.gmtime(telemetry['bt']))
|
||||
_log_line += ",%s" % time.strftime("%H:%M:%S", time.gmtime(telemetry['bt']))
|
||||
else:
|
||||
_log_line += ",-1"
|
||||
else:
|
||||
_log_line += ",-1"
|
||||
|
||||
# Add Aux data, if it exists.
|
||||
if 'aux' in telemetry:
|
||||
_log_line += ",AUX %s" % telemetry['aux'].strip()
|
||||
_log_line += ",%s" % telemetry['aux'].strip()
|
||||
else:
|
||||
_log_line += ",-1"
|
||||
|
||||
|
||||
# Terminate the log line.
|
||||
|
|
|
@ -181,6 +181,9 @@ def read_log_file(filename, decimation=10, min_altitude=100):
|
|||
try:
|
||||
_fields = line.split(',')
|
||||
|
||||
# Log fields: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
||||
# "timestamp,serial,frame,lat,lon,alt,vel_v,vel_h,heading,temp,humidity,type,freq_mhz,snr,f_error_hz,sats,batt_v,burst_timer,aux_data\n"
|
||||
|
||||
# Attempt to parse the line
|
||||
_time = _fields[0]
|
||||
_lat = float(_fields[3])
|
||||
|
@ -188,15 +191,13 @@ def read_log_file(filename, decimation=10, min_altitude=100):
|
|||
_alt = float(_fields[5])
|
||||
_temp = float(_fields[9])
|
||||
_hum = float(_fields[10])
|
||||
|
||||
if 'SNR' in _fields[13]:
|
||||
_snr = float(_fields[13].split(' ')[1])
|
||||
else:
|
||||
_snr = -1.0
|
||||
|
||||
if 'FERROR' in _fields[13]:
|
||||
_ferror = float(_fields[11].split(' ')[1])
|
||||
else:
|
||||
try:
|
||||
# Attempt to extract SNR and frequency error fields.
|
||||
# These may not be present on older log files.
|
||||
_snr = float(_fields[13])
|
||||
_ferror = float(_fields[14])
|
||||
except:
|
||||
_snr = -99
|
||||
_ferror = 0.0
|
||||
|
||||
# Append data to arrays.
|
||||
|
|
Ładowanie…
Reference in New Issue