From b2f6723df40d5ff2836cdaa69b633ea3f383c41f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Offringa?= <offringa@astron.nl>
Date: Thu, 22 Dec 2011 15:32:23 +0000
Subject: [PATCH] Task #1892: adding coords to status

---
 .../include/AOFlagger/quality/loghistogram.h         |  6 +++---
 CEP/DP3/AOFlagger/src/aoquality.cpp                  | 12 +++++++++++-
 .../src/gui/quality/timefrequencyplotpage.cpp        |  2 +-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/quality/loghistogram.h b/CEP/DP3/AOFlagger/include/AOFlagger/quality/loghistogram.h
index 4bc42f9a72d..c1cbb54dd49 100644
--- a/CEP/DP3/AOFlagger/include/AOFlagger/quality/loghistogram.h
+++ b/CEP/DP3/AOFlagger/include/AOFlagger/quality/loghistogram.h
@@ -109,7 +109,7 @@ class LogHistogram
 		double MaxAmplitude() const
 		{
 			if(_amplitudes.empty())
-				throw std::runtime_error("Empty histogram");
+				return 0.0;
 			return _amplitudes.rbegin()->first;
 		}
 		
@@ -117,12 +117,12 @@ class LogHistogram
 		{
 			std::map<double, AmplitudeBin>::const_iterator i = _amplitudes.begin();
 			if(i == _amplitudes.end())
-				throw std::runtime_error("Empty histogram");
+				return 0.0;
 			while(i->first <= 0.0)
 			{
 				++i;
 				if(i == _amplitudes.end())
-					throw std::runtime_error("Histogram does not contain positive values");
+					return 0.0;
 			}
 			return i->first;
 		}
diff --git a/CEP/DP3/AOFlagger/src/aoquality.cpp b/CEP/DP3/AOFlagger/src/aoquality.cpp
index d31c6d2c5a3..bbbcc30d746 100644
--- a/CEP/DP3/AOFlagger/src/aoquality.cpp
+++ b/CEP/DP3/AOFlagger/src/aoquality.cpp
@@ -35,6 +35,12 @@
 #include <AOFlagger/remote/processcommander.h>
 #include <AOFlagger/util/plot.h>
 
+#include <AOFlagger/configuration.h>
+
+#ifdef HAS_LOFARSTMAN
+#include <LofarStMan/Register.h>
+#endif // HAS_LOFARSTMAN                                                       
+
 void reportProgress(unsigned step, unsigned totalSteps)
 {
 	const unsigned twoPercent = (totalSteps+49)/50;
@@ -219,7 +225,7 @@ void actionCollect(const std::string &filename, enum CollectingMode mode)
 					plotSlopes.SetLogScale(true, false);
 					plotHistograms.StartLine();
 					plotHistograms.SetLogScale(true, true);
-					while(rangeCentre < maxAmplitude)
+					while(rangeCentre < maxAmplitude && rangeCentre > 0.0)
 					{
 						const double rangeStart = rangeCentre * 0.75;
 						const double rangeEnd = rangeCentre * 1.5;
@@ -482,6 +488,10 @@ void printSyntax(std::ostream &stream, char *argv[])
 
 int main(int argc, char *argv[])
 {
+#ifdef HAS_LOFARSTMAN
+	register_lofarstman();
+#endif // HAS_LOFARSTMAN
+
 	if(argc < 2)
 	{
 		printSyntax(std::cerr, argv);
diff --git a/CEP/DP3/AOFlagger/src/gui/quality/timefrequencyplotpage.cpp b/CEP/DP3/AOFlagger/src/gui/quality/timefrequencyplotpage.cpp
index b8ef6eabd58..41d84c001d4 100644
--- a/CEP/DP3/AOFlagger/src/gui/quality/timefrequencyplotpage.cpp
+++ b/CEP/DP3/AOFlagger/src/gui/quality/timefrequencyplotpage.cpp
@@ -67,6 +67,6 @@ void TimeFrequencyPlotPage::onMouseMoved(size_t x, size_t y)
 	const QualityTablesFormatter::StatisticKind kind = GetSelectedStatisticKind();
 	const std::string &kindName = QualityTablesFormatter::KindToName(kind);
 	
-	text << kindName << " = " << GrayScaleWidget().Image()->Value(x, y);
+	text << kindName << " = " << GrayScaleWidget().Image()->Value(x, y) << " (" << x << ", " << y << ")";
 	_signalStatusChange(text.str());
 }
-- 
GitLab