Reversed former changes, no need for math module.

This commit is contained in:
Ludger Küperkoch 2017-02-09 17:15:00 +01:00
parent af555ab1ee
commit 2954e5acea

View File

@ -9,7 +9,6 @@ import warnings
import copy import copy
import datetime import datetime
import numpy as np import numpy as np
import math
from matplotlib.figure import Figure from matplotlib.figure import Figure
from pylot.core.util.utils import find_horizontals from pylot.core.util.utils import find_horizontals
@ -243,55 +242,54 @@ class ComparisonDialog(QDialog):
std=std, exp=exp) std=std, exp=exp)
bbox_props = dict(boxstyle='round', facecolor='lightgrey', alpha=.7) bbox_props = dict(boxstyle='round', facecolor='lightgrey', alpha=.7)
if math.isnan(std) == False: plot_pdf(_axes, x, y, annotation, bbox_props, 'time difference [s]',
plot_pdf(_axes, x, y, annotation, bbox_props, 'time difference [s]', 'propability density [-]', phase)
'propability density [-]', phase)
pdf_a = copy.deepcopy(self.data.get('auto')[station][phase]) pdf_a = copy.deepcopy(self.data.get('auto')[station][phase])
pdf_m = copy.deepcopy(self.data.get('manu')[station][phase]) pdf_m = copy.deepcopy(self.data.get('manu')[station][phase])
xauto, yauto, stdauto, expauto, alim = pdf_a.axis, pdf_a.data, \ xauto, yauto, stdauto, expauto, alim = pdf_a.axis, pdf_a.data, \
pdf_a.standard_deviation(), \ pdf_a.standard_deviation(), \
pdf_a.expectation(), \ pdf_a.expectation(), \
pdf_a.limits() pdf_a.limits()
xmanu, ymanu, stdmanu, expmanu, mlim = pdf_m.axis, pdf_m.data, \ xmanu, ymanu, stdmanu, expmanu, mlim = pdf_m.axis, pdf_m.data, \
pdf_m.standard_deviation(), \ pdf_m.standard_deviation(), \
pdf_m.expectation(), \ pdf_m.expectation(), \
pdf_m.limits() pdf_m.limits()
# find common limits # find common limits
lims = clims(alim, mlim) lims = clims(alim, mlim)
# relative x axis # relative x axis
x0 = lims[0] x0 = lims[0]
xmanu -= x0 xmanu -= x0
xauto -= x0 xauto -= x0
lims = [lim - x0 for lim in lims] lims = [lim - x0 for lim in lims]
x0 = UTCDateTime(x0) x0 = UTCDateTime(x0)
# set annotation text # set annotation text
mannotation = "probability density for manual pick\n" \ mannotation = "probability density for manual pick\n" \
"expectation: {exp}\n" \ "expectation: {exp}\n" \
"std: {std}".format(std=stdmanu, "std: {std}".format(std=stdmanu,
exp=expmanu-x0.timestamp) exp=expmanu-x0.timestamp)
aannotation = "probability density for automatic pick\n" \ aannotation = "probability density for automatic pick\n" \
"expectation: {exp}\n" \ "expectation: {exp}\n" \
"std: {std}".format(std=stdauto, "std: {std}".format(std=stdauto,
exp=expauto-x0.timestamp) exp=expauto-x0.timestamp)
_ax1 = plot_pdf(_ax1, xmanu, ymanu, mannotation, _ax1 = plot_pdf(_ax1, xmanu, ymanu, mannotation,
bbox_props=bbox_props, xlabel='seconds since ' bbox_props=bbox_props, xlabel='seconds since '
'{0}'.format(x0), '{0}'.format(x0),
ylabel='probability density [-]') ylabel='probability density [-]')
_ax1.set_xlim(lims) _ax1.set_xlim(lims)
_ax2 = plot_pdf(_ax2, xauto, yauto, aannotation, _ax2 = plot_pdf(_ax2, xauto, yauto, aannotation,
bbox_props=bbox_props, xlabel='seconds since ' bbox_props=bbox_props, xlabel='seconds since '
'{0}'.format(x0)) '{0}'.format(x0))
_ax2.set_xlim(lims) _ax2.set_xlim(lims)
_gs.update(wspace=0.5, hspace=0.5) _gs.update(wspace=0.5, hspace=0.5)
self.canvas.draw() self.canvas.draw()
def plothist(self): def plothist(self):
name = self.sender().objectName() name = self.sender().objectName()