MCPcopy Create free account
hub / github.com/SeisSol/SeisSol / plot

Method plot

postprocessing/visualization/receiver/src/View.py:166–247  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

164 navigation.refreshFolder()
165
166 def plot(self):
167 wfc = [wf for nav in self.navigations for wf in nav.getActiveWaveforms()]
168 for filt in self.filters:
169 if filt.isChecked():
170 for wf in wfc:
171 filt.apply(wf)
172
173 if self.normalize.isChecked():
174 #normalize traces
175 for nWf, wf in enumerate(wfc):
176 wfc[nWf].normalize()
177
178 if self.differentiate.isChecked():
179 #differentiate traces
180 for nWf, wf in enumerate(wfc):
181 wfc[nWf].differentiate()
182
183 if self.integrate.isChecked():
184 #integrate traces
185 for nWf, wf in enumerate(wfc):
186 wfc[nWf].integrate()
187
188 if self.diff.isChecked() and len(wfc) > 0:
189 wf0 = wfc.pop()
190 for nWf, wf in enumerate(wfc):
191 wfc[nWf].subtract(wf0)
192
193 names = set([name for wf in wfc for name in wf.waveforms.keys() if wf.show[name]])
194 numPlots = len(names)
195
196 self.figure.clear()
197 if numPlots > 0:
198 names = list(names)
199 names.sort()
200
201 numRows = math.ceil(math.sqrt(numPlots));
202 numCols = math.ceil(numPlots / numRows)
203 subplots = dict()
204 for i in range(numPlots):
205 subplots[ names[i] ] = self.figure.add_subplot(numRows, numCols, i+1)
206
207 wf_ref = wfc[0]
208 for nWf, wf in enumerate(wfc):
209 for name, waveform in wf.waveforms.items():
210 if not wf.show[name]:
211 continue
212 p = subplots[name]
213 if self.spectrum.isChecked():
214 n = len(waveform)
215 dt = wf.time[1]-wf.time[0] # assume equally spaced samples
216 f = scipy.fftpack.fftfreq(n, dt)
217 W = dt * scipy.fftpack.fft(waveform)
218 maxFreqIndices = numpy.argwhere(f > self.maxFreq.value())
219 L = maxFreqIndices[0,0] if numpy.size(maxFreqIndices) > 0 else n/2
220 p.loglog(f[1:L], numpy.absolute(W[1:L]), label=str(nWf))
221 p.set_xlabel('f [Hz]')
222 elif self.diff.isChecked():
223 p.plot(wf.time, waveform, label='{}-0'.format(nWf+1))

Callers 4

closeNavigationMethod · 0.95
savePlotsMethod · 0.95
run-all.pyFile · 0.80

Calls 15

enumerateFunction · 0.85
listClass · 0.85
rangeFunction · 0.85
getActiveWaveformsMethod · 0.80
differentiateMethod · 0.80
integrateMethod · 0.80
popMethod · 0.80
subtractMethod · 0.80
valueMethod · 0.80
applyMethod · 0.45
normalizeMethod · 0.45
ceilMethod · 0.45

Tested by

no test coverage detected