Skip to content

Commit

Permalink
Merge pull request #22 from tensionhead/21-batch-processing-of-indivi…
Browse files Browse the repository at this point in the history
…dual-fourier-distributions

21 batch processing of individual fourier distributions
  • Loading branch information
tensionhead authored Jun 5, 2023
2 parents 0cf7997 + d8defd5 commit 2df4a8e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyboat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import argparse

__version__ = "0.9.11"
__version__ = "0.9.12"

# the object oriented API
from .api import WAnalyzer
Expand Down
8 changes: 4 additions & 4 deletions pyboat/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ 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=-12, fontsize=0.9 * label_size)
# cb.set_label('$|\mathcal{W}_{\Psi}(t,T)|^2$', rotation = "horizontal",labelpad = 5,fontsize = 15)
cb.set_label("Wavelet Power", rotation="horizontal", labelpad=-12, fontsize=0.9 * label_size)


def plot_modulus(mod_ax, time_vector, modulus, periods, p_max=None):
Expand Down Expand Up @@ -364,8 +364,8 @@ def plot_modulus(mod_ax, time_vector, 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=-12, fontsize=0.9 * label_size)
# cb.set_label('$|\mathcal{W}_{\Psi}(t,T)|^2$',rotation = 'horizontal',labelpad = 5,fontsize = 15)
cb.set_label("Wavelet Power", rotation="horizontal", labelpad=-12, fontsize=0.9 * label_size)


def draw_Wavelet_ridge(ax, ridge_data, marker_size=1.5):
Expand Down
27 changes: 22 additions & 5 deletions pyboat/ui/batch_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def initUI(self, wlet_pars):
self.cb_plot_global_spec = QCheckBox("Global Wavelet Spectrum")
self.cb_plot_global_spec.setStatusTip("Ensemble averaged Wavelet spectrum")

self.cb_plot_Fourier_dis = QCheckBox("Global Fourier Estimate")
self.cb_plot_Fourier_dis = QCheckBox("Ensemble Fourier Estimate")
self.cb_plot_Fourier_dis.setStatusTip(
"Ensemble median and quartiles of the time averaged Wavelet spectra"
"Plots median and quartiles of the ensemble Fourier power spectral distribution"
)

self.cb_power_hist = QCheckBox("Ridge Power Histogram")
Expand Down Expand Up @@ -169,7 +169,7 @@ def initUI(self, wlet_pars):

self.cb_readout = QCheckBox("Ridge Readouts")
self.cb_readout.setStatusTip(
"Saves one analysis result per signal to disc as csv"
"Saves one ridge analysis result per signal to disc as csv"
)

self.cb_readout_plots = QCheckBox("Ridge Readout Plots")
Expand All @@ -183,6 +183,11 @@ def initUI(self, wlet_pars):
"Saves period, amplitude, power and phase summary statistics to csv files"
)

self.cb_Fourier_est = QCheckBox("Fourier Estimates")
self.cb_Fourier_est.setStatusTip(
"Saves individual Fourier power spectral estimates"
)

self.cb_save_Fourier_dis = QCheckBox("Global Fourier Estimate")
self.cb_save_Fourier_dis.setStatusTip(
"Saves median and quartiles of the ensemble Fourier power spectral distribution"
Expand All @@ -199,8 +204,9 @@ def initUI(self, wlet_pars):
lo.addWidget(self.cb_filtered_sigs, 0, 0)
lo.addWidget(self.cb_readout, 1, 0)
lo.addWidget(self.cb_sorted_powers, 2, 0)
lo.addWidget(self.cb_save_ensemble_dynamics, 3, 0)
lo.addWidget(self.cb_Fourier_est, 3, 0)
lo.addWidget(self.cb_save_Fourier_dis, 4, 0)
lo.addWidget(self.cb_save_ensemble_dynamics, 5, 0)

export_data.setLayout(lo)

Expand Down Expand Up @@ -377,6 +383,16 @@ def run_batch(self):

# --- Fourier Distribution Outputs ---

if self.cb_Fourier_est.isChecked():

fname = os.path.join(OutPath, f"{dataset_name}_fourier-estimates.csv")
if self.debug:
print(f"Saving fourier estimate to {fname}")

df_fouriers.to_csv(
fname, sep=",", float_format=float_format, index=True
)

if self.cb_plot_Fourier_dis.isChecked():

self.fdw = FourierDistributionWindow(
Expand Down Expand Up @@ -537,6 +553,7 @@ def do_the_loop(self, norm_vec):
# ensemble averaged wavelet spectrum
global_modulus = np.zeros((len(periods), len(norm_vec)))

# TODO: parallelize
for i, signal_id in enumerate(self.parentDV.df):

# log to terminal
Expand Down Expand Up @@ -816,7 +833,7 @@ def __init__(self, modulus, time_unit, dataset_name="", parent=None):

def initUI(self, dataset_name):

self.setWindowTitle(f"Global Wavelet Spectrum - {dataset_name}")
self.setWindowTitle(f"Ensemble Wavelet Spectrum - {dataset_name}")
self.setGeometry(410, 360, 700, 500)

Canvas = mkGenericCanvas()
Expand Down

0 comments on commit 2df4a8e

Please sign in to comment.