wonambi.widgets.spectrum module

Widget to show power spectrum.

class wonambi.widgets.spectrum.ConfigSpectrum(update_widget)[source]

Bases: Config

create_config()[source]

Placeholder: it’ll be replaced with actual layout.

class wonambi.widgets.spectrum.Spectrum(parent)[source]

Bases: QWidget

Plot the power spectrum for a specified channel.

parent

the main window.

Type:

instance of QMainWindow

x_limit

2 values specifying the limit on x-axis

Type:

tuple or list

y_limit

2 values specifying the limit on y-axis

Type:

tuple or list

log

log-transform the data or not

Type:

bool

idx_chan

the element with the list of channel names.

Type:

instance of QComboBox

idx_x_min

value with min x value

Type:

instance of QLineEdit

idx_x_max

value with max x value

Type:

instance of QLineEdit

idx_y_min

value with min y value

Type:

instance of QLineEdit

idx_y_max

value with max y value

Type:

instance of QLineEdit

idx_log

widget that defines if log should be used or not

Type:

instance of QCheckBox

idx_fig

the view with the power spectrum

Type:

instance of QGraphicsView

scene

the scene with GraphicsItems

Type:

instance of QGraphicsScene

Notes

If data contains NaN, it doesn’t create any spectrum (feature or bug?).

add_grid()[source]

Add axis and ticks to figure.

Notes

I know that visvis and pyqtgraphs can do this in much simpler way, but those packages create too large a padding around the figure and this is pretty fast.

create()[source]

Create empty scene for power spectrum.

display(data)[source]

Make graphicsitem for spectrum figure.

Parameters:
  • data (ndarray) – 1D vector containing the data only

  • the (This function can be called by self.display_window (which reads) –

  • in (data for the selected channel) or by the mouse-events functions) –

  • selection). (traces (which read chunks of data from the user-made) –

display_window()[source]

Read the channel name from QComboBox and plot its spectrum.

This function is necessary it reads the data and it sends it to self.display. When the user selects a smaller chunk of data from the visible traces, then we don’t need to call this function.

reset()[source]

Reset widget as new

resizeEvent(event)[source]

Fit the whole scene in view.

Parameters:

event (instance of Qt.Event) – not important

show_channame(chan_name)[source]
update()[source]

Add channel names to the combobox.