Skip to content

visualdynamics.gui.frequency_panel

frequency_panel

The frequency readout: whether a sine record's tone was at the frequency its profile asks for, read in the sine view.

A sine test is held to its frequency as well as its level, and the levels the extraction reads are placed at the specified frequency whether the tone was there or not. Once the levels have been extracted, this readout sits under the extraction's settings, below the distortion readout, and checks them (core.sine_frequency.check_frequency): the tone's own frequency on the record against the specification's at every line of the sweep, as an error in percent and hertz, against a band set as a share of the frequency with a floor in hertz (2 % and no floor by default; '2 % or 1 Hz, whichever is greater' is 2 % with a 1 Hz floor). On a channel chosen here (a control channel, since those are the ones the extraction reads), it gives the band, the worst reading and where, how many lines are outside, and the verdict in words. The small plot under the numbers is the error against frequency with the band dashed either side of zero, the same drawing plot_sine_frequency makes (plot.sine_frequency.draw_frequency).

It is a reading, not an act: nothing is made, so there is no button, and an edit reads again at once. It reads the levels already extracted and never extracts them itself, so beside a record with no levels it stays away (principle 3), and beside levels the project marks stale it says so and checks nothing (gui.levels_readout).

Classes:

Name Description
FrequencyPlot

The frequency error against frequency, small: frequency on the

FrequencyPanel

The tone, the channel and the band, then what the check found.

Classes

FrequencyPlot

FrequencyPlot(parent: QWidget | None = None)

Bases: CheckPlot

The frequency error against frequency, small: frequency on the log axis every sine level is read on, the error linear about zero, since a tone runs off either way.

Source code in src/visualdynamics/gui/levels_readout.py
def __init__(self, parent: QWidget | None = None) -> None:
    super().__init__(parent)
    self.items: list[Any] = []

FrequencyPanel

FrequencyPanel(parent: QWidget | None = None)

Bases: LevelsReadout

The tone, the channel and the band, then what the check found.

Methods:

Name Description
show_frequency

Check the extracted levels of history against

Source code in src/visualdynamics/gui/levels_readout.py
def __init__(self, parent: QWidget | None = None) -> None:
    super().__init__(parent)
    grid = QGridLayout(self)
    grid.setContentsMargins(0, 4, 0, 0)
    grid.setHorizontalSpacing(8)
    grid.setVerticalSpacing(4)
    rule = QFrame()
    rule.setFrameShape(QFrame.Shape.HLine)
    rule.setFrameShadow(QFrame.Shadow.Sunken)
    grid.addWidget(rule, 0, 0, 1, 2)
    self.title: QLabel = QLabel(self.TITLE)
    font = self.title.font()
    font.setBold(True)
    self.title.setFont(font)
    grid.addWidget(self.title, 1, 0, 1, 2)
    #: what is being read, and the check last made of it
    self._history: Any = None
    self._specification: Any = None
    self._levels: Any = None
    self._key: tuple | None = None
    self.check: Any = None
    #: why the levels shown are stale, when they are: nothing is
    #: checked against them until they are extracted again
    self._stale: str | None = None
    self._loading = False

    self.tone_box: QComboBox = QComboBox()
    self.tone_box.setToolTip('The tone checked, of those extracted')
    self.channel_box: QComboBox = QComboBox()
    self.channel_box.setToolTip(
        'The control channel checked: the extraction reads the '
        'channels the specification controls')
    rows = ([('tone', 'Tone', self.tone_box),
             ('channel', 'Channel', self.channel_box)]
            + self._setting_rows())
    self.names, self.editors = add_keyed_settings(grid, rows,
                                                  first_row=2)
    first = 2 + len(rows)
    made = add_derived(grid, self.DERIVED, first)
    self.derived: dict[str, QLabel] = {key: value for key, (_name, value)
                                       in made.items()}
    self.notes: QLabel = QLabel('')
    self.notes.setWordWrap(True)
    self.notes.setAlignment(Qt.AlignmentFlag.AlignLeft)
    grid.addWidget(self.notes, first + len(self.DERIVED), 0, 1, 2)
    self.preview: CheckPlot = self.PLOT()
    grid.addWidget(self.preview, first + len(self.DERIVED) + 1, 0, 1, 2)
    self.tone_box.currentIndexChanged.connect(self._edited)
    self.channel_box.currentIndexChanged.connect(self._edited)
Methods:
show_frequency
show_frequency(history: Any, specification: Any, levels: Any, stale: str | None = None) -> Any

Check the extracted levels of history against specification and show it (LevelsReadout.show_levels).

Source code in src/visualdynamics/gui/frequency_panel.py
def show_frequency(self, history: Any, specification: Any,
                   levels: Any, stale: str | None = None) -> Any:
    """Check the extracted `levels` of `history` against
    `specification` and show it (`LevelsReadout.show_levels`)."""
    return self.show_levels(history, specification, levels, stale)

Functions: