wonambi.widgets.analysis module
Dialogs for analyses, such as power spectra, PAC, event parameters
- class wonambi.widgets.analysis.AnalysisDialog(parent)[source]
Bases:
ChannelDialog
Dialog for specifying various types of analyses: per event, per epoch or per entire segments of signal. PSD, PAC, event metrics. Option to transform signal before analysis. Creates a pickle object.
- parent
the main window
- Type:
instance of QMainWindow
- nseg
number of segments in current selection
- Type:
int
- button_clicked(button)[source]
Action when button was clicked.
- Parameters:
button (instance of QPushButton) – which button was pressed
- compute_freq(csd=False)[source]
Compute frequency domain analysis.
- Returns:
list of dict – each item is a dict where ‘data’ is an instance of ChanFreq for a single segment of signal, ‘name’ is the event type, if applicable, ‘times’ is a tuple of the start and end times in sec, ‘duration’ is the actual duration of the segment, in seconds (can be dissociated from ‘times’ if the signal was concatenated) and with ‘chan’ (str), ‘stage’ (str) and ‘cycle’ (int)
- compute_freq_cross(csd, asd, output='coherence')[source]
Compute cross-spectrum, gain, phase shift and/or coherence.
- Parameters:
- Returns:
tuple of list of dict with ‘data’ key as instance of ChanFreq – if coherence, tuple contains one dict if gainphase, tuple contains: xgain, ygain, phase
where xgain is gain with x as input and y as output
- plot_freq(x, y, title='', ylabel=None, scale='semilogy')[source]
Plot mean frequency spectrum and display in dialog.
- Parameters:
x (list) – vector with frequencies
y (ndarray) – vector with amplitudes
title (str) – plot title
ylabel (str) – plot y label
scale (str) – semilogy, loglog or linear
- report_fooof(x, y, suffix)[source]
Create FOOOF (fitting oscillations and 1/f) report.
- Parameters:
x (ndarray) – vector with frequencies
y (ndarray) – vector with amplitudes
- class wonambi.widgets.analysis.PlotCanvas(parent=None, width=5, height=4, dpi=100)[source]
Bases:
object
Widget for showing plots.
- plot(x, y, title, ylabel, scale='semilogy', idx_lim=(1, -1))[source]
Plot the data.
- Parameters:
x (ndarray) – vector with frequencies
y (ndarray) – vector with amplitudes
title (str) – title of the plot, to appear above it
ylabel (str) – label for the y-axis
scale (str) – ‘log y-axis’, ‘log both axes’ or ‘linear’, to set axis scaling
idx_lim (tuple of (int or None)) – indices of the data to plot. by default, the first value is left out, because of assymptotic tendencies near 0 Hz.