mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-10-18 21:42:36 +00:00
python: fix signal-type label when overriding the plotted channel range
apply_conf_defaults() picked the plotted signal-type label as signals[0].signal whenever --first-channel/--channels was passed explicitly to override the conf-derived channel range. signals[0] is just the first enabled signal in SIGNAL_ORDER for the given conf, so it is only correct when the manually requested range happens to start at channel 0 of that same signal; for any other range it mislabels every plot with the wrong signal type, even though the correct .dat files are read (since --file-prefix is typically also given explicitly in that case). For example, running --conf EVK1029_Galileo_E1_E5a.conf --file-prefix trk_GalileoE5a_ch \ --first-channel 10 --channels 10 correctly reads the Galileo E5a tracking dumps but titled every plot "Galileo E1B", the conf's first enabled signal. Resolve each requested channel's signal type from the conf's own per-signal channel ranges (SignalConfig.channels) instead, falling back to the previous behavior only when no conf is available at all. Signed-off-by: joebre <joel.brenner@saphyrion.ch>
This commit is contained in:
@@ -184,13 +184,28 @@ def apply_conf_defaults(args):
|
||||
if args.file_prefix is None:
|
||||
args.file_prefix = DEFAULT_FILE_PREFIX
|
||||
|
||||
manual_signal = args.signal_type or (
|
||||
manual_signal_fallback = args.signal_type or (
|
||||
signals[0].signal if signals else DEFAULT_SIGNAL_TYPE
|
||||
)
|
||||
|
||||
def signal_for_channel(channel):
|
||||
# An explicit --first-channel/--channels range overrides the conf's
|
||||
# auto-derived range, but the channel-to-signal mapping should still
|
||||
# come from the conf when possible: signals[0] (first enabled signal
|
||||
# in SIGNAL_ORDER) is not necessarily the signal actually occupying
|
||||
# this channel index once the range has been overridden manually.
|
||||
if args.signal_type is not None:
|
||||
return args.signal_type
|
||||
if conf is not None:
|
||||
for signal in conf.signals:
|
||||
if channel in signal.channels:
|
||||
return signal.signal
|
||||
return manual_signal_fallback
|
||||
|
||||
args.channel_plan = [
|
||||
ChannelDump(
|
||||
channel=channel,
|
||||
signal=manual_signal,
|
||||
signal=signal_for_channel(channel),
|
||||
file_prefix=args.file_prefix,
|
||||
)
|
||||
for channel in range(args.first_channel, args.first_channel + args.channels)
|
||||
|
||||
Reference in New Issue
Block a user