From c655371baec9c33d680dc0d08bf8b5f18c340495 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 5 Apr 2018 15:34:49 +0200 Subject: [PATCH 1/2] [minor] add RELEASE-VERSION to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6add511e..c99398e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc -*~ \ No newline at end of file +*~ +pylot/RELEASE-VERSION From b730b16ac630612f76fe09bd38367c18cf11018f Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 5 Apr 2018 16:02:53 +0200 Subject: [PATCH 2/2] [add] check for plot quantity --- PyLoT.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/PyLoT.py b/PyLoT.py index fc1cf229..589a4cf9 100755 --- a/PyLoT.py +++ b/PyLoT.py @@ -1653,6 +1653,35 @@ class MainWindow(QMainWindow): checkRotated=True, metadata=self.metadata) + def check_plot_quantity(self): + settings = QSettings() + nth_sample = settings.value("nth_sample") if settings.value("nth_sample") else 1 + npts_max = 1e6 + npts = self.get_npts_to_plot() + npts2plot = npts/nth_sample + if npts2plot < npts_max: + return + nth_sample_new = int(np.ceil(npts/npts_max)) + message = "You are about to plot a huge dataset with {npts} datapoints. With a current setting of " \ + "nth_sample = {nth_sample} a total of {npts2plot} points will be plotted which is more " \ + "than the maximum setting of {npts_max}. " \ + "PyLoT recommends to raise nth_sample from {nth_sample} to {nth_sample_new}. Continue?" + + ans = QMessageBox.question(self, self.tr("Optimize plot performance..."), + self.tr(message.format(npts=npts, + nth_sample=nth_sample, + npts_max=npts_max, + nth_sample_new=nth_sample_new, + npts2plot=npts2plot)), + QMessageBox.Yes | QMessageBox.No, + QMessageBox.Yes) + if ans == QMessageBox.Yes: + settings.setValue("nth_sample", nth_sample_new) + settings.sync() + + def get_npts_to_plot(self): + return sum(trace.stats.npts for trace in self.data.getWFData()) + def connectWFplotEvents(self): ''' Connect signals refering to WF-Dataplot (select station, tutor_user, scrolling) @@ -1816,6 +1845,7 @@ class MainWindow(QMainWindow): ''' Open a modal thread to plot current waveform data. ''' + self.check_plot_quantity() self.clearWaveformDataPlot() self.wfp_thread = Thread(self, self.plotWaveformData, arg=filter,