189 Channels shown in wrong order.

This commit is contained in:
Sebastian Wehling-Benatelli 2016-03-18 15:35:12 +01:00
parent 15080f1699
commit b8d680f54f
4 changed files with 15 additions and 5 deletions

View File

@ -535,7 +535,7 @@ class MainWindow(QMainWindow):
comp = self.getComponent() comp = self.getComponent()
title = 'section: {0} components'.format(zne_text[comp]) title = 'section: {0} components'.format(zne_text[comp])
wfst = self.getData().getWFData().select(component=comp) wfst = self.getData().getWFData().select(component=comp)
self.getPlotWidget().plotWFData(wfdata=wfst, title=title) self.getPlotWidget().plotWFData(wfdata=wfst, title=title, mapping=False)
self.draw() self.draw()
plotDict = self.getPlotWidget().getPlotDict() plotDict = self.getPlotWidget().getPlotDict()
pos = plotDict.keys() pos = plotDict.keys()

View File

@ -1 +1 @@
848d-dirty 1508-dirty

View File

@ -46,3 +46,7 @@ OUTPUTFORMATS = {'.xml':'QUAKEML',
'.obs':'NLLOC_OBS'} '.obs':'NLLOC_OBS'}
LOCTOOLS = dict(nll = nll, hsat = hsat, velest = velest) LOCTOOLS = dict(nll = nll, hsat = hsat, velest = velest)
COMPONENTS_MAPPING = dict(Z = 2, N = 1, E = 0)
COMPONENTS_MAPPING['1'] = 1
COMPONENTS_MAPPING['2'] = 0

View File

@ -25,7 +25,8 @@ from obspy import Stream, UTCDateTime
from pylot.core.read.inputs import FilterOptions from pylot.core.read.inputs import FilterOptions
from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin,\ from pylot.core.pick.utils import getSNR, earllatepicker, getnoisewin,\
getResolutionWindow getResolutionWindow
from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, LOCTOOLS from pylot.core.util.defaults import OUTPUTFORMATS, FILTERDEFAULTS, LOCTOOLS,\
COMPONENTS_MAPPING
from pylot.core.util.utils import prepTimeAxis, getGlobalTimes, scaleWFData, \ from pylot.core.util.utils import prepTimeAxis, getGlobalTimes, scaleWFData, \
demeanTrace, isSorted, findComboBoxIndex demeanTrace, isSorted, findComboBoxIndex
@ -87,13 +88,18 @@ class MPLWidget(FigureCanvas):
self._parent = parent self._parent = parent
def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None, def plotWFData(self, wfdata, title=None, zoomx=None, zoomy=None,
noiselevel=None, scaleddata=False): noiselevel=None, scaleddata=False, mapping=True):
self.getAxes().cla() self.getAxes().cla()
self.clearPlotDict() self.clearPlotDict()
wfstart, wfend = getGlobalTimes(wfdata) wfstart, wfend = getGlobalTimes(wfdata)
nmax = 0
for n, trace in enumerate(wfdata): for n, trace in enumerate(wfdata):
channel = trace.stats.channel channel = trace.stats.channel
station = trace.stats.station station = trace.stats.station
if mapping:
comp = channel[-1]
n = COMPONENTS_MAPPING[comp]
nmax = n if n > nmax else nmax
msg = 'plotting %s channel of station %s' % (channel, station) msg = 'plotting %s channel of station %s' % (channel, station)
print(msg) print(msg)
stime = trace.stats.starttime - wfstart stime = trace.stats.starttime - wfstart
@ -110,7 +116,7 @@ class MPLWidget(FigureCanvas):
ylabel = '' ylabel = ''
self.updateWidget(xlabel, ylabel, title) self.updateWidget(xlabel, ylabel, title)
self.setXLims([0, wfend - wfstart]) self.setXLims([0, wfend - wfstart])
self.setYLims([-0.5, n + 0.5]) self.setYLims([-0.5, nmax + 0.5])
if zoomx is not None: if zoomx is not None:
self.setXLims(zoomx) self.setXLims(zoomx)
if zoomy is not None: if zoomy is not None: