Skip to content

Commit

Permalink
Move detection and decode iq/audio recordings to the log directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Jessop authored and Mark Jessop committed Aug 6, 2023
1 parent fb72588 commit 79815c8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion auto_rx/autorx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus.
# PATCH - Small changes, or minor feature additions.

__version__ = "1.6.2"
__version__ = "1.6.3-beta1"


# Global Variables
Expand Down
45 changes: 24 additions & 21 deletions auto_rx/autorx/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ def __init__(
else:
self.raw_file_option = ""

self.save_decode_iq_path = os.path.join(autorx.logging_path, f"decode_IQ_{self.sonde_freq}_{self.sonde_type}_{str(self.rtl_device_idx)}.raw")
self.save_decode_audio_path = os.path.join(autorx.logging_path, f"decode_audio_{self.sonde_freq}_{self.sonde_type}_{str(self.rtl_device_idx)}.wav")

# iMet ID store. We latch in the first iMet ID we calculate, to avoid issues with iMet-1-RS units
# which don't necessarily have a consistent packet count to time increment ratio.
# This is a tradeoff between being able to handle multiple iMet sondes on a single frequency, and
Expand Down Expand Up @@ -384,7 +387,7 @@ def generate_decoder_command(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_audio:
decode_cmd += " tee decode_%s.wav |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_audio_path} |"

decode_cmd += "./rs41mod --ptu2 --json 2>/dev/null"

Expand Down Expand Up @@ -450,7 +453,7 @@ def generate_decoder_command(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_audio:
decode_cmd += " tee decode_%s.wav |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_audio_path} |"

decode_cmd += (
"./rs92mod -vx -v --crc --ecc --vel --json %s %s 2>/dev/null"
Expand Down Expand Up @@ -483,7 +486,7 @@ def generate_decoder_command(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_audio:
decode_cmd += " tee decode_%s.wav |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_audio_path} |"

# DFM decoder
decode_cmd += "./dfm09mod -vv --ecc --json --dist --auto 2>/dev/null"
Expand All @@ -510,7 +513,7 @@ def generate_decoder_command(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_audio:
decode_cmd += " tee decode_%s.wav |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_audio_path} |"

# M10 decoder
decode_cmd += "./m10mod --json --ptu -vvv 2>/dev/null"
Expand All @@ -535,7 +538,7 @@ def generate_decoder_command(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_iq:
decode_cmd += " tee decode_%s.raw |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_iq_path} |"

# iMet-4 (IMET1RS) decoder
decode_cmd += f"./imet4iq --iq 0.0 --lpIQ --dc - {_sample_rate} 16 --json 2>/dev/null"
Expand All @@ -560,7 +563,7 @@ def generate_decoder_command(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_iq:
decode_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_iq_path} |"

# iMet-54 Decoder
decode_cmd += (
Expand All @@ -587,7 +590,7 @@ def generate_decoder_command(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_iq:
decode_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_iq_path} |"

# MRZ decoder
#decode_cmd += "./mp3h1mod --auto --json --ptu 2>/dev/null"
Expand Down Expand Up @@ -624,7 +627,7 @@ def generate_decoder_command(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_iq:
decode_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_iq_path} |"

# LMS6-1680 decoder
decode_cmd += f"./mk2a1680mod --iq 0.0 --lpIQ --lpbw 160 --decFM --dc --crc --json {self.raw_file_option} - 240000 16 2>/dev/null"
Expand Down Expand Up @@ -661,7 +664,7 @@ def generate_decoder_command(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_audio:
decode_cmd += " tee decode_%s.wav |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_audio_path} |"

decode_cmd += "./lms6Xmod --json 2>/dev/null"

Expand All @@ -685,7 +688,7 @@ def generate_decoder_command(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
decode_cmd += " tee decode_%s.raw |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_iq_path} |"

# Meisei Decoder, in IQ input mode
decode_cmd += f"./meisei100mod --IQ 0.0 --lpIQ --dc - {_sample_rate} 16 --json --ptu --ecc 2>/dev/null"
Expand All @@ -710,7 +713,7 @@ def generate_decoder_command(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
decode_cmd += " tee decode_%s.raw |" % str(self.rtl_device_idx)
decode_cmd += f" tee {self.save_decode_iq_path} |"

# Meteosis MTS01 decoder
decode_cmd += f"./mts01mod --json --IQ 0.0 --lpIQ --dc - {_sample_rate} 16 2>/dev/null"
Expand Down Expand Up @@ -774,7 +777,7 @@ def generate_decoder_command_experimental(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --stats=%d 2 %d %d - -" % (
_lower,
Expand Down Expand Up @@ -849,7 +852,7 @@ def generate_decoder_command_experimental(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --stats=%d 2 %d %d - -" % (
_lower,
Expand Down Expand Up @@ -900,7 +903,7 @@ def generate_decoder_command_experimental(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --stats=%d 2 %d %d - -" % (
_lower,
Expand Down Expand Up @@ -952,7 +955,7 @@ def generate_decoder_command_experimental(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += (
"./fsk_demod --cs16 -b %d -u %d -s -p %d --stats=%d 2 %d %d - -"
Expand Down Expand Up @@ -994,7 +997,7 @@ def generate_decoder_command_experimental(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += (
"./fsk_demod --cs16 -b %d -u %d -s -p %d --stats=%d 2 %d %d - -"
Expand Down Expand Up @@ -1034,7 +1037,7 @@ def generate_decoder_command_experimental(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --stats=%d 2 %d %d - -" % (
_lower,
Expand Down Expand Up @@ -1075,7 +1078,7 @@ def generate_decoder_command_experimental(self):
)
# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --stats=%d 2 %d %d - -" % (
_lower,
Expand Down Expand Up @@ -1117,7 +1120,7 @@ def generate_decoder_command_experimental(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += "./fsk_demod --cs16 -s -b %d -u %d --stats=%d 2 %d %d - -" % (
_lower,
Expand Down Expand Up @@ -1163,7 +1166,7 @@ def generate_decoder_command_experimental(self):

# Add in tee command to save audio to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

# LMS6-1680 decoder
demod_cmd += f"./mk2a1680mod --iq 0.0 --lpIQ --lpbw 160 --lpFM --dc --crc --json {self.raw_file_option} - 220000 16 2>/dev/null"
Expand Down Expand Up @@ -1204,7 +1207,7 @@ def generate_decoder_command_experimental(self):

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx)
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += "./fsk_demod --cs16 -s -b %d -u %d --stats=%d 2 %d %d - -" % (
_lower,
Expand Down
7 changes: 5 additions & 2 deletions auto_rx/autorx/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Copyright (C) 2018 Mark Jessop <vk5qi@rfhead.net>
# Released under GNU GPL v3 or later
#
import autorx
import datetime
import logging
import numpy as np
Expand Down Expand Up @@ -340,7 +341,8 @@ def detect_sonde(
# )
# Saving of Debug audio, if enabled,
if save_detection_audio:
rx_test_command += "tee detect_%s.raw | " % str(rtl_device_idx)
detect_iq_path = os.path.join(autorx.logging_path, f"detect_IQ_{frequency}_{str(rtl_device_idx)}.raw")
rx_test_command += f" tee {detect_iq_path} |"

rx_test_command += os.path.join(
rs_path, "dft_detect"
Expand Down Expand Up @@ -395,7 +397,8 @@ def detect_sonde(

# Saving of Debug audio, if enabled,
if save_detection_audio:
rx_test_command += "tee detect_%s.wav | " % str(rtl_device_idx)
detect_audio_path = os.path.join(autorx.logging_path, f"detect_audio_{frequency}_{str(rtl_device_idx)}.wav")
rx_test_command += f" tee {detect_audio_path} |"

# Sample decoding / detection
# Note that we detect for dwell_time seconds, and timeout after dwell_time*2, to catch if no samples are being passed through.
Expand Down

0 comments on commit 79815c8

Please sign in to comment.