class_docstr: QSpectrumAnalyzer main window
class_docstr_tok: ["QSpectrumAnalyzer","main","window"]
docstr: Create power_thread and connect signals to slots
docstr_tok: ["Create","power_thread","and","connect","signals","to","slots"]
code: def setup_power_thread(self):
      """Create power_thread and connect signals to slots"""
      if self.power_thread:
          self.stop()
  
      settings = QtCore.QSettings()
      self.data_storage = DataStorage(
          max_history_size=settings.value(
              "waterfall_history_size", 100, int
          )
      )
      self.data_storage.data_updated.connect(self.update_data)
      self.data_storage.data_updated.connect(
          self.spectrumPlotWidget.update_plot
      )
      self.data_storage.data_updated.connect(
          self.spectrumPlotWidget.update_persistence
      )
      self.data_storage.data_recalculated.connect(
          self.spectrumPlotWidget.recalculate_plot
      )
      self.data_storage.data_recalculated.connect(
          self.spectrumPlotWidget.recalculate_persistence
      )
      self.data_storage.history_updated.connect(
          self.waterfallPlotWidget.update_plot
      )
      self.data_storage.history_recalculated.connect(
          self.waterfallPlotWidget.recalculate_plot
      )
      self.data_storage.average_updated.connect(
          self.spectrumPlotWidget.update_average
      )
      self.data_storage.baseline_updated.connect(
          self.spectrumPlotWidget.update_baseline
      )
      self.data_storage.peak_hold_max_updated.connect(
          self.spectrumPlotWidget.update_peak_hold_max
      )
      self.data_storage.peak_hold_min_updated.connect(
          self.spectrumPlotWidget.update_peak_hold_min
      )
  
      # Setup default values and limits in case that backend is changed
      backend = settings.value("backend", "soapy_power")
      try:
          backend_module = getattr(backends, backend)
      except AttributeError:
          backend_module = backends.soapy_power
  
      if self.backend is None or backend != self.backend:
          self.backend = backend
          self.gainSpinBox.setMinimum(backend_module.Info.gain_min)
          self.gainSpinBox.setMaximum(backend_module.Info.gain_max)
          self.gainSpinBox.setValue(backend_module.Info.gain)
          self.startFreqSpinBox.setMinimum(
              backend_module.Info.start_freq_min
          )
          self.startFreqSpinBox.setMaximum(
              backend_module.Info.start_freq_max
          )
          self.startFreqSpinBox.setValue(backend_module.Info.start_freq)
          self.stopFreqSpinBox.setMinimum(
              backend_module.Info.stop_freq_min
          )
          self.stopFreqSpinBox.setMaximum(
              backend_module.Info.stop_freq_max
          )
          self.stopFreqSpinBox.setValue(backend_module.Info.stop_freq)
          self.binSizeSpinBox.setMinimum(
              backend_module.Info.bin_size_min
          )
          self.binSizeSpinBox.setMaximum(
              backend_module.Info.bin_size_max
          )
          self.binSizeSpinBox.setValue(backend_module.Info.bin_size)
          self.intervalSpinBox.setMinimum(
              backend_module.Info.interval_min
          )
          self.intervalSpinBox.setMaximum(
              backend_module.Info.interval_max
          )
          self.intervalSpinBox.setValue(backend_module.Info.interval)
          self.ppmSpinBox.setMinimum(backend_module.Info.ppm_min)
          self.ppmSpinBox.setMaximum(backend_module.Info.ppm_max)
          self.ppmSpinBox.setValue(backend_module.Info.ppm)
          self.cropSpinBox.setMinimum(backend_module.Info.crop_min)
          self.cropSpinBox.setMaximum(backend_module.Info.crop_max)
          self.cropSpinBox.setValue(backend_module.Info.crop)
  
      # Setup default values and limits in case that LNB LO is changed
      lnb_lo = settings.value("lnb_lo", 0, float) / 1e6
  
      start_freq_min = backend_module.Info.start_freq_min + lnb_lo
      start_freq_max = backend_module.Info.start_freq_max + lnb_lo
      start_freq = self.startFreqSpinBox.value()
      stop_freq_min = backend_module.Info.stop_freq_min + lnb_lo
      stop_freq_max = backend_module.Info.stop_freq_max + lnb_lo
      stop_freq = self.stopFreqSpinBox.value()
  
      self.startFreqSpinBox.setMinimum(
          start_freq_min if start_freq_min > 0 else 0
      )
      self.startFreqSpinBox.setMaximum(start_freq_max)
      if start_freq < start_freq_min or start_freq > start_freq_max:
          self.startFreqSpinBox.setValue(start_freq_min)
  
      self.stopFreqSpinBox.setMinimum(
          stop_freq_min if stop_freq_min > 0 else 0
      )
      self.stopFreqSpinBox.setMaximum(stop_freq_max)
      if stop_freq < stop_freq_min or stop_freq > stop_freq_max:
          self.stopFreqSpinBox.setValue(stop_freq_max)
  
      self.power_thread = backend_module.PowerThread(self.data_storage)
      self.power_thread.powerThreadStarted.connect(
          self.on_power_thread_started
      )
      self.power_thread.powerThreadStopped.connect(
          self.on_power_thread_stopped
      )
  
imports: import sys, os, signal, time, argparse
  from Qt import QtCore, QtGui, QtWidgets
  from qspectrumanalyzer import backends
  from qspectrumanalyzer.version import __version__
  from qspectrumanalyzer.data import DataStorage
  from qspectrumanalyzer.plot import SpectrumPlotWidget, WaterfallPlotWidget
  from qspectrumanalyzer.utils import str_to_color, human_time
  from qspectrumanalyzer.settings import QSpectrumAnalyzerSettings
  from qspectrumanalyzer.smoothing import QSpectrumAnalyzerSmoothing
  from qspectrumanalyzer.persistence import QSpectrumAnalyzerPersistence
  from qspectrumanalyzer.colors import QSpectrumAnalyzerColors
  from qspectrumanalyzer.baseline import QSpectrumAnalyzerBaseline
  from qspectrumanalyzer.ui_qspectrumanalyzer import Ui_QSpectrumAnalyzerMainWindow
label_desc: Use image node_id 2 for calling the QSpectrumAnalyzerMainWindow obj's underlying member method code with example usage: obj.setup_power_thread() without return types