Пример #1
0
def test_widget_notes_remove_artf_evts(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.channels.new_group(test_name='eog')
    w.notes.update_notes(annot_psg_path)

    w.notes.new_eventtype(test_type_str='Artefact')
    w.notes.action['new_event'].setChecked(True)
    w.notes.add_event('Artefact', (1, 2), 'EEG Pz-Oz (scalp)')
    w.notes.add_event('Artefact', (3, 6), 'EEG Pz-Oz (scalp)')
    w.notes.add_event('Artefact', (7, 10), 'EEG Pz-Oz (scalp)')
    w.notes.add_event('Artefact', (14, 31), '')
    w.notes.add_event('Artefact', (70, 85), 'EEG Pz-Oz (scalp)')
    w.notes.add_event('Artefact', (87, 90), '')
    w.notes.add_event('Artefact', (90, 92), 'EEG Pz-Oz (scalp)')
    w.notes.add_event('Artefact', (105, 120), 'EEG Pz-Oz (scalp)')
    w.notes.add_event('Artefact', (125.0, 125.2), 'EEG Pz-Oz (scalp)')
    w.notes.add_event('Artefact', (132, 142), 'EEG Pz-Oz (scalp)')

    times = [(8, 15), (30, 50), (56, 100), (100, 111), (135, 140), (150, 160)]
    new_times = remove_artf_evts(times, w.notes.annot)

    assert new_times == [(10, 14), (31, 50), (56, 70), (85, 87), (92, 100),
                         (100, 105), (150, 160)]

    w.notes.delete_eventtype(test_type_str='Artefact')
    w.close()
Пример #2
0
def test_widget_channels_save(qtbot):
    w = MainWindow()
    qtbot.addWidget(w)

    assert not w.channels.action['save_channels'].isEnabled()
    w.info.open_dataset(str(gui_file))
    assert w.channels.action['save_channels'].isEnabled()

    channel_make_group(w)

    w.channels.new_group(test_name='eog')

    chan_tab_i = w.channels.tabs.currentIndex()
    channelsgroup = w.channels.tabs.widget(chan_tab_i)
    channelsgroup.idx_l0.item(2).setSelected(True)

    channelsgroup.idx_hp.setValue(20)
    channelsgroup.idx_lp.setValue(0)
    channelsgroup.idx_scale.setValue(10)
    w.channels.color_group(test_color=QColor('#ff4a87'))

    w.channels.button_apply.click()

    toolbar = w.findChild(QToolBar, 'File Management')
    button_save = find_in_qt(toolbar, QToolButton, "Save Montage")
    button_save.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_12_save_chan.png'))
    button_save.setStyleSheet("")

    w.channels.save_channels(test_name=str(channel_montage_file))
Пример #3
0
def test_widget_channels_reref(qtbot):
    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))

    w.channels.new_group(test_name='reref')

    chan_tab_i = w.channels.tabs.currentIndex()
    channelsgroup = w.channels.tabs.widget(chan_tab_i)
    channelsgroup.idx_l0.item(0).setSelected(True)
    channelsgroup.idx_l0.item(1).setSelected(True)
    channelsgroup.idx_reref.click()
    w.channels.button_apply.click()

    w.channels.save_channels(test_name=str(channel_montage_reref_file))

    # add one channel that doesn't exist
    with channel_montage_file.open() as outfile:
        groups = load(outfile)
    groups[0]['chan_to_plot'].append('NOT EXIST')
    with channel_montage_file.open('w') as outfile:
        dump(groups, outfile, indent=' ')

    # load dataset, but ignore extra channel
    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    w.channels.load_channels(test_name=str(channel_montage_file))

    assert 'NOT EXIST' in w.statusBar().currentMessage()
Пример #4
0
def test_widget_notes_mark_event(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.channels.new_group(test_name='eog')
    w.notes.update_notes(annot_psg_path)
    w.traces.Y_wider()
    w.traces.Y_wider()
    w.traces.action['cross_chan_mrk'].setChecked(True)
    w.traces.go_to_epoch(test_text_str='23:34:45')

    w.notes.new_eventtype(test_type_str='spindle')
    w.notes.action['new_event'].setChecked(True)
    w.notes.add_event('spindle', (24293.01, 24294.65), 'EEG Pz-Oz (scalp)')

    screenshot(w, 'notes_14_mark_event.png')

    w.notes.add_event('spindle', (24288.01, 24288.90), 'EEG Fpz-Cz (scalp)')
    w.notes.add_event('spindle', (24297.5, 24298.00), 'EEG Fpz-Cz (scalp)')

    screenshot(w, 'notes_20_mark_short_event.png')

    pos = w.traces.mapFromScene(QPointF(24294, 75))
    mouseclick = QMouseEvent(QEvent.MouseButtonPress, pos, Qt.LeftButton,
                             Qt.NoButton, Qt.NoModifier)
    w.traces.mousePressEvent(mouseclick)

    screenshot(w, 'notes_15_highlight_event.png')

    w.notes.delete_eventtype(test_type_str='spindle')
    w.close()
Пример #5
0
def test_widget_traces_gotoepoch(qtbot):

    w = MainWindow()
    w.show()
    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()

    menubar = w.menuBar()

    act_navigation = find_in_qt(menubar, QAction, 'Navigation')
    menubar.setActiveAction(act_navigation)
    act_navigation.menu().setActiveAction(w.traces.action['go_to_epoch'])

    screenshot(w, 'traces_01_gotoepoch.png')
    w.close()

    w.traces.go_to_epoch(test_text_str='xxx')
    assert w.statusBar().currentMessage() == 'Input can only contain digits and colons'

    w.traces.go_to_epoch(test_text_str='1130')
    assert w.value('window_start') == 1130

    w.traces.go_to_epoch(test_text_str='22:30')
    assert w.value('window_start') == 20400

    w.info.idx_start.setStyleSheet("background-color: red;")
    w.info.grab().save(str(GUI_PATH / 'traces_02_gotoepoch.png'))
    w.info.idx_start.setStyleSheet("")
Пример #6
0
def test_widget_notes_import_error(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.notes.import_fasst(test_fasst=str(gui_file),
                         test_annot=str(annot_fasst_export_file))
    assert 'FASST .mat file' in w.statusBar().currentMessage()
Пример #7
0
def test_widget_notes_show_fasst(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.notes.import_fasst(test_fasst=str(annot_fasst_path),
                         test_annot=str(annot_fasst_export_file))
    w.grab().save(str(GUI_PATH / 'notes_05_show_imported.png'))
Пример #8
0
def test_widget_notes_load(qtbot):
    w = MainWindow()
    qtbot.addWidget(w)

    toolbar = w.findChild(QToolBar, 'File Management')
    button_save = find_in_qt(toolbar, QToolButton, "Load Annotations")
    button_save.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_03_load.png'))
    button_save.setStyleSheet("")
Пример #9
0
def test_widget_notes_export_csv(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    menubar = w.menuBar()

    act_annot = find_in_qt(menubar, QAction, 'Annotations')
    menubar.setActiveAction(act_annot)
    act_annot.menu().setActiveAction(w.notes.action['export_to_csv'])

    screenshot(w, 'notes_06_export.png')
    w.close()
Пример #10
0
def test_widget_analysis_event(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.notes.update_notes(annot_psg_path)
    w.traces.go_to_epoch(test_text_str='23:34:45')

    w.notes.delete_eventtype(test_type_str='spindle')
    w.notes.new_eventtype(test_type_str='spindle')
    w.notes.action['new_event'].setChecked(True)
    w.notes.add_event('spindle', (24293.01, 24294.65), 'EEG Pz-Oz (scalp)')
    w.notes.add_event('spindle', (24288.01, 24288.90), 'EEG Fpz-Cz (scalp)')
    w.notes.add_event('spindle', (24290.5, 24291.00), 'EEG Fpz-Cz (scalp)')

    w.notes.action['analyze']
    ad = w.analysis_dialog
    ad.update_evt_types()
    ad.update_groups()

    ad.filename = analysis_export_path
    ad.chunk['event'].setChecked(True)
    ad.idx_evt_type.setCurrentRow(1)
    ad.idx_chan.setCurrentRow(0)
    evt = ad.event
    evt['global']['count'].set_value(True)
    evt['global']['density'].set_value(True)
    evt['f1'].set_value(10)
    evt['f2'].set_value(16)
    evt['global']['all_local'].set_value(True)
    evt['sw']['avg_slope'].set_value(True)
    evt['sw']['max_slope'].set_value(True)
    ad.check_all_local()

    ad.button_clicked(ad.idx_ok)
    w.notes.delete_eventtype(test_type_str='spindle')
    w.close()

    evt_path = EXPORTED_PATH / (splitext(basename(analysis_export_path))[0] +
                                '_params.csv')
    with open(evt_path) as f:
        reader = csv.reader(f)
        rows = [row for row in reader]
    assert approx(float(rows[1][1])) == 2
    assert approx(float(rows[2][1])) == 0.0020768431983
    assert approx(float(rows[4][15])) == 9.81616222270557
    assert approx(float(rows[9][13])) == 7.052493472354065
Пример #11
0
def test_widget_notes_export_csv(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    w.notes.update_notes(annot_psg_path)

    menubar = w.menuBar()

    act_annot = find_in_qt(menubar, QAction, 'Annotations')
    menubar.setActiveAction(act_annot)
    act_annot.menu().setActiveAction(w.notes.action['export_sleepstats'])

    screenshot(w, 'analysis_02_statistics.png')
    w.close()
Пример #12
0
def test_widget_notes_dialogs(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.notes.update_notes(annot_psg_path)

    w.notes.action['spindle']
    spd = w.spindle_dialog
    spd.grab().save(str(GUI_PATH / 'notes_16_spindledialog.png'))

    spd.button_clicked(spd.idx_cancel)

    w.notes.action['slow_wave']
    swd = w.slow_wave_dialog
    swd.grab().save(str(GUI_PATH / 'notes_17_slowwavedialog.png'))

    swd.button_clicked(swd.idx_cancel)

    w.notes.action['merge_events']
    md = w.merge_dialog
    md.grab().save(str(GUI_PATH / 'notes_19_mergedialog.png'))

    md.button_clicked(md.idx_cancel)
Пример #13
0
def test_widget_analysis_fooof(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.notes.update_notes(annot_psg_path)

    w.notes.action['analyze']
    ad = w.analysis_dialog
    ad.update_evt_types()
    ad.update_groups()

    ad.filename = analysis_export_path
    ad.chunk['segment'].setChecked(True)
    ad.idx_chan.setCurrentRow(0)
    ad.idx_stage.setCurrentRow(1)
    freq = ad.frequency
    freq['fooof_on'].set_value(True)
    freq['prep'].set_value(False)
    freq['step'].set_value(True)
    freq['step_val'].set_value(0.5)
    freq['norm'].set_value('none')
    assert ad.nseg == 33

    ad.button_clicked(ad.idx_ok)
    fooof_path = EXPORTED_PATH / (splitext(basename(analysis_export_path))[0] +
                                  '_freq_fooof.csv')
    with open(fooof_path) as f:
        reader = csv.reader(f)
        rows = [row for row in reader]
    assert approx(float(rows[11][1])) == 12.613759924714094
    assert approx(float(rows[11][2])) == 0.24356640365481338
Пример #14
0
def test_widget_notes_import_fasst(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    menubar = w.menuBar()

    act_annot = find_in_qt(menubar, QAction, 'Annotations')
    menubar.setActiveAction(act_annot)

    act_import = find_in_qt(act_annot.menu(), QAction, 'Import Staging')
    act_annot.menu().setActiveAction(act_import)

    act_import.menu().setActiveAction(w.notes.action['import_fasst'])

    screenshot(w, 'notes_04_import_fasst.png')
    w.close()
Пример #15
0
def test_widget_exportsvg(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.show()
    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()

    menubar = w.menuBar()
    act_view = find_in_qt(menubar, QAction, 'View')
    menubar.setActiveAction(act_view)
    act_view.menu().setActiveAction(w.traces.action['export_svg'])

    screenshot(w, 'exportsvg_01.png')

    export_graphics(w, test=str(svg_file))  # without extension
    assert svg_file.with_suffix('.svg').exists()
    w.close()

    svg_d = SVGDialog(str(svg_file))
    svg_d.button_clicked(svg_d.idx_ok)
    svg_d.button_clicked(svg_d.idx_cancel)
    svg_d.grab().save(str(GUI_PATH / 'exportsvg_02.png'))
Пример #16
0
def test_widget_notes_cycle(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.channels.new_group(test_name='eog')
    w.notes.update_notes(annot_psg_path)
    w.traces.Y_wider()
    w.traces.Y_wider()
    w.traces.go_to_epoch(test_text_str='22:28')

    menubar = w.menuBar()

    act_annot = find_in_qt(menubar, QAction, 'Annotations')
    menubar.setActiveAction(act_annot)

    act_cycle = find_in_qt(act_annot.menu(), QAction, 'Cycle')
    act_annot.menu().setActiveAction(act_cycle)

    act_cycle.menu().setActiveAction(w.notes.action['cyc_start'])

    screenshot(w, 'notes_11_set_cycle_start.png')

    w.notes.get_cycle_mrkr()

    w.overview.grab().save(str(GUI_PATH / 'notes_12_cycle_marker.png'))

    w.traces.go_to_epoch(test_text_str='23:24')
    w.notes.get_cycle_mrkr(end=True)
    w.traces.go_to_epoch(test_text_str='23:29')
    w.notes.get_cycle_mrkr()
    w.traces.go_to_epoch(test_text_str='00:43')
    w.notes.get_cycle_mrkr()
    w.traces.go_to_epoch(test_text_str='02:14:30')
    w.notes.get_cycle_mrkr(end=True)

    w.overview.grab().save(str(GUI_PATH / 'notes_13_all_cycle_markers.png'))
    w.notes.clear_cycle_mrkrs(test=True)

    w.close()
Пример #17
0
def test_widget_labels(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    assert not w.labels.isEnabled()

    w.info.open_dataset(str(gui_file))
    labels_orig = w.labels.chan_name

    assert w.labels.isEnabled()

    w.action['dockwidgets'][1].trigger()
    w.labels.table.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'labels_01_table.png'))
    w.labels.table.setStyleSheet("")

    # change label of second channel
    w.labels.table.item(1, 1).setText('newlabel')
    w.labels.grab().save(str(GUI_PATH / 'labels_02_newlabel.png'))

    w.labels.table.item(3, 1).setText('newlabel')
    w.labels.grab().save(str(GUI_PATH / 'labels_03_duplicate.png'))

    assert not w.labels.idx_apply.isEnabled()

    # fix it
    w.labels.table.item(3, 1).setText('correctlabel')
    w.labels.grab().save(str(GUI_PATH / 'labels_04_correct.png'))

    assert w.labels.idx_apply.isEnabled()

    # cancel should reset the list
    labels_changed = w.labels._read_labels()
    w.labels.idx_cancel.click()
    labels_cancel = w.labels._read_labels()
    assert labels_cancel == labels_orig
    assert labels_cancel != labels_changed

    # apply
    w.labels.table.item(2, 1).setText('newlabel')
    w.labels.idx_apply.click()

    assert w.channels.isEnabled()

    channel_make_group(w)
    find_in_qt(w.channels, QPushButton, 'Apply').click()
    w.grab().save(str(GUI_PATH / 'labels_05_traces.png'))

    # load data
    w.labels.idx_load.setStyleSheet("background-color: red;")
    w.labels.grab().save(str(GUI_PATH / 'labels_06_load_button.png'))
    w.labels.idx_load.setStyleSheet("")

    labels_file = SAMPLE_PATH / 'labels_file.csv'
    with labels_file.open('w') as f:
        f.write('newchan1, newchan2\tnewchan3;\nnewchan5')

    w.labels.load_labels(test_name=str(labels_file))
    w.labels.grab().save(str(GUI_PATH / 'labels_07_loaded.png'))
Пример #18
0
def test_widget_analysis_dialog(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.notes.update_notes(annot_psg_path)

    w.notes.action['analyze']
    ad = w.analysis_dialog
    ad.grab().save(str(GUI_PATH / 'analysis_01_dialog.png'))

    ad.button_clicked(ad.idx_cancel)
Пример #19
0
def test_widget_analysis_frequency(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.notes.update_notes(annot_psg_path)

    w.notes.action['analyze']
    ad = w.analysis_dialog
    ad.update_evt_types()
    ad.update_groups()
    ad.grab().save(str(GUI_PATH / 'analysis_01_dialog.png'))
    ad.tab_evt.grab().save(str(GUI_PATH / 'analysis_03_event.png'))

    ad.filename = analysis_export_path
    ad.chunk['epoch'].setChecked(True)
    ad.lock_to_staging.set_value(True)
    ad.idx_chan.setCurrentRow(0)
    ad.idx_stage.setCurrentRow(2)
    ad.trans['diff'].set_value(True)
    freq = ad.frequency
    freq['export_full'].set_value(True)
    freq['export_band'].set_value(True)
    freq['band'].set_value('[[0.5-4],[4-8],[10-16],[30-50]]')
    freq['prep'].set_value(True)
    freq['norm'].set_value('by integral of each segment')
    ad.tab_freq.grab().save(str(GUI_PATH / 'analysis_02_freq.png'))
    assert ad.nseg == 127

    ad.button_clicked(ad.idx_ok)
    freq_path = EXPORTED_PATH / (splitext(basename(analysis_export_path))[0] +
                                 '_freq_full.csv')
    with open(freq_path) as f:
        reader = csv.reader(f)
        rows = [row for row in reader]
    assert approx(float(rows[2][44])) == 0.01862944649426
    assert approx(float(rows[4][16])) == -4.28072153999

    band_path = EXPORTED_PATH / (splitext(basename(analysis_export_path))[0] +
                                 '_freq_band.csv')
    with open(band_path) as f:
        reader = csv.reader(f)
        rows = [row for row in reader]
    assert approx(float(rows[2][10])) == 0.0944796084801
    assert approx(float(rows[12][11])) == 0.063348951380
Пример #20
0
def test_widget_channels_load(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    assert not w.channels.action['load_channels'].isEnabled()
    w.info.open_dataset(str(gui_file))
    assert w.channels.action['load_channels'].isEnabled()

    toolbar = w.findChild(QToolBar, 'File Management')
    button_load = find_in_qt(toolbar, QToolButton, "Load Montage")
    button_load.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_13_load_chan.png'))
    button_load.setStyleSheet("")

    w.channels.load_channels(test_name=str(channel_montage_file))
    w.grab().save(str(GUI_PATH / 'channels_14_loaded.png'))
Пример #21
0
def test_widget_notes_toolbar(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.channels.new_group(test_name='eog')
    w.notes.update_notes(annot_psg_path)
    w.traces.Y_wider()
    w.traces.go_to_epoch(test_text_str='23:00')

    toolbar = w.findChild(QToolBar, 'Annotations')

    button_event = find_in_qt(toolbar, QToolButton, 'Event Mode')
    button_event.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_07_event_mode.png'))
    button_event.setStyleSheet("")

    box_evttype = find_in_qt_by_idx(toolbar, QComboBox, 0)
    box_evttype.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_08_evt_type_box.png'))
    box_evttype.setStyleSheet("")

    box_stage = find_in_qt_by_idx(toolbar, QComboBox, 1)
    box_stage.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_09_stage_box.png'))
    box_stage.setStyleSheet("")

    box_qual = find_in_qt_by_idx(toolbar, QComboBox, 2)
    box_qual.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_10_quality_box.png'))
    box_qual.setStyleSheet("")

    w.close()
Пример #22
0
def test_scroll_data(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.grab().save(str(GUI_PATH / 'open_01_start.png'))

    w.info.idx_filename.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'open_02_open_dataset.png'))
    w.info.idx_filename.setStyleSheet("")

    w.info.open_dataset(str(gui_file))

    new_button = w.channels.layout().itemAt(0).itemAt(0).widget()
    new_button.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'open_03_loaded.png'))
    new_button.setStyleSheet("")

    channel_make_group(w, png=True)

    # this shows selected channels and the apply button
    button_apply = find_in_qt(w.channels, QPushButton, 'Apply')
    button_apply.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'open_05_chan.png'))
    button_apply.setStyleSheet("")

    button_apply.click()
    w.grab().save(str(GUI_PATH / 'open_06_traces.png'))
Пример #23
0
def test_widget_channels(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    assert not w.channels.isEnabled()

    w.info.open_dataset(str(gui_file))

    assert w.channels.isEnabled()

    assert not w.channels.button_color.isEnabled()
    assert not w.channels.button_del.isEnabled()
    assert not w.channels.button_apply.isEnabled()
    channel_make_group(w)
    assert w.channels.button_color.isEnabled()
    assert w.channels.button_del.isEnabled()
    assert w.channels.button_apply.isEnabled()

    w.channels.button_apply.click()

    w.channels.grab().save(str(GUI_PATH / 'channels_01_onegroup.png'))

    w.channels.new_group(test_name='eog')
    chan_tab_i = w.channels.tabs.currentIndex()
    channelsgroup = w.channels.tabs.widget(chan_tab_i)

    channelsgroup.idx_l0.item(2).setSelected(True)
    w.channels.grab().save(str(GUI_PATH / 'channels_02_eog.png'))

    chan_tab_i = w.channels.tabs.currentIndex()
    channelsgroup = w.channels.tabs.widget(chan_tab_i)

    channelsgroup.idx_l0.item(2).setSelected(True)

    channelsgroup.idx_hp.setValue(20)
    channelsgroup.idx_hp.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_03_hp.png'))
    channelsgroup.idx_hp.setStyleSheet("")

    channelsgroup.idx_lp.setValue(0)
    channelsgroup.idx_lp.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_04_lp.png'))
    channelsgroup.idx_lp.setStyleSheet("")

    channelsgroup.idx_notch.setValue(60)
    channelsgroup.idx_notch.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_05_notch.png'))
    channelsgroup.idx_notch.setStyleSheet("")

    channelsgroup.idx_scale.setValue(10)
    channelsgroup.idx_scale.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_05_scale.png'))
    channelsgroup.idx_scale.setStyleSheet("")

    channelsgroup.idx_demean.setCheckState(Qt.Checked)
    channelsgroup.idx_demean.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_05_demean.png'))
    channelsgroup.idx_demean.setStyleSheet("")

    channelsgroup.idx_l1.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_06_ref.png'))
    channelsgroup.idx_l1.setStyleSheet("")

    channelsgroup.idx_reref.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_07_avgref.png'))
    channelsgroup.idx_reref.setStyleSheet("")

    button_apply = w.channels.button_apply
    button_apply.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_08_apply.png'))
    button_apply.setStyleSheet("")

    button_apply.click()

    button_color = w.channels.button_color
    button_color.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_09_color.png'))
    button_color.setStyleSheet("")

    w.channels.color_group(test_color=QColor('#ff4a87'))
    w.grab().save(str(GUI_PATH / 'channels_10_colored.png'))

    button_delete = w.channels.button_del
    button_delete.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_11_delete.png'))
    button_delete.setStyleSheet("")
    button_delete.click()

    # delete also the first channel group
    assert w.channels.button_color.isEnabled()
    assert w.channels.button_del.isEnabled()
    assert w.channels.button_apply.isEnabled()
    button_delete.click()
    assert not w.channels.button_color.isEnabled()
    assert not w.channels.button_del.isEnabled()
    assert not w.channels.button_apply.isEnabled()