Acquisition Widgets¶
Created on Tue Aug 22 11:19:29 2017 @author: eyt21
This module contains the widget classes to the acquisition window. However, they are not limited to that window, and can be reused for other window, like the analysis window.
Attributes¶
- NI_DRIVERS: bool
- Indicates whether NIDAQmx drivers and pyDAQmx module are installed when attempting to import NIRecorder module The module is needed to check on the available National Instrument devices
- MAX_SAMPLE: int
- Arbritrary maximum number of samples that can be recorded.
-
class
cued_datalogger.acquisition.RecordingUIs.
BaseWidget
(*arg, **kwarg)¶ Bases:
PyQt5.QtWidgets.QWidget
A base widget reimplemented to allow custom styling. Pretty much identical to a normal QWidget
Methods
-
initUI
()¶ Construct the UI, to be reimplemented.
-
paintEvent
(evt)¶ Reimplemented from QWidget.paintEvent()
-
-
class
cued_datalogger.acquisition.RecordingUIs.
ChanToggleUI
(*arg, **kwarg)¶ Bases:
cued_datalogger.acquisition.RecordingUIs.BaseWidget
A Channel Toggling widget. Contains:
- Checkboxes to toggle channel,
- Buttons to select all, deselect all, and invert selection.
- LineEdits to toggle by expression or tags
Attributes
toggleChanged: pyqtsignal Emits when a channel toggle changes, Sends out the channel num(int) and the state(bool) channels_box: QWidget The widget containing the checkboxes checkbox_layout: QGridLayout Defines the layout of the checkboxes chan_btn_group: QButtonGroup Widget to handle the checkboxes presses sel_all_btn:QPushButton ‘Select All’ button desel_all_btn: QPushButton ‘Deselect All’ button inv_sel_btn: QPushButton ‘Invert Selection’ button chan_text: ChanLineText For toggling by expression chan_text2: QLineEdit For toggling by tags chan_text3: QLineEdit For displaying the channels toggled (may be changed to QLabel instead) search_status: QStatusBar For displaying whether the toggling is successful Methods
-
adjust_channel_checkboxes
(new_n_btns)¶ Add or delete checkboxes based on new number of buttons needed
Parameters: new_n_btns: int
New number of buttons required
-
chan_line_toggle
(chan_list)¶ Callback to intepret the input expressions and toggle the channels accordingly
Parameters: chan_list: List of str
Input expressions
-
initUI
()¶ Reimplemented from BaseWidget.
-
invert_checkboxes
()¶ Callback to invert selection
-
toggle_all_checkboxes
(state)¶ Callback to select all or deselect all
Parameters: state: int
State of the checkboxes to be in (either Qt.Unchecked or Qt.Checked)
-
toggle_channel_plot
(btn)¶ Callback when a checkbox is clicked. Emits sigToggleChanged.
Parameters: btn: QCheckBox
button that is clicked on
-
class
cued_datalogger.acquisition.RecordingUIs.
ChanConfigUI
(*arg, **kwarg)¶ Bases:
cued_datalogger.acquisition.RecordingUIs.BaseWidget
A Channel Plots Configuration widget. Contains:
- ComboBox to switch channel plot info,
- Spinboxes to set the offsets
- Buttons to change the colour of a plot
- Checkbox to hold a signal
- Button to open a window to edit metadata
Attributes
timeOffsetChanged: pyqtsignal Emits when a time domain offset is changed, Sends out the channel num(int) and the x and y offsets(float,float) freqOffsetChanged: pyqtsignal Emits when a frequency domain offset is changed, Sends out the channel num(int) and the x and y offsets(float,float) sigHoldChanged: pyqtsignal Emits when a state of holding the plot is changed, Sends out the channel num(int) and the state(bool) colourReset: pyqtsignal Emits when a plot colour is reset, Sends out the channel num(int) colourChanged: pyqtsignal Emits when a plot colour is changed, Sends out the channel num(int) and the color(QColor) chans_num_box: QComboBox The widget to select the channel plot hold_tickbox: QCheckBox Toggles whether to hold the signal or not colbox:QPushButton Set the colour of the plot defcol_btn: QPushButton Reset the colour of the plot to the default colour meta_btn: QPushButton Opens the metadata editing window time_offset_config: List of SpinBox Sets the X and Y offsets of time domain plot fft_offset_config: List of SpinBox Sets the X and Y offsets of frequency domain plot Methods
-
initUI
()¶ Reimplemented from BaseWidget.
-
set_colour_btn
(col)¶ Set the colour of the colour button.
Parameters: col: QColor
Colour to set
-
set_offset_step
(cbox, step_val)¶ Sets the single step of a spinbox
Parameters: cbox: SpinBox
SpinBox to set
step_val: float
The new value of the single step
-
set_plot_colour
(reset=False)¶ Set the colour of the colour button. Emits either sigColourReset or sigColourChanged
Parameters: reset: bool
Whether to reset the colour or not
-
set_plot_offset
(dtype)¶ Callback to set the offset. Emits sigTimeOffsetChanged or sigFreqOffsetChanged depending on dtype
Parameters: dtype: str
Either ‘Time’ of ‘DFT’ to indicate the time domain or frequency domain plot respectively
-
signal_hold
(state)¶ Callback to hold the plot. Emits sigHoldChanged
Parameters: dtype: str
Either ‘Time’ of ‘DFT’ to indicate the time domain or frequency domain plot respectively
-
class
cued_datalogger.acquisition.RecordingUIs.
DevConfigUI
(*arg, **kwarg)¶ Bases:
cued_datalogger.acquisition.RecordingUIs.BaseWidget
A Channel Plots Configuration widget. Contains widgets to setup the recorder
Attributes
configRecorder: pyqtsignal Emits the configuration of the recorder is set typebtngroup: QButtonGroup Contains the buttons to select source of audio stream Either SoundCard or NI config_button: QPushButton Confirm the settings and set up the new recorder rec: Recorder object Reference of the Recorder object configboxes: List of widgets Widgets for the configuration settings, in order: [‘Source’,’Rate’,’Channels’,’Chunk Size’,’Number of Chunks’] with type, respectively: [QComboBox, QLineEdit, QLineEdit, QLineEdit, QLineEdit] Methods
-
config_setup
()¶ Configure the inputs of the config_boxes
Parameters: recorder: Recorder object
The reference of the Recorder object
-
display_sources
()¶ Display the available sources from the type of recorder Either SoundCard(myRecorder) or NI(NIRecorder)
-
initUI
()¶ Reimplemented from BaseWidget.
-
read_device_config
()¶ Display the available sources from the type of recorder Either SoundCard(myRecorder) or NI(NIRecorder)
Returns: recType: str
Type of recorder
configs: list
The configurations [‘Source’,’Rate’,’Channels’,’Chunk Size’,’Number of Chunks’] with type, respectively:[str, int, int, int, int]
-
set_recorder
(recorder)¶ Set the recorder for reference
Parameters: recorder: Recorder object
The reference of the Recorder object
-
-
class
cued_datalogger.acquisition.RecordingUIs.
StatusUI
(*arg, **kwarg)¶ Bases:
cued_datalogger.acquisition.RecordingUIs.BaseWidget
A Status Bar widget. Contains:
- QStatusBar to display the stream status
- Button to reset the splitters
- Button to resume/pause the stream
- Button to grab a snapshot of the stream
Attributes
statusbar: QStatusBar Displays the status of the stream resetView: QPushButton Reset the splitter view togglebtn: Recorder object Resume/pause the stream sshotbtn: List of widgets Grab a snapshot of the stream Methods
-
initUI
()¶ Reimplemented from BaseWidget.
-
trigger_message
()¶ Display a message when the recording trigger is set off
-
class
cued_datalogger.acquisition.RecordingUIs.
RecUI
(*arg, **kwarg)¶ Bases:
cued_datalogger.acquisition.RecordingUIs.BaseWidget
A Recording Configuration widget. Contains:
- ComboBox to change recording mode,
- Widgets for setting up the recording:
- Recording samples/ duration
- Triggering
- Additional widgets for specific recording mode:
- Normal: None
- Average transfer function: Buttons to undo or clear past autospectrum and crossspectrum
Attributes
startRecording: pyqtsignal Emits when record button is pressed cancelRecording: pyqtsignal Emits when cancel button is pressed undoLastTfAvg: pyqtsignal Emits when undo last transfer function button is pressed clearTfAvg: pyqtsignal Emits when clear past transfer functions button is pressed switch_rec_box: QComboBox Switch recording options rec_boxes: List of Widgets Configurations: [‘Samples’,’Seconds’,’Pretrigger’,’Ref. Channel’,’Trig. Level’] with types : [QLineEdit, QLineEdit, QLineEdit, QComboBox, QLineEdit] spec_settings_widget:QStackedWidget Contains the additional settings input_chan_box: QComboBox Additional settings to put input channel for average transfer function calculation Methods
-
autoset_record_config
(setting)¶ Recalculate samples or duration
Parameters: setting: str
Input type. Either ‘Time’ or ‘Samples’
-
get_input_channel
()¶ Returns: int
Current index of input_chan_box
-
get_record_config
(*arg)¶ Returns: rec_configs: list
List of recording settings
-
get_recording_mode
()¶ Returns: str
Current text of switch_rec_box
-
initUI
()¶ Reimplemented from BaseWidget.
-
reset_configs
()¶ Reset the channels for triggering and reset validators
-
set_recorder
(recorder)¶ Set the recorder reference
-
toggle_trigger
(string)¶ Enable or disable the trigger settings
-
update_TFavg_count
(val)¶ Update the value of the number of recordings for average transfer function