wonambi.widgets.overview module

Wide widget giving an overview of the recordings with markers and annotations (bookmarks, events, and sleep scores)

class wonambi.widgets.overview.ConfigOverview(update_widget)[source]

Bases: Config

Widget with preferences in Settings window for Overview.

create_config()[source]

Placeholder: it’ll be replaced with actual layout.

class wonambi.widgets.overview.Overview(parent)[source]

Bases: QGraphicsView

Show an overview of data, such as hypnogram and data in memory.

parent

the main window.

Type:

instance of QMainWindow

config

preferences for this widget

Type:

ConfigChannels

minimum

start time of the recording, from the absolute time of start_time in s

Type:

int or float

maximum

length of the recordings in s

Type:

int or float

start_time

absolute start time of the recording

Type:

datetime

scene

to keep track of the objects

Type:

instance of QGraphicsScene

idx_current

instance of the current time window

Type:

QGraphicsRectItem

idx_markers

list of markers in the dataset

Type:

list of QGraphicsRectItem

idx_annot

list of user-made annotations

Type:

list of QGraphicsRectItem

add_timestamps()[source]

Add timestamps at the bottom of the overview.

display()[source]

Updates the widgets, especially based on length of recordings.

display_annotations()[source]

Mark all the bookmarks/events, from annotations.

This function is similar to display_markers, but they are called at different stages (f.e. when loading annotations file), so we keep them separate

display_current()[source]

Create a rectangle showing the current window.

display_markers()[source]

Mark all the markers, from the dataset.

This function should be called only when we load the dataset or when we change the settings.

mark_cycles(start_time, length, end=False)[source]

Mark cycle bound, only add the new one.

Parameters:
  • start_time (int) – start time in s of the bounding epoch

  • length (int) – duration in s of the epoch being scored.

  • end (bool) – If True, marker will be a cycle end marker; otherwise, it’s start.

mark_poi(times=None)[source]

Mark selected signal, from list of start and end times.

Parameters:

times (list of tuple of float) – start and end times, in sec form rec start

mark_quality(start_time, length, qual_name)[source]

Mark signal quality, only add the new ones.

Parameters:
  • start_time (int) – start time in s of the epoch being scored.

  • length (int) – duration in s of the epoch being scored.

  • qual_name (str) – one of the stages defined in global stages.

mark_stages(start_time, length, stage_name)[source]

Mark stages, only add the new ones.

Parameters:
  • start_time (int) – start time in s of the epoch being scored.

  • length (int) – duration in s of the epoch being scored.

  • stage_name (str) – one of the stages defined in global stages.

mousePressEvent(event)[source]

Jump to window when user clicks on overview.

Parameters:

event (instance of QtCore.QEvent) – it contains the position that was clicked.

reset()[source]

Reset the widget, and clear the scene.

update(reset=True)[source]

Read full duration and update maximum.

Parameters:

reset (bool) – If True, current window start time is reset to 0.

update_position(new_position=None)[source]

Update the cursor position and much more.

Parameters:

new_position (int or float) – new position in s, for plotting etc.

Notes

This is a central function. It updates the cursor, then updates the traces, the scores, and the power spectrum. In other words, this function is responsible for keep track of the changes every time the start time of the window changes.

update_settings()[source]

After changing the settings, we need to recreate the whole image.