Commit fb67ec6d authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

fix miscalculation in max min trend length

closes #181
parent 4332eaa9
......@@ -41,7 +41,7 @@ TREND_TRANS_THRESHOLD = {
TREND_MAX_SECONDS = {
'raw': 3600,
'sec': 3600*24*20,
'min': 60*24*365*12,
'min': 3660*24*365*12,
}
......
......@@ -85,14 +85,16 @@ class TCursors:
label = None
for plot, lines, diff in self.plots:
lines[index].setValue(value)
lines[index].label.setText('{:g}'.format(value))
lines[index].label.setText(str(util.TDStr(value)))
if not label:
l0 = lines[0].value()
l1 = lines[1].value()
diff_pos = (l0 + l1)/2
diff_val = np.abs(l1 - l0)
label = u'<table><tr><td rowspan="2" valign="middle">ΔT=</td><td>{:g} s</td></tr><tr><td>{:g} Hz</td></tr></table></nobr>'.format(
diff_val, 1/diff_val)
label = u'<table><tr><td rowspan="2" valign="middle">ΔT=</td><td>{}</td></tr><tr><td>{:g} Hz</td></tr></table></nobr>'.format(
str(util.TDStr(diff_val)),
1/diff_val,
)
diff.setValue(diff_pos)
diff.label.setHtml(label)
......
......@@ -1059,6 +1059,7 @@ class NDScope(QMainWindow, Ui_MainWindow):
plot.disableAutoRange(axis='y')
self._connect_crosshair()
self.graphView.scene().sigMouseClicked.connect(self._clicked_crosshair)
self.graphView.setCursor(Qt.CrossCursor)
logger.info("crosshair enabled")
def enable_crosshair(self):
......@@ -1076,6 +1077,7 @@ class NDScope(QMainWindow, Ui_MainWindow):
self.graphView.scene().sigMouseClicked.disconnect(self._clicked_crosshair)
except TypeError:
pass
self.graphView.setCursor(Qt.ArrowCursor)
self.crosshairGPS.setText('')
self.crosshairGreg.setText('')
self.crosshairYValue.setText('')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment