[add] auto set plotmethod 'fast' for large dataset

This commit is contained in:
Marcel Paffrath 2018-04-18 16:44:33 +02:00
parent 349715d13c
commit af54cb0d4b
2 changed files with 12 additions and 3 deletions

View File

@ -79,7 +79,7 @@ from pylot.core.util.utils import fnConstructor, getLogin, \
full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \ full_range, readFilterInformation, trim_station_components, check4gaps, make_pen, pick_color_plt, \
pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, has_spe, \ pick_linestyle_plt, remove_underscores, check4doubled, identifyPhaseID, excludeQualityClasses, has_spe, \
check4rotated, transform_colors_mpl, transform_colors_mpl_str, getAutoFilteroptions, check_all_obspy, \ check4rotated, transform_colors_mpl, transform_colors_mpl_str, getAutoFilteroptions, check_all_obspy, \
check_all_pylot check_all_pylot, real_Bool
from pylot.core.util.event import Event from pylot.core.util.event import Event
from pylot.core.io.location import create_creation_info, create_event from pylot.core.io.location import create_creation_info, create_event
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \ from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
@ -1672,7 +1672,11 @@ class MainWindow(QMainWindow):
npts = self.get_npts_to_plot() npts = self.get_npts_to_plot()
npts2plot = npts/nth_sample npts2plot = npts/nth_sample
if npts2plot < npts_max: if npts2plot < npts_max:
return settings.setValue('large_dataset', False)
else:
settings.setValue('large_dataset', True)
self.update_status('Dataset is very large. Using fast plotting method (MIN/MAX)', 10000)
settings.sync()
# nth_sample_new = int(np.ceil(npts/npts_max)) # 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 " \ # 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 " \ # "nth_sample = {nth_sample} a total of {npts2plot} points will be plotted which is more " \
@ -1891,8 +1895,12 @@ class MainWindow(QMainWindow):
# wfst += self.get_data().getWFData().select(component=alter_comp) # wfst += self.get_data().getWFData().select(component=alter_comp)
plotWidget = self.getPlotWidget() plotWidget = self.getPlotWidget()
self.adjustPlotHeight() self.adjustPlotHeight()
if real_Bool(settings.value('large_dataset')) == True:
method = 'fast'
else:
method = 'normal'
plots = plotWidget.plotWFData(wfdata=wfst, wfsyn=wfsyn, title=title, mapping=False, component=comp, plots = plotWidget.plotWFData(wfdata=wfst, wfsyn=wfsyn, title=title, mapping=False, component=comp,
nth_sample=int(nth_sample)) nth_sample=int(nth_sample), method=method)
return plots return plots
def adjustPlotHeight(self): def adjustPlotHeight(self):

View File

@ -540,6 +540,7 @@ class WaveformWidgetPG(QtGui.QWidget):
for n, (network, station, channel) in enumerate(nsc): for n, (network, station, channel) in enumerate(nsc):
n+=1 n+=1
st = st_select.select(network=network, station=station, channel=channel) st = st_select.select(network=network, station=station, channel=channel)
trace = st[0].copy()
st_syn = wfsyn.select(network=network, station=station, channel=channel) st_syn = wfsyn.select(network=network, station=station, channel=channel)
if st_syn: if st_syn:
trace_syn = st_syn[0].copy() trace_syn = st_syn[0].copy()