def start_decoder(freq: float, sonde_type: str) -> None: """ Attempt to start a decoder thread for a given sonde. Args: freq (float): Radiosonde frequency in Hz. sonde_type (str): The radiosonde type ('RS41', 'RS92', 'DFM', 'M10, 'iMet') """ global config, RS_PATH, exporter_functions, rs92_ephemeris, temporary_block_list # Allocate a SDR. _device_idx = allocate_sdr( task_description="Decoder ({0}, {0.3f} MHz)".format( sonde_type, freq / 1e6)) if _device_idx is None: logging.error("Could not allocate SDR for decoder!") return else: # Add an entry to the task list autorx.task_list[freq] = {"device_idx": _device_idx, "task": None} # Set the SDR to in-use autorx.sdr_list[_device_idx]["in_use"] = True if sonde_type.startswith("-"): _exp_sonde_type = sonde_type[1:] else: _exp_sonde_type = sonde_type # Initialise a decoder. autorx.task_list[freq]["task"] = SondeDecoder( sonde_type=sonde_type, sonde_freq=freq, rs_path=RS_PATH, sdr_fm=config["sdr_fm"], device_idx=_device_idx, gain=autorx.sdr_list[_device_idx]["gain"], ppm=autorx.sdr_list[_device_idx]["ppm"], bias=autorx.sdr_list[_device_idx]["bias"], save_decode_audio=config["save_decode_audio"], save_decode_iq=config["save_decode_iq"], exporter=exporter_functions, timeout=config["rx_timeout"], telem_filter=telemetry_filter, rs92_ephemeris=rs92_ephemeris, imet_location=config["station_code"], rs41_drift_tweak=config["rs41_drift_tweak"], experimental_decoder=config["experimental_decoders"] [_exp_sonde_type], ) autorx.sdr_list[_device_idx]["task"] = autorx.task_list[freq]["task"] # Indicate to the web client that the task list has been updated. flask_emit_event("task_event")
def start_decoder(freq, sonde_type): """ Attempt to start a decoder thread for a given sonde. Args: freq (float): Radiosonde frequency in Hz. sonde_type (str): The radiosonde type ('RS41', 'RS92', 'DFM', 'M10, 'iMet') """ global config, RS_PATH, exporter_functions, rs92_ephemeris, temporary_block_list # Allocate a SDR. _device_idx = allocate_sdr(task_description="Decoder (%s, %.3f MHz)" % (sonde_type, freq / 1e6)) if _device_idx is None: logging.error("Could not allocate SDR for decoder!") return else: # Add an entry to the task list autorx.task_list[freq] = {'device_idx': _device_idx, 'task': None} # Set the SDR to in-use autorx.sdr_list[_device_idx]['in_use'] = True if sonde_type.startswith('-'): _exp_sonde_type = sonde_type[1:] else: _exp_sonde_type = sonde_type # Initialise a decoder. autorx.task_list[freq]['task'] = SondeDecoder( sonde_type=sonde_type, sonde_freq=freq, rs_path=RS_PATH, sdr_fm=config['sdr_fm'], device_idx=_device_idx, gain=autorx.sdr_list[_device_idx]['gain'], ppm=autorx.sdr_list[_device_idx]['ppm'], bias=autorx.sdr_list[_device_idx]['bias'], save_decode_audio=config['save_decode_audio'], save_decode_iq=config['save_decode_iq'], exporter=exporter_functions, timeout=config['rx_timeout'], telem_filter=telemetry_filter, rs92_ephemeris=rs92_ephemeris, imet_location=config['station_code'], rs41_drift_tweak=config['rs41_drift_tweak'], experimental_decoder=config['experimental_decoders'] [_exp_sonde_type], decoder_stats=config['decoder_stats']) autorx.sdr_list[_device_idx]['task'] = autorx.task_list[freq]['task'] # Indicate to the web client that the task list has been updated. flask_emit_event('task_event')
def start_decoder(freq, sonde_type): """ Attempt to start a decoder thread for a given sonde. Args: freq (float): Radiosonde frequency in Hz. sonde_type (str): The radiosonde type ('RS41', 'RS92', 'DFM') """ global config, RS_PATH, exporter_functions, rs92_ephemeris # Allocate a SDR. _device_idx = allocate_sdr(task_description="Decoder (%s, %.3f MHz)" % (sonde_type, freq / 1e6)) if _device_idx is None: logging.error("Could not allocate SDR for decoder!") return else: # Add an entry to the task list autorx.task_list[freq] = {'device_idx': _device_idx, 'task': None} # Set the SDR to in-use autorx.sdr_list[_device_idx]['in_use'] = True # Initialise a decoder. autorx.task_list[freq]['task'] = SondeDecoder( sonde_type=sonde_type, sonde_freq=freq, rs_path=RS_PATH, sdr_fm=config['sdr_fm'], device_idx=_device_idx, gain=autorx.sdr_list[_device_idx]['gain'], ppm=autorx.sdr_list[_device_idx]['ppm'], bias=autorx.sdr_list[_device_idx]['bias'], exporter=exporter_functions, timeout=config['rx_timeout'], telem_filter=telemetry_filter, rs92_ephemeris=rs92_ephemeris) autorx.sdr_list[_device_idx]['task'] = autorx.task_list[freq]['task']
def start_decoder(freq, sonde_type): """Attempt to start a decoder thread for a given sonde. Args: freq (float): Radiosonde frequency in Hz. sonde_type (str): The radiosonde type ('RS41', 'RS92', 'DFM', 'M10, 'iMet') """ global config, RS_PATH, exporter_functions, rs92_ephemeris, temporary_block_list global decode_attemp_dict # Allocate a SDR. _device_idx = allocate_sdr(task_description="Decoder (%s, %.3f MHz)" % (sonde_type, freq / 1e6)) if _device_idx is None: logging.error("Could not allocate SDR for decoder!") return else: # Add an entry to the task list autorx.task_list[freq] = {"device_idx": _device_idx, "task": None} # Set the SDR to in-use autorx.sdr_list[_device_idx]["in_use"] = True if sonde_type.startswith("-"): _exp_sonde_type = sonde_type[1:] else: _exp_sonde_type = sonde_type # Initialise a decoder. autorx.task_list[freq]["task"] = SondeDecoder( sonde_type=sonde_type, sonde_freq=freq, rs_path=RS_PATH, sdr_fm=config["sdr_fm"], device_idx=_device_idx, gain=autorx.sdr_list[_device_idx]["gain"], ppm=autorx.sdr_list[_device_idx]["ppm"], bias=autorx.sdr_list[_device_idx]["bias"], save_decode_audio=config["save_decode_audio"], save_decode_iq=config["save_decode_iq"], exporter=exporter_functions, timeout=config["rx_timeout"], telem_filter=telemetry_filter, rs92_ephemeris=rs92_ephemeris, rs41_drift_tweak=config["rs41_drift_tweak"], experimental_decoder=config["experimental_decoders"] [_exp_sonde_type], geo_filter_enable=config['geo_filter_enable'], decode_limit_period=config['decode_limit_period'], decode_limit_min_alt=config['decode_limit_min_alt'], brownlist=config['brownlist'], black_types=config['black_types'], imet_upload_filter_polygon=zip( config['imet_upload_filter_polygon_lat'], config['imet_upload_filter_polygon_lon']), save_raw_hex=config["save_raw_hex"]) autorx.sdr_list[_device_idx]["task"] = autorx.task_list[freq]["task"] # Indicate to the web client that the task list has been updated. flask_emit_event("task_event")
def start_decoder(freq, sonde_type): """ Attempt to start a decoder thread for a given sonde. Args: freq (float): Radiosonde frequency in Hz. sonde_type (str): The radiosonde type ('RS41', 'RS92', 'DFM', 'M10, 'iMet') """ global config, RS_PATH, exporter_functions, rs92_ephemeris, temporary_block_list # Check the frequency is not in our temporary block list # (This may happen from time-to-time depending on the timing of the scan thread) if freq in temporary_block_list.keys(): if temporary_block_list[freq] > (time.time() - config['temporary_block_time'] * 60): logging.error( "Task Manager - Attempted to start a decoder on a temporarily blocked frequency (%.3f MHz)" % (freq / 1e6)) return else: # This frequency should not be blocked any more, remove it from the block list. logging.info( "Task Manager - Removed %.3f MHz from temporary block list." % (freq / 1e6)) temporary_block_list.pop(freq) # Allocate a SDR. _device_idx = allocate_sdr(task_description="Decoder (%s, %.3f MHz)" % (sonde_type, freq / 1e6)) if _device_idx is None: logging.error("Could not allocate SDR for decoder!") return else: # Add an entry to the task list autorx.task_list[freq] = {'device_idx': _device_idx, 'task': None} # Set the SDR to in-use autorx.sdr_list[_device_idx]['in_use'] = True # Initialise a decoder. autorx.task_list[freq]['task'] = SondeDecoder( sonde_type=sonde_type, sonde_freq=freq, rs_path=RS_PATH, sdr_fm=config['sdr_fm'], device_idx=_device_idx, gain=autorx.sdr_list[_device_idx]['gain'], ppm=autorx.sdr_list[_device_idx]['ppm'], bias=autorx.sdr_list[_device_idx]['bias'], save_decode_audio=config['save_decode_audio'], save_decode_iq=config['save_decode_iq'], exporter=exporter_functions, timeout=config['rx_timeout'], telem_filter=telemetry_filter, rs92_ephemeris=rs92_ephemeris, imet_location=config['station_code']) autorx.sdr_list[_device_idx]['task'] = autorx.task_list[freq]['task'] # Indicate to the web client that the task list has been updated. flask_emit_event('task_event')