GUI module¶
- GUI.CustomFilter(sender, app_data, user_data)[source]¶
Function that handles all the process from button/input creation to filter application on the signals.
tab_tag: Description signal_tags: Description
- Parameters:
sender -- Description
app_data -- Description
user_data -- tab_tag, signal_tags
- GUI.DefaultFilter(sender, app_data, user_data)[source]¶
Standard filtration = 5th order Butterworth bandpass filter 1-100 Hz + Removal of cardiac component Remove cardiac component - Fixed peak finder method - BRAVO adapted
tab_tag, signal_tags = user_data
tab_tag: Description signal_tags: Description
- GUI.Volt2dB(sender, app_data, user_data)[source]¶
Callback of checkbox - changes PSD plot between original units to dB.
y_axis: str/id, parent of plots (axis y) plot_tag: str/id, parent of axis signal_tags: list, list of tags to be converted, if they're shown tables: list, list of tags of tables to be converted
- Parameters:
sender -- Description
app_data -- boolean, type of units (original/dB)
user_data -- y_axis, plot_tag, signal_tags, tables
- GUI.add_band(sender, app_data, user_data)[source]¶
Internal: Add user-defined band to internal app_state memory dictinary
- GUI.add_combo_df_features(tab_tag, signal_tags)[source]¶
Internal: adds default features option to tab
- Parameters:
tab_tag -- (int or str) alias of tab
signal_tags -- list of signals ploted in main plot of tab
- GUI.add_combo_features(tab_tag, signal_tags)[source]¶
Internal: adds custom features option to tab
- Parameters:
tab_tag -- (int or str) alias of tab
signal_tags -- list of signals ploted in main plot of tab
- GUI.add_combo_filters(sender, app_data, user_data)[source]¶
Internal: Callback to show custom filters
- Parameters:
sender -- sender id/alias
app_data -- value of sender in moment of callback
user_data -- data saved to callback
- GUI.add_features_buttons(tab_tag, signal_tags)[source]¶
Internal: adds features-related buttons to tab
- Parameters:
tab_tag -- (int or str) alias of tab
signal_tags -- list of signals ploted in main plot of tab
- GUI.add_filters_buttons(tab_tag, signal_tags)[source]¶
Internal: adds filter-related buttons to tab
- Parameters:
tab_tag -- (int or str) alias of tab
signal_tags -- list of signals ploted in main plot of tab
- GUI.add_timeline_features_buttons(tab_tag, signal_tags)[source]¶
Internal: adds timeline specific features-related buttons to tab
- Parameters:
tab_tag -- (int or str) alias of tab
signal_tags -- list of signals ploted in main plot of tab
- GUI.apply_feat(func, parameter_values, raw)[source]¶
Applies function (func), with defined parameter_values, to raw signal.
- Parameters:
func -- str, function name
parameter_values -- dict, previously filled with default and user-defined
raw -- list, signal to be aplied feature
- GUI.before_vs_after(sender, app_data, user_data)[source]¶
Callback plot_featured_signal, for previosly segmented recordings
- GUI.change_button_color(color_id=4)[source]¶
Creates and returns theme to be binded to button
- Parameters:
color_id -- int/float, index of list colors
- GUI.change_electrodes_names(sender, app_data, user_data)[source]¶
Adds user-defined name into dictionary, so its used without app_state memory dictinary loss. Channels are to be renamed are hardcoded.
- GUI.change_event_name(sender, app_data, user_data)[source]¶
Renames events. User must know the original events names. Only replaced in future created items.
- GUI.change_inf_line_color(color_id)[source]¶
Theme for mvInfLine
- Parameters:
color_id -- int, index of color
- GUI.change_line_color(color)[source]¶
Theme for mvLineSeries
- Parameters:
color_id -- int or list, index of color or rgba code
- GUI.change_line_thickness(thickness, component=76)[source]¶
Theme for mvLineSeries thickness
- Parameters:
thickness -- int, width of line
- GUI.change_plot_color(color_id)[source]¶
Theme for mvScatterSeries
- Parameters:
color_id -- int, index of color
- GUI.change_text_color(color_id=5)[source]¶
Theme for text color
- Parameters:
color_id -- int, index of color
- GUI.choose(sender, app_data, user_data)[source]¶
Buttons to choose between individual or joined spectrogram, or wavelet. Only appears in the case of there being more than 1 recording from the same channel
tags: list, signals' id tab_label: str/id, tab id func: str, function name tab_tab: str/id, tab parent id parameter_values: dict, key: name of parameter, item: value
- Parameters:
sender -- Description
app_data -- Description
user_data -- tags, tab_label, func, tab_tag, parameter_values, mode
- GUI.create_alpha_theme(alpha=0.5, color=None)[source]¶
Create and return a DearPyGui plot alpha theme, to be binded to line series.
- Parameters:
(float) (alpha) -- Opacity value between 0.0 and 1.0
(list) (color) -- rbga values of line (for cases of dpg.add_line_series, that are not filled)
- Returns:
The theme ID
- Return type:
int
- GUI.create_table(tab_label, table_tag, features, trial_label='New Trial')[source]¶
Creates table, if it already existis adds row. Adds only one row per use, so it need to be inside for-cycle to add several rows. Includes 'Save Table' button.
- Parameters:
tab_label -- str/int, tab id
table_tag -- table id
features -- dictionary of information. Keys will be columns, features[key] will be cell
trial_label -- Name of row, editable by user.
- GUI.cut_signals(sender, app_data, user_data)[source]¶
Cuts and saves time-domain signals.
tab_tag: Description signal_tags: Description
- Parameters:
sender -- Description
app_data -- Description
user_data -- tab_tag, signal_tags
- GUI.deviation(sender, app_data, user_data)[source]¶
Internal: Recalculates and plots user-defined data
- Parameters:
sender -- sender id/alias
app_data -- choosen deviation, via radio button
user_data -- before, tab_label (objects)
before: value of sender, before. if equals: just return tab_label: id/alias of tab
- GUI.different_combo(sender, app_data, user_data)[source]¶
Checks if selected recordings are different
- GUI.display_error(tab_tag, e)[source]¶
Displays error e in doc container of tab_tag
- Parameters:
tab_tag -- str/int, tab parent id
e -- str, exception thrown
- GUI.enforce_min_max(sender, app_data, user_data)[source]¶
Ensure max is always at least diff units greater than min, and min is never below 0.
sender: min_tag or max_tag min_tag, max_tag, diff = user_data
- GUI.enforce_range(sender, app_data, user_data)[source]¶
Enforces range of colormap, diff of 5 units.
- Parameters:
sender -- Description
app_data -- Description
user_data -- tab_label (parent of sender), absolute_min (int/float), absolute_max (int/float)
- GUI.extract_artifact_type(s)[source]¶
Extracts type of artifact from string.
- Parameters:
s (str) -- str, ex.: CT_ARTIFACT_PRESENT
- GUI.extract_cc_features(p, y_axis, tab_label, mode=None)[source]¶
Extracts features of computed cross-correlation, plots respective features and returns features in a dictionary: info.
- info = {
'RMS Correlation': rms, 'Max Correlation': max_value, 'Lag til Max (s)': lag, 'Half Max Width (s)': width, 'Peak Frequency (mean, std)': [freq_mean,freq_std]
}
- Parameters:
p -- dict, computed signal dictionary
y_axis -- str/id, parent for plot
tab_label -- str/id, parent of plot, adding table of features
mode -- srt, default to None --> performs general cc; band name str --> performs band-specific cc
- Returns:
[info, tags], info --> features dictionary; tags --> list of id's of added feature plots
- Return type:
dict, list
- GUI.extract_channel_from_series_tag(series_tag)[source]¶
Gets channel, without hemisphere, of series/recording, from channel (ex.: 'ONE_THREE_LEFT' --> 'ONE_THREE').
- Parameters:
series_tag (str) -- str, series id
- Returns:
str, channel name
- Return type:
str
- GUI.extract_channel_hemisphere(label)[source]¶
Parses a label like 'ZERO_THREE_LEFT' into channel and hemisphere.
- Returns:
The channel with underscores (e.g. 'zero_three') hemisphere (str): The hemisphere (e.g. 'left')
- Return type:
channel (str)
- Parameters:
label -- str, channel_hemisphere = 'ZERO_THREE_LEFT'
- GUI.extract_edx_from_series_tag(series_tag)[source]¶
Gets id of event, from tag of series plot.
- Parameters:
series_tag (str) -- str, series id
- Returns:
int, event id (in app_state memory dictinary)
- Return type:
str
- GUI.extract_event_from_series_tag(event_string)[source]¶
Gets name of event, from tag of series plot.
- Parameters:
series_tag -- str, series id (ex.: tab_Streaming_0_series_0)
- Returns:
str, event name (ex.: series_0)
- GUI.extract_file_from_series_tag(series_tag)[source]¶
Gets file of series/recording, from tag of series plot.
- Parameters:
series_tag (str) -- str, series id
- Returns:
int, file id (in app_state memory dictinary)
- GUI.extract_idx_from_series_tag(series_tag)[source]¶
Gets id of series/recording, from tag of series plot.
- Parameters:
series_tag (str) -- str, series id
- Returns:
int, number of series (in app_state memory dictinary)
- Return type:
int
- GUI.extract_mode(tab_tag)[source]¶
Extracts the mode from a tab_tag formatted as 'tab_{mode}_{window_id}' or 'tab_{mode}_{window_id}_{suffix}'.
Return str
- Parameters:
tab_tag (str) -- Description
- Return type:
str
- GUI.extract_side_from_series_tag(series_tag)[source]¶
Gets hemisphere of series/recording, from tag of series plot.
- Parameters:
series_tag (str) -- str, series id
- Returns:
int, left=0, right=1
- Return type:
int
- GUI.extract_type_window(window_id)[source]¶
Gets type of window: 'Individual' or 'Combined' return str
- Parameters:
window_id -- Description
- GUI.extract_window_id(tab_tag)[source]¶
Extracts window_id as an integer from a tab_tag formatted as 'tab_{mode}_{window_id}' or 'tab_{mode}_{window_id}_{suffix}'.
- Parameters:
tab_tag (str) -- Description
- Return type:
int
- GUI.fill_params_features(app_data)[source]¶
Returns app_data function parameters, and respective default values, and documentation. :param app_data: name of function
- GUI.getActiveSeries(signal_tags)[source]¶
From signal's id, returns only a list of the visible tags.
- Parameters:
signal_tags -- dict/list, if dict the tags are keys
- GUI.getActiveSignals(tab_tag, signal_tags)[source]¶
From Active Series, returns the data of the series in app_state memory dictinary.
- Parameters:
tab_tag -- Description
signal_tags -- Description
- GUI.getBandsByTab(tab_tag)[source]¶
Gets frequency bands (used for spectral analysis), associated to window or tab.
- Parameters:
tab_tag -- Description
- GUI.getDatabyFile(window_id, file)[source]¶
Return Data dicitionary (from json file), from file id in app_state memory dictinary
- Parameters:
window_id -- Description
file -- Description
- GUI.getDatabyTag(series_tag)[source]¶
Return Data dicitionary (from json file), from series tag
- Parameters:
series_tag -- Description
- GUI.getEventsbyIdx(tab_tag, idx)[source]¶
Gets Events in signal idx, by id of signal
- Parameters:
tab_tag -- Description
idx -- int, signal id in app_state memory dictinary
- GUI.getEventsbyTag(tab_tag, series_tag)[source]¶
Gets Events in signal idx, by series tag
- Parameters:
tab_tag -- Description
series_tag -- Description
- GUI.getMeanActiveSeries(window_id, tab_tag, signal_tags, key='Y')[source]¶
Calculates mean and standard deviation from the active signals in plot.
- Parameters:
window_id -- str/id
tab_tag -- Description
signal_tags -- Description
dev -- default to None, standar deviation*1, else gets value of radio button to get type of standard deviation
- GUI.getSignalbyIdx(window_id, tab_tag, series_tag, mode=None)[source]¶
Gets signal data, from app_state memory dictinary, from series_tag
- Parameters:
window_id -- Description
tab_tag -- Description
series_tag -- Description
mode -- Description
- GUI.getSignalbyIdxSide(window_id, tab_tag, series_tag)[source]¶
Gets signal data, for Events, from series_tag.
- Parameters:
window_id -- Description
tab_tag -- Description
series_tag -- Description
- GUI.getUpdatedElectrodeName(electrode)[source]¶
Gets user-defined electrode name, from original electrode name defined in json file.
- Parameters:
electrode -- str, original name
- GUI.getUpdatedEventName(event)[source]¶
Gets user-defined event name, from original name defined in json file.
- Parameters:
event -- str, original name
- GUI.get_limits(children, plot_tag)[source]¶
Returns absolute axis limits, and indexes to create mask on signals and return only the visible parts of the signals.
- Parameters:
children -- list, signals tags id (children of y axis)
plot_tag -- str/id, plot id (parent of axis)
- GUI.hide(sender, app_data, user_data)[source]¶
Hides streams in plot, except mean and standard deviation and updates checkbox calue
- Parameters:
sender -- button id
app_data -- value of checkbox
user_data -- streams, checkboxes
- GUI.interval_events(tab_tag, label1, label2, mini=15, maxi=15)[source]¶
Adds buttons to get event-locked segmentation interval.
- Parameters:
tab_tag -- Description
label1 -- str, label of input 1
label2 -- str, label of input 2
mini -- default to 15s, value of before interval (s)
maxi -- default to 15s, value of after interval (s)
- GUI.plot_coherence(parameter_values, tab_label)[source]¶
Computes default coherence (welch)
- Parameters:
parameter_values -- Description
tab_label -- Description
- GUI.plot_cross_correlation(parameter_values, tab_tag, tags, mode=None)[source]¶
Plots and computes cross-correlation between two signals, user-choosen, saved into keys 'a' and 'v' in parameter values.
- Parameters:
parameter_values -- Description
tab_tag -- Description
tags -- Description
mode -- Description
- GUI.plot_df_coherence(parameter_values, tab_tag, tags)[source]¶
Plots default coherence (welch method), computed in plot_coherence
- Parameters:
parameter_values -- Description
tab_tag -- Description
tags -- Description
- GUI.plot_featured_signal(signal_tags, tab_label, func, tab_tag, parameter_values, mode=None)[source]¶
Computes and plots method func (with parameter_values that are user-defined), to signals identified by signal_tags, to be ploted in tab_label, child of tab_tag.
Resulting func must be 2D.
May be applied to epoch segments, or raw signals.
- Parameters:
signal_tags -- list, of signals' id
tab_label -- str/int, tab id
func -- str, function name
tab_tag -- str/int, tab parent id
parameter_values -- dict, keys: parameter names, items: values
mode -- default None, if 'segment' gets signal data accordingly
- GUI.plot_multitaper_coherence(parameter_values, tab_tag, tags, flag=None)[source]¶
Computes and Plots multitaper coherence
- Parameters:
parameter_values -- Description
tab_tag -- Description
tags -- Description
flag -- Description
- GUI.plot_pac(tags, tab_tag, parameter_values, mode=None)[source]¶
Computes and plots Phase-Amplitude Coupling, for the selected streams and bands.
- Parameters:
tags -- Description
tab_tag -- Description
parameter_values -- Description
mode -- Description
- GUI.plot_spectrogram_joined(tags, tab_label, func, tab_tag, parameter_values, mode=None)[source]¶
Computes and plots spectrogram of joined recordings, per channel.
- Parameters:
tags -- list, signals' id
tab_label -- str/id, tab id
func -- str, function name
tab_tag -- str/id, parent tab id
parameter_values -- dict,
mode -- Description
- GUI.plot_spectrogram_og(tags, tab_label, func, tab_tag, parameter_values, mode='segment')[source]¶
Computes and plots spectrograms individually, into subplots, under one colormap.
- Parameters:
tags -- Description
tab_label -- Description
func -- Description
tab_tag -- Description
parameter_values -- Description
mode -- Description
- GUI.plot_td(signals, parent, tab_tag, signal_tags, files=None, events=False, count=[])[source]¶
Plot Time Domain signals (Streaming, Indefinite, Setup, Survey)
- Parameters:
signals -- array of signals dictionaries
parent -- y axis, parent of streams
tab_tag -- tab id
signal_tags -- tags of signals
files -- files id, for Combined window
events -- events data
count -- aiding object --> plots events according to their file
- GUI.plot_wavelet(tags, tab_label, func, tab_tag, parameter_values, mode=None)[source]¶
Plots wavelet, computed for all recordings individually.
- Parameters:
tags -- Description
tab_label -- Description
func -- Description
tab_tag -- Description
parameter_values -- Description
mode -- default to None
- GUI.plot_wavelet_joined(tags, tab_label, func, tab_tag, parameter_values, mode=None)[source]¶
Plots wavelet, computed for all recordings joined by channel.
- Parameters:
tags -- Description
tab_label -- Description
func -- Description
tab_tag -- Description
parameter_values -- Description
mode -- default to None
- GUI.recalculateMeanMetrics(sender, app_data, user_data)[source]¶
Internal: recaulculates mean metrics of Events
- Parameters:
sender -- button id
app_data --
user_data -- tab_tag
- GUI.reset_bands(sender, app_data, user_data)[source]¶
Internal: reset to default bands (D,T,A,B,G) to internal app_state memory dictinary
- GUI.sanitize_filename(filename)[source]¶
Internal: Removes or replaces invalid characters from filenames.
- GUI.save_band_powers_to_txt(sender, app_data, user_data)[source]¶
Internal: saves band mean power over day signals info[channel][band] = {
timestamp: [mean, std],
}
- GUI.save_plot(sender, app_data, user_data)[source]¶
Prepares data from selected plot to be exported into png file. plot_type, plot_tag, y_axis, colormap_int = user_data colomap_int:
int: for regular plots
rgba array: timeline (specific colors)
string: 3D (name of colormap)
- GUI.save_signals(sender, app_data, user_data)[source]¶
Internal: Prepares data from selected plot to save signals into .csv file parent, plot, plot_type = user_data
- GUI.save_table_to_file(sender, app_data, user_data)[source]¶
Internal: Saves DPG table data to a .csv or .txt file
- GUI.segment_signal(tab_tag, signal_tags, plot_tag)[source]¶
Adds buttons to perform segmentation of time-domain signals
- Parameters:
tab_tag -- Description
signal_tags -- Description
plot_tag -- Description
- GUI.set_colormap_range(sender, app_data, user_data)[source]¶
Resets colormap range of spectrogram, of colormap and reconfigures spectrograms to same interval.
tab_label: str/int, tab id spec_tags: list, spectrogram's series' id colormap_tag: str/int, colormap id
- Parameters:
sender -- Description
app_data -- Description
user_data -- tab_label, spec_tags, colormap_tag
- GUI.set_font(size=16, just_theme=False)[source]¶
Redefines actual theme to support function resize_font
- Parameters:
size -- int
- GUI.switch_theme(sender, app_data, user_data)[source]¶
Binds selected theme to GUI
- Parameters:
user_data -- theme
- GUI.toggleDisplay(signals, signal_tags, window_id, tab_tag, plot_tag=None, tables=[], dates=None, colors=None)[source]¶
Documentation
- GUI.toggleType(signal_tags, parent, user_data)[source]¶
Internal: toggles visibility according to the
- Parameters:
signal_tags -- Description
parent -- Description
user_data -- Description
- GUI.toggleVisibility(signal_tags, parent, group, user_data)[source]¶
Internal: creates checkbox for each plotted tag (in signal_tags). Callback defines tag/plot visibility.
- Parameters:
signal_tags -- list of tags, identifiers of each added plot series
parent -- parent of tags (y axis)
group -- group that encapsulates plot
user_data -- window_id
- GUI.updateKeySignalbyIdx(value, tab_tag, series_tag, key)[source]¶
Updates app_state memory dictionary with processed signal (cut or new events)
- Parameters:
value -- list, new signal
tab_tag -- Description
series_tag -- Description
key -- str, key onto the value will be updated, must exist
- GUI.updateSignalbyIdx(value, tab_tag, series_tag, func=None, mode=None, new_tab_tag=None)[source]¶
Updates signal after filtering and saves wavelet into app_state memory.
- Parameters:
value -- list, new signal
tab_tag -- Description
series_tag -- Description
func -- Description
mode -- Description
new_tab_tag -- Description
- GUI.update_plot_td(tab_tag, signal_tags, title=None, signal_mode=None)[source]¶
Updates tab plot, after filtering and segmentation
- Parameters:
tab_tag -- tab id
signal_tags -- array of plotted signals' id
title -- updates title after performed task
signal_mode -- default to None (normal), else considered segments (epoch)
- GUI.update_table(table_tag, unit)[source]¶
Update the table by replacing values with their dB equivalents.
- Parameters:
table_tag --
type -- str, 'dB' or else