예제 #1
0
파일: filters.py 프로젝트: marbort/Artemis
    def _ok(self, signal_name):
        """Evalaute if the signal matches the band filters."""
        if not self.apply_remove_btn.isChecked():
            return True
        undef_band = is_undef_band(self._owner.db.loc[signal_name])
        if undef_band:
            if self._owner.include_undef_bands.isChecked():
                return True
            else:
                return False

        signal_bands = (
            safe_cast(self._owner.db.at[signal_name, Signal.INF_BAND], int),
            safe_cast(self._owner.db.at[signal_name, Signal.SUP_BAND], int)
        )

        lower_limit_ok = True
        upper_limit_ok = True
        if self._owner.activate_low_band_filter_btn.isChecked():
            if not signal_bands[1] >= filters_limit(self._owner.lower_band_spinbox,
                                                    self._owner.lower_band_filter_unit,
                                                    self._owner.lower_band_confidence, -1):
                lower_limit_ok = False
        if self._owner.activate_up_band_filter_btn.isChecked():
            if not signal_bands[0] < filters_limit(self._owner.upper_band_spinbox,
                                                   self._owner.upper_band_filter_unit,
                                                   self._owner.upper_band_confidence):
                upper_limit_ok = False
        return lower_limit_ok and upper_limit_ok
예제 #2
0
    def display_specs(self, item, previous_item):
        """Display the signal properties.

        'item' is the item corresponding to the selected signal
        'previous_item' is unused.
        """
        self.display_spectrogram()
        if item is not None:
            self.current_signal_name = item.text()
            self.name_lab.setText(self.current_signal_name)
            self.name_lab.setAlignment(Qt.AlignHCenter)
            current_signal = self.db.loc[self.current_signal_name]
            if not current_signal.at[Signal.WIKI_CLICKED]:
                state = UrlButton.State.ACTIVE
            else:
                state = UrlButton.State.CLICKED
            self.url_button.set_enabled(state)
            category_code = current_signal.at[Signal.CATEGORY_CODE]
            undef_freq = is_undef_freq(current_signal)
            undef_band = is_undef_band(current_signal)
            if not undef_freq:
                self.freq_lab.setText(
                    format_numbers(current_signal.at[Signal.INF_FREQ],
                                   current_signal.at[Signal.SUP_FREQ]))
            else:
                self.freq_lab.setText("Undefined")
            if not undef_band:
                self.band_lab.setText(
                    format_numbers(current_signal.at[Signal.INF_BAND],
                                   current_signal.at[Signal.SUP_BAND]))
            else:
                self.band_lab.setText("Undefined")

            self.mode_lab.setText(current_signal.at[Signal.MODE])
            self.modul_lab.setText(current_signal.at[Signal.MODULATION])
            self.loc_lab.setText(current_signal.at[Signal.LOCATION])
            self.acf_lab.setText(
                ACFValue.concat_strings(current_signal.at[Signal.ACF]))
            self.description_text.setText(
                current_signal.at[Signal.DESCRIPTION])
            for cat, cat_lab in zip(category_code, self.category_labels):
                if cat == '0':
                    cat_lab.setStyleSheet(f"color: {self.inactive_color};")
                elif cat == '1':
                    cat_lab.setStyleSheet(f"color: {self.active_color};")
            self.set_band_range(current_signal)
            self.audio_widget.set_audio_player(self.current_signal_name)
        else:
            self.url_button.set_disabled()
            self.current_signal_name = ''
            self.name_lab.setText("No Signal")
            self.name_lab.setAlignment(Qt.AlignHCenter)
            for lab in self.property_labels:
                lab.setText(Constants.UNKNOWN)
            for lab in self.category_labels:
                lab.setStyleSheet(f"color: {self.inactive_color};")
            self.set_band_range()
            self.audio_widget.set_audio_player()