wonambi.widgets.notes module

Widgets containing notes (such as markers, events, and stages).

  • bookmarks are unique (might have the same text), are not mutually exclusive, have variable duration

  • events are not unique, are not mutually exclusive, have variable duration

  • stages are not unique, are mutually exclusive, have fixed duration

Todo

maybe it’s better to disable options related to annotations, but it’s a bit too complicated. If you do that, you can remove all “if self.annot is None” that are marked with “# remove if buttons are disabled”

class wonambi.widgets.notes.ConfigNotes(update_widget)[source]

Bases: Config

Widget with preferences in Settings window for the Annotations.

create_config()[source]

Placeholder: it’ll be replaced with actual layout.

class wonambi.widgets.notes.ExportEventsDialog(parent)[source]

Bases: QDialog

Dialog for choosing export dataset options.

button_clicked(button)[source]

Action when button was clicked.

Parameters:

button (instance of QPushButton) – which button was pressed

create_dialog()[source]

Create the dialog.

save_as()[source]

Dialog for getting name, location of dataset export.

toggle_buttons()[source]

Turn buttons on and off.

update()[source]

Update the event types list, info, when dialog is opened.

class wonambi.widgets.notes.MergeDialog(parent)[source]

Bases: QDialog

Dialog for specifying which events to merge. Events are merged when less than a minimum interval separates them. Events can be within-channel only or both within- and across-channel. Merged to channel with longest event.

parent

the main window

Type:

instance of QMainWindow

idx_evt_type

List of event types.

Type:

QListWidget

idx_merge_to

Choice of ‘earlier onset event’ or ‘longer duration event’.

Type:

FormMenu

merge_to

Current text in idx_merge_to

Type:

str

min_interval

Events separated by this value (in seconds) or less are merged.

Type:

FormFloat

cross_chan

For cross-channel merging.

Type:

FormBool

button_clicked(button)[source]

Action when button was clicked.

Parameters:

button (instance of QPushButton) – which button was pressed

create_dialog()[source]

Create the dialog.

update_event_types()[source]

Update event types in event type box.

class wonambi.widgets.notes.NewUserDialog(default_length)[source]

Bases: QDialog

button_clicked(button)[source]
class wonambi.widgets.notes.Notes(parent)[source]

Bases: QTabWidget

Widget that contains information about sleep scoring.

parent

the main window.

Type:

instance of QMainWindow

config

preferences for this widget

Type:

ConfigNotes

annot

contains the annotations made by the user

Type:

Annotations

idx_marker

table with the markers in the dataset

Type:

QTableWidget

idx_summary

layout of the “Summary” tab (we add and remove the “Recap” box)

Type:

QVBoxLayout

idx_annotations

push button with the text of the annotation file

Type:

QPushButton

idx_rater

name of the current rater

Type:

QLabel

idx_stats

layout of the stage statistics

Type:

QFormLayout

idx_eventtype_scroll

area to which you add the QGroupBox with the list of events as checkbox

Type:

QScrollArea

idx_eventtype_list

list of checkboxes with the event types

Type:

list of QCheckBox

idx_annot_list

table with the bookmarks and events in the annotations

Type:

QTableWidget

idx_eventtype

Combo box of the event types for the toolbar

Type:

QComboBox

idx_stage

Combo box of the stages for the toolbar

Type:

QComboBox

idx_quality

Combo box of signal quality (good/poor) for the toolbar

Type:

QComboBox

add_bookmark(time)[source]

Run this function when user adds a new bookmark.

Parameters:

time (tuple of float) – start and end of the new bookmark, in s

add_event(name, time, chan)[source]

Action: add a single event.

change_event_type(new_name=None, name=None, time=None, chan=None)[source]

Action: change an event’s type.

clear_annot()[source]

Action: clear all the annotations (ask for confirmation first).

clear_cycle_mrkrs(test=False)[source]

Remove all cycle markers.

create()[source]

Create the widget layout with all the annotations.

create_action()[source]

Create actions associated with Annotations.

delete_eventtype(test_type_str=None)[source]

Action: create dialog to delete event type.

delete_rater()[source]

Action: create dialog to delete rater.

delete_row()[source]

Delete bookmarks or event from annotations, based on row.

detect_events(data, method, params, label)[source]

Detect events and display on signal.

Parameters:
  • data (instance of ChanTime) – one segment with all channels of interest

  • method (str) – Method used for detection.

  • params (dict) – Parameters used for detection.

  • label (str) – Name of event type, on event labels

display_eventtype()[source]

Read the list of event types in the annotations and update widgets.

display_notes()[source]

Display information about scores and raters.

display_stats()[source]

Display summary statistics about duration in each stage.

enable_events()[source]

enable slow wave and spindle detection if both annotations and channels are active.

export(xformat='csv')[source]

action: export annotations to CSV.

export_sleeps_stats()[source]

action: export sleep statistics CSV.

find_row(ev_start, ev_end)[source]

Highlight event row in table from start and end time.

Parameters:
  • ev_start (float) – start time, in seconds from record start

  • ev_end (float) – end time, in seconds from record start

Returns:

int – index of event row in idx_annot_list QTableWidget

get_cycle_mrkr(end=False)[source]

Mark cycle start or end.

Parameters:

end (bool) – If True, marks a cycle end; otherwise, it’s a cycle start

get_quality(qual_idx=None)[source]

Get the signal qualifier, using shortcuts or combobox.

get_selected_events(time_selection=None)[source]

Returns which events are present in one time window.

Parameters:

time_selection (tuple of float) – start and end of the window of interest

Returns:

list of dict – list of events in the window of interest

get_sleepstage(stage_idx=None)[source]

Score the sleep stage, using shortcuts or combobox.

go_to_marker(row, col, table_type)[source]

Move to point in time marked by the marker.

Parameters:
  • row (QtCore.int) –

  • column (QtCore.int) –

  • table_type (str) – ‘dataset’ table or ‘annot’ table, it works on either

import_events(source='wonambi')[source]

action: import events from text file (Wonambi or RemLogic).

import_fasst(checked=False, test_fasst=None, test_annot=None)[source]

Action: import from FASST .mat file

import_staging(source, staging_start=None, as_qual=False, test_filename=None, test_rater=None)[source]

Action: import an external sleep staging file.

Parameters:
  • source (str) – Name of program where staging was exported. One of ‘alice’, ‘compumedics’, ‘domino’, ‘remlogic’, ‘sandman’.

  • staging_start (datetime, optional) – Absolute time when staging begins.

  • as_qual (bool) – if True, scores will be imported as quality

load_annot()[source]

Action: load a file for annotations.

markers_to_events(keep_name=False)[source]

Copy all markers in dataset to event type.

new_annot()[source]

Action: create a new file for annotations.

new_eventtype(test_type_str=None)[source]

Action: create dialog to add new event type.

new_rater()[source]

Action: add a new rater.

remove_bookmark(time)[source]

User removes bookmark.

Parameters:

time (tuple of float) – start and end of the new bookmark, in s

remove_cycle_mrkr()[source]

Remove cycle marker.

remove_event(name=None, time=None, chan=None)[source]

Action: remove single event.

rename_eventtype(test_name=None, test_new_name=None)[source]

action: create dialog to rename event type.

rename_rater(test_name=None, test_new_name=None)[source]

action: create dialog to rename event type.

reset()[source]

Remove all annotations from window.

reset_current_row()[source]

For traces.next_event

select_rater(rater=False)[source]

Action: select one rater.

Parameters:

rater (str) – name of the rater

set_quality_index()[source]

Set the current signal quality in combobox.

set_stage_index()[source]

Set the current stage in combobox.

toggle_check_all_eventtype()[source]

Check ‘All’ if all event types are checked in event type scroll.

toggle_eventtype()[source]

Check or uncheck all event types in event type scroll.

update_annotations()[source]

Update annotations made by the user, including bookmarks and events. Depending on the settings, it might add the bookmarks to overview and traces.

update_dataset_marker()[source]

Update markers which are in the dataset. It always updates the list of events. Depending on the settings, it might add the markers to overview and traces.

update_notes(xml_file, new=False)[source]

Update information about the sleep scoring.

Parameters:
  • xml_file (str) – file of the new or existing .xml file

  • new (bool) – if the xml_file should be a new file or an existing one

update_settings()[source]

Once Settings are applied, update the notes.