Skip to content

visualdynamics.gui.distortion_panel

distortion_panel

The distortion readout: what a sine record carries besides its tone, read in the sine view.

A sine controller holds the tone it reads through its tracking band and sees nothing else, so the levels the extraction reads say nothing of what else was on the channel. Once the levels have been extracted, this readout sits under the extraction's settings and checks them (core.sine_distortion.check_distortion): the RMS of the record less the tracked tones against the RMS of the tones at every line of the sweep, as a distortion in percent and dB, against the limit a tolerance on the ratio sets (the unfiltered RMS 5 % over the tone by default, a distortion of 32 %). On a channel chosen here (a control channel, since those are the ones the extraction reads), it gives the limit, the worst reading and where, how many lines are over, and the verdict in words. The small plot under the numbers is the distortion against frequency with the limit dashed across it, the same drawing plot_sine_distortion makes (plot.sine_distortion.draw_distortion).

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, since an extraction is the long part, 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, which the frequency readout shares).

Classes:

Name Description
DistortionPlot

The distortion against frequency, small: frequency on the log axis

DistortionPanel

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

Classes

DistortionPlot

DistortionPlot(parent: QWidget | None = None)

Bases: CheckPlot

The distortion against frequency, small: frequency on the log axis every sine level is read on, the distortion linear from zero, since the limit is read as a height.

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

DistortionPanel

DistortionPanel(parent: QWidget | None = None)

Bases: LevelsReadout

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

Methods:

Name Description
show_distortion

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_distortion
show_distortion(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/distortion_panel.py
def show_distortion(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: