Commit a1d51bc3 authored by Gregor Moenke's avatar Gregor Moenke

Status bars

parent e759919d
### pyBOAT 0.8.2
- Added time averaging of Wavelet spectra <-> Fourier estimates
- Added Fourier distribution for ensembles
- Added Fourier distribution for ensembles, can be used for empirical background estimation
- Reworked FFT visualizations
- Status bars with tool tips for all analysis windows
### pyBOAT 0.8.17
......
......@@ -3,7 +3,7 @@
import sys,os
import argparse
__version__ = '0.8.18'
__version__ = '0.8.2'
# the object oriented API
from .api import WAnalyzer
......
......@@ -278,7 +278,7 @@ def plot_signal_modulus(axs, time_vector, signal, modulus, periods, p_max=None):
cb.set_ticks(cb_ticks)
cb.ax.set_xticklabels(cb_ticks, fontsize=tick_label_size)
# cb.set_label('$|\mathcal{W}_{\Psi}(t,T)|^2$',rotation = '0',labelpad = 5,fontsize = 15)
cb.set_label("Wavelet Power", rotation="0", labelpad=-17, fontsize=0.9 * label_size)
cb.set_label("Wavelet Power", rotation="0", labelpad=-12, fontsize=0.9 * label_size)
def draw_Wavelet_ridge(ax, ridge_data, marker_size=1.5):
......
This diff is collapsed.
......@@ -4,7 +4,7 @@ import pandas as pd
import matplotlib.pyplot as plt
from os.path import expanduser
from PyQt5.QtWidgets import QCheckBox, QComboBox, QFileDialog, QAction, QLabel, QLineEdit, QPushButton, QMessageBox, QSizePolicy, QWidget, QVBoxLayout, QHBoxLayout, QDialog, QGroupBox, QGridLayout, QProgressBar, QSpacerItem, QFrame
from PyQt5.QtWidgets import QCheckBox, QComboBox, QFileDialog, QAction, QLabel, QLineEdit, QPushButton, QMessageBox, QSizePolicy, QWidget, QVBoxLayout, QHBoxLayout, QDialog, QGroupBox, QGridLayout, QProgressBar, QSpacerItem, QFrame, QMainWindow
from PyQt5.QtGui import QDoubleValidator, QIntValidator, QScreen
from PyQt5.QtCore import Qt, pyqtSignal
......@@ -18,7 +18,7 @@ import pyboat
from pyboat import plotting as pl
from pyboat import ensemble_measures as em
class BatchProcessWindow(QWidget):
class BatchProcessWindow(QMainWindow):
'''
The parent is a DataViewer instance holding the
......@@ -49,6 +49,10 @@ class BatchProcessWindow(QWidget):
# from the DataViewer
self.wlet_pars = wlet_pars
# for the status bar
main_widget = QWidget()
self.statusBar()
main_layout = QGridLayout()
......@@ -61,7 +65,7 @@ class BatchProcessWindow(QWidget):
thresh_edit.setValidator(posfloatV)
thresh_edit.insert('0')
thresh_edit.setMaximumWidth(60)
thresh_edit.setToolTip('Ridge points below that power value will be filtered out ')
thresh_edit.setStatusTip('Ridge points below that power value will be filtered out ')
self.thresh_edit = thresh_edit
......@@ -71,7 +75,7 @@ class BatchProcessWindow(QWidget):
smooth_edit.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
smooth_edit.setValidator( QIntValidator(bottom = 3, top = 99999999) )
tt = 'Savitkzy-Golay window size for smoothing the ridge,\nleave blank for no smoothing'
smooth_edit.setToolTip(tt)
smooth_edit.setStatusTip(tt)
self.smooth_edit = smooth_edit
ridge_options_layout = QGridLayout()
......@@ -83,41 +87,41 @@ class BatchProcessWindow(QWidget):
# -- Plotting Options --
plotting_options = QGroupBox('Summary Statistics')
self.cb_power_dis = QCheckBox('Ensemble Power Distribution')
self.cb_power_dis.setToolTip('Show time-averaged wavelet power of the ensemble')
plotting_options = QGroupBox('Ensemble Summary Statistics')
self.cb_power_dis = QCheckBox('Ridge Power Distribution')
self.cb_power_dis.setStatusTip('Show time-averaged ridge powers distribution')
self.cb_plot_ens_dynamics = QCheckBox('Ensemble Dynamics')
self.cb_plot_ens_dynamics.setToolTip('Show period, amplitude and phase distribution over time')
self.cb_plot_ens_dynamics.setStatusTip('Show period, amplitude and phase distribution over time')
self.cb_plot_Fourier_dis = QCheckBox('Fourier Spectra Distribution')
self.cb_plot_Fourier_dis.setToolTip('Distribution of the time averaged Wavelet spectra')
self.cb_plot_Fourier_dis.setStatusTip('Distribution of the time averaged Wavelet spectra')
lo = QGridLayout()
lo.addWidget(self.cb_power_dis,0,0)
lo.addWidget(self.cb_plot_ens_dynamics,1,0)
lo.addWidget(self.cb_plot_Fourier_dis,2,0)
lo.addWidget(self.cb_plot_ens_dynamics,0,0)
lo.addWidget(self.cb_plot_Fourier_dis,1,0)
lo.addWidget(self.cb_power_dis,2,0)
plotting_options.setLayout(lo)
# -- Save Out Results --
export_options = QGroupBox('Export Results')
export_options.setToolTip('Saves also the summary statistics..')
export_options.setStatusTip("Creates various figures and csv's")
export_options.setCheckable(True)
export_options.setChecked(False)
self.cb_specs = QCheckBox('Wavelet Spectra')
self.cb_specs.setToolTip("Saves the individual wavelet spectra as images (png's)")
self.cb_specs.setStatusTip("Saves the individual wavelet spectra as images (png's)")
self.cb_readout = QCheckBox('Ridge Readouts')
self.cb_readout.setToolTip('Saves one data frame per signal to disc as csv')
self.cb_readout.setStatusTip('Saves one data frame per signal to disc as csv')
self.cb_readout_plots = QCheckBox('Ridge Readout Plots')
self.cb_readout_plots.setToolTip("Saves the individual readout plots to disc as png's")
self.cb_readout_plots.setStatusTip("Saves the individual readout plots to disc as png's")
self.cb_sorted_powers = QCheckBox('Sorted Average Powers')
self.cb_sorted_powers.setToolTip("Saves the time-averaged powers in descending order")
self.cb_sorted_powers.setStatusTip("Saves the time-averaged ridge powers in descending order")
self.cb_save_ensemble_dynamics = QCheckBox('Ensemble Dynamics')
self.cb_save_ensemble_dynamics.setToolTip("Saves each period, amplitude and phase summary statistics to a csv table")
self.cb_save_ensemble_dynamics.setStatusTip("Saves each period, amplitude and phase summary statistics to a file")
self.cb_save_Fourier_dis = QCheckBox('Fourier Distribution')
self.cb_save_Fourier_dis.setToolTip("Saves median and quartiles of the Fourier power spectra")
self.cb_save_Fourier_dis.setStatusTip("Saves median and quartiles of the Fourier power spectral distribution")
home = expanduser("~")
OutPath_label = QLabel('Export to:')
......@@ -187,7 +191,9 @@ class BatchProcessWindow(QWidget):
main_layout.addWidget(process_box, 2, 0, 1, 2)
# set main layout
self.setLayout(main_layout)
main_widget.setLayout(main_layout)
self.setCentralWidget(main_widget)
self.show()
......
......@@ -44,7 +44,7 @@ pl.tick_label_size = 12
pl.label_size = 14
class DataViewer(QWidget):
class DataViewer(QMainWindow):
def __init__(self, data, debug=False):
super().__init__()
......@@ -79,6 +79,10 @@ class DataViewer(QWidget):
self.setWindowTitle(f"DataViewer - {self.df.name}")
self.setGeometry(80, 300, 900, 650)
# for the status bar
main_widget = QWidget()
self.statusBar()
self.tsCanvas = mkTimeSeriesCanvas()
main_frame = QWidget()
self.tsCanvas.setParent(main_frame)
......@@ -102,7 +106,7 @@ class DataViewer(QWidget):
# the signal selection box
SignalBox = QComboBox(self)
SignalBox.setToolTip("..or just click on a signal in the table!")
SignalBox.setStatusTip("..or just click directly on a signal in the table!")
main_layout_v = QVBoxLayout() # The whole Layout
# Data selction drop-down
......@@ -110,13 +114,13 @@ class DataViewer(QWidget):
dt_label = QLabel("Sampling Interval:")
dt_edit = QLineEdit()
dt_edit.setToolTip("How much time in between two recordings?")
dt_edit.setStatusTip("How much time in between two recordings?")
dt_edit.setMinimumSize(70, 0) # no effect :/
dt_edit.setValidator(posfloatV)
unit_label = QLabel("Time Unit:")
unit_edit = QLineEdit(self)
unit_edit.setToolTip("Changes only the axis labels!")
unit_edit.setStatusTip("Changes only the axis labels..")
unit_edit.setMinimumSize(70, 0)
top_bar_box = QWidget()
......@@ -145,7 +149,7 @@ class DataViewer(QWidget):
self.T_c_edit = QLineEdit()
self.T_c_edit.setMaximumWidth(70)
self.T_c_edit.setValidator(posfloatV)
self.T_c_edit.setToolTip("..in time units, e.g. 120min")
self.T_c_edit.setStatusTip("..in time units, e.g. 120min")
sinc_options_box = QGroupBox("Sinc Detrending")
sinc_options_layout = QGridLayout()
......@@ -157,7 +161,7 @@ class DataViewer(QWidget):
self.L_edit = QLineEdit()
self.L_edit.setMaximumWidth(70)
self.L_edit.setValidator(self.envelopeV)
self.L_edit.setToolTip("..in time units, e.g. 120min")
self.L_edit.setStatusTip("..in time units, e.g. 120min")
envelope_options_box = QGroupBox("Amplitude Envelope")
envelope_options_layout = QGridLayout()
......@@ -170,16 +174,24 @@ class DataViewer(QWidget):
plot_options_layout = QGridLayout()
self.cb_raw = QCheckBox("Raw Signal", self)
self.cb_raw.setStatusTip("Plots the raw unfiltered signal")
self.cb_trend = QCheckBox("Trend", self)
self.cb_trend.setStatusTip("Plots the sinc filtered signal")
self.cb_detrend = QCheckBox("Detrended Signal", self)
self.cb_detrend.setStatusTip("Plots the signal after trend subtraction (detrending)")
self.cb_envelope = QCheckBox("Envelope", self)
self.cb_envelope.setStatusTip("Plots the estimated amplitude envelope")
plotButton = QPushButton("Refresh Plot", self)
plotButton.setStatusTip("Updates the plot with the new filter parameter values")
plotButton.clicked.connect(self.doPlot)
saveButton = QPushButton("Save Filter Results", self)
saveButton.clicked.connect(self.save_out_trend)
saveButton.setToolTip("Writes the trend and the detrended signal into a file")
saveButton.setStatusTip("Writes the trend and the detrended signal into a file")
## checkbox layout
plot_options_layout.addWidget(self.cb_raw, 0, 0)
......@@ -223,16 +235,16 @@ class DataViewer(QWidget):
## for wavlet params, button, etc.
self.T_min = QLineEdit()
self.T_min.setToolTip("This is the lower period limit")
self.T_min.setStatusTip("This is the lower period limit")
self.step_num = QLineEdit()
self.step_num.insert("200")
self.step_num.setToolTip("Increase this number for more resolution")
self.step_num.setStatusTip("Increase this number for more spectral resolution")
self.T_max = QLineEdit()
self.T_max.setToolTip("This is the upper period limit")
self.T_max.setStatusTip("This is the upper period limit")
self.p_max = QLineEdit()
self.p_max.setToolTip(
"Enter a fixed value for all signals or leave blank for automatic scaling"
self.p_max.setStatusTip(
"Enter a fixed value or leave blank for automatic wavelet power scaling"
)
# self.p_max.insert(str(20)) # leave blank
......@@ -249,12 +261,12 @@ class DataViewer(QWidget):
wletButton = QPushButton("Analyze Signal", self)
wletButton.setStyleSheet("background-color: lightblue")
wletButton.setToolTip("Start the wavelet analysis!")
wletButton.setStatusTip("Opens the wavelet analysis..")
wletButton.clicked.connect(self.run_wavelet_ana)
batchButton = QPushButton("Analyze All..", self)
batchButton.clicked.connect(self.run_batch)
batchButton.setToolTip("Sets up the analysis for all signals in the table")
batchButton.setStatusTip("Starts the batch processing")
## add button to layout
wlet_button_layout_h = QHBoxLayout()
......@@ -365,7 +377,8 @@ class DataViewer(QWidget):
unit_edit.textChanged[str].connect(self.qset_time_unit)
unit_edit.insert("min") # standard time unit is minutes
self.setLayout(main_layout_v)
main_widget.setLayout(main_layout_v)
self.setCentralWidget(main_widget)
self.show()
# trigger initial plot?!
......
......@@ -59,6 +59,8 @@ class MainWindow(QMainWindow):
# Actions for the menu - status bar
main_widget = QWidget()
# online help in lower left corner
self.statusBar()
quitAction = QAction("&Quit", self)
quitAction.setShortcut("Ctrl+Q")
......@@ -73,8 +75,6 @@ class MainWindow(QMainWindow):
go_to_doc = QAction("&Documentation..", self)
go_to_doc.triggered.connect(self.open_doc_link)
# online help in lower left corner
self.statusBar()
# the menu bar
......
......@@ -38,7 +38,7 @@ pl.tick_label_size = 12
pl.label_size = 14
class SynthSignalGen(QWidget):
class SynthSignalGen(QMainWindow):
"""
This is basically a clone of the
......@@ -75,6 +75,9 @@ class SynthSignalGen(QWidget):
self.setWindowTitle(f"Synthetic Signal Generator")
self.setGeometry(80, 300, 900, 650)
main_widget = QWidget()
self.statusBar()
self.tsCanvas = mkTimeSeriesCanvas()
main_frame = QWidget()
self.tsCanvas.setParent(main_frame)
......@@ -101,7 +104,7 @@ class SynthSignalGen(QWidget):
Nt_label = QLabel("# Samples")
self.Nt_edit = QLineEdit()
self.Nt_edit.setToolTip(
self.Nt_edit.setStatusTip(
"Number of data points, minimum is 10, maximum is 10 000!"
)
set_max_width(self.Nt_edit, iwidth)
......@@ -114,33 +117,34 @@ class SynthSignalGen(QWidget):
basics_box_layout.setSpacing(2.5)
basics_box.setLayout(basics_box_layout)
basics_box_layout.addWidget(Nt_label)
basics_box_layout.addWidget(self.Nt_edit)
basics_box_layout.addWidget(dt_label)
basics_box_layout.addWidget(dt_edit)
basics_box_layout.addWidget(Nt_label)
basics_box_layout.addWidget(self.Nt_edit)
basics_box_layout.addWidget(unit_label)
basics_box_layout.addWidget(unit_edit)
basics_box_layout.addStretch(0)
# --- chirp 1 ---
T11_label = QLabel("Initial Period")
self.T11_edit = QLineEdit()
self.T11_edit.setToolTip("Period at the beginning of the signal")
self.T11_edit.setStatusTip("Period at the beginning of the signal")
set_max_width(self.T11_edit, iwidth)
self.T11_edit.setValidator(posfloatV)
self.T11_edit.insert(str(50)) # initial period of chirp 1
T12_label = QLabel("Final Period")
self.T12_edit = QLineEdit()
self.T12_edit.setToolTip("Period at the end of the signal")
self.T12_edit.setStatusTip("Period at the end of the signal")
set_max_width(self.T12_edit, iwidth)
self.T12_edit.setValidator(posfloatV)
self.T12_edit.insert(str(150)) # initial period of chirp 1
A1_label = QLabel("Amplitude")
self.A1_edit = QLineEdit()
self.A1_edit.setToolTip("The amplitude :)")
self.A1_edit.setStatusTip("The amplitude :)")
set_max_width(self.A1_edit, iwidth)
self.A1_edit.setValidator(posfloatV)
self.A1_edit.insert(str(1)) # initial amplitude
......@@ -165,21 +169,21 @@ class SynthSignalGen(QWidget):
T21_label = QLabel("Initial Period")
self.T21_edit = QLineEdit()
self.T21_edit.setToolTip("Period at the beginning of the signal")
self.T21_edit.setStatusTip("Period at the beginning of the signal")
set_max_width(self.T21_edit, iwidth)
self.T21_edit.setValidator(posfloatV)
self.T21_edit.insert(str(1000)) # initial period of chirp 1
T22_label = QLabel("Final Period")
self.T22_edit = QLineEdit()
self.T22_edit.setToolTip("Period at the end of the signal")
self.T22_edit.setStatusTip("Period at the end of the signal")
set_max_width(self.T22_edit, iwidth)
self.T22_edit.setValidator(posfloatV)
self.T22_edit.insert(str(1000)) # initial period of chirp 1
A2_label = QLabel("Amplitude")
self.A2_edit = QLineEdit()
self.A2_edit.setToolTip("Can be negative to induce different trends..")
self.A2_edit.setStatusTip("Can be negative to induce different trends..")
set_max_width(self.A2_edit, iwidth)
self.A2_edit.setValidator(floatV)
self.A2_edit.insert(str(2)) # initial amplitude
......@@ -201,14 +205,15 @@ class SynthSignalGen(QWidget):
# --- the AR1 box ---
self.noise_box = QGroupBox("Noise")
self.noise_box.setStatusTip("Adds colored AR(1) noise to the signal")
self.noise_box.setCheckable(True)
self.noise_box.setChecked(False)
noise_box_layout = QVBoxLayout()
self.noise_box.setLayout(noise_box_layout)
alpha_label = QLabel("AR1 parameter")
alpha_label = QLabel("AR(1) parameter")
self.alpha_edit = QLineEdit(parent=self.noise_box)
self.alpha_edit.setToolTip("0 is white noise, must be smaller than 1!")
self.alpha_edit.setStatusTip("0 is white noise, must be smaller than 1!")
set_max_width(self.alpha_edit, iwidth)
# does not work as expected :/
V1 = QDoubleValidator()
......@@ -220,7 +225,7 @@ class SynthSignalGen(QWidget):
d_label = QLabel("Noise Strength")
self.d_edit = QLineEdit(parent=self.noise_box)
self.d_edit.setToolTip("Compare to amplitudes..")
self.d_edit.setStatusTip("Relative to oscillator amplitudes..")
set_max_width(self.d_edit, iwidth)
self.d_edit.setValidator(QDoubleValidator(bottom=0, top=999999))
self.d_edit.insert("0.5") # initial noise strength
......@@ -235,7 +240,7 @@ class SynthSignalGen(QWidget):
tau_label = QLabel("Decay Time")
self.tau_edit = QLineEdit()
self.tau_edit.setToolTip(
self.tau_edit.setStatusTip(
"Time after which the signal decayed to around a third of the initial amplitude"
)
set_max_width(self.tau_edit, iwidth)
......@@ -256,7 +261,7 @@ class SynthSignalGen(QWidget):
# --- the create signal button
ssgButton = QPushButton("Synthesize Signal", self)
ssgButton.clicked.connect(self.create_signal)
ssgButton.setToolTip(
ssgButton.setStatusTip(
"Click again with same settings for different noise realizations"
)
ssgButton.setStyleSheet("background-color: orange")
......@@ -365,15 +370,15 @@ class SynthSignalGen(QWidget):
## for wavlet params, button, etc.
self.T_min = QLineEdit()
self.T_min.setToolTip("This is the lower period limit")
self.T_min.setStatusTip("This is the lower period limit")
self.step_num = QLineEdit()
self.step_num.insert("200")
self.step_num.setToolTip("Increase this number for more resolution")
self.step_num.setStatusTip("Increase this number for more resolution")
self.T_max = QLineEdit()
self.T_max.setToolTip("This is the upper period limit")
self.T_max.setStatusTip("This is the upper period limit")
self.p_max = QLineEdit()
self.p_max.setToolTip(
self.p_max.setStatusTip(
"Enter a fixed value for all signals or leave blank for automatic scaling"
)
......@@ -391,7 +396,7 @@ class SynthSignalGen(QWidget):
wletButton = QPushButton("Analyze Signal", self)
wletButton.clicked.connect(self.run_wavelet_ana)
wletButton.setToolTip("Start the wavelet analysis!")
wletButton.setStatusTip("Start the wavelet analysis!")
wletButton.setStyleSheet("background-color: lightblue")
## add button to layout
......@@ -495,9 +500,10 @@ class SynthSignalGen(QWidget):
# create the default signal
self.create_signal()
self.setLayout(main_layout_v)
main_widget.setLayout(main_layout_v)
self.setCentralWidget(main_widget)
self.show()
# probably all the toggle state variables are not needed -> read out checkboxes directly
def toggle_raw(self, state):
if state == Qt.Checked:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment