Mercurial > hg > svcore
comparison base/LogRange.cpp @ 687:06f13a3b9e9e debug-output
Convert many cerrs to DEBUGs
author | Chris Cannam |
---|---|
date | Mon, 16 May 2011 17:19:09 +0100 |
parents | bdc9bb371a9f |
children | 1424aa29ae95 |
comparison
equal
deleted
inserted
replaced
686:b4a8d8221eaf | 687:06f13a3b9e9e |
---|---|
24 LogRange::mapRange(float &min, float &max, float logthresh) | 24 LogRange::mapRange(float &min, float &max, float logthresh) |
25 { | 25 { |
26 if (min > max) std::swap(min, max); | 26 if (min > max) std::swap(min, max); |
27 if (max == min) max = min + 1; | 27 if (max == min) max = min + 1; |
28 | 28 |
29 // std::cerr << "LogRange::mapRange: min = " << min << ", max = " << max << std::endl; | 29 // DEBUG << "LogRange::mapRange: min = " << min << ", max = " << max << endl; |
30 | 30 |
31 if (min >= 0.f) { | 31 if (min >= 0.f) { |
32 | 32 |
33 max = log10f(max); // we know max != 0 | 33 max = log10f(max); // we know max != 0 |
34 | 34 |
35 if (min == 0.f) min = std::min(logthresh, max); | 35 if (min == 0.f) min = std::min(logthresh, max); |
36 else min = log10f(min); | 36 else min = log10f(min); |
37 | 37 |
38 // std::cerr << "LogRange::mapRange: positive: min = " << min << ", max = " << max << std::endl; | 38 // DEBUG << "LogRange::mapRange: positive: min = " << min << ", max = " << max << endl; |
39 | 39 |
40 } else if (max <= 0.f) { | 40 } else if (max <= 0.f) { |
41 | 41 |
42 min = log10f(-min); // we know min != 0 | 42 min = log10f(-min); // we know min != 0 |
43 | 43 |
44 if (max == 0.f) max = std::min(logthresh, min); | 44 if (max == 0.f) max = std::min(logthresh, min); |
45 else max = log10f(-max); | 45 else max = log10f(-max); |
46 | 46 |
47 std::swap(min, max); | 47 std::swap(min, max); |
48 | 48 |
49 // std::cerr << "LogRange::mapRange: negative: min = " << min << ", max = " << max << std::endl; | 49 // DEBUG << "LogRange::mapRange: negative: min = " << min << ", max = " << max << endl; |
50 | 50 |
51 } else { | 51 } else { |
52 | 52 |
53 // min < 0 and max > 0 | 53 // min < 0 and max > 0 |
54 | 54 |
55 max = log10f(std::max(max, -min)); | 55 max = log10f(std::max(max, -min)); |
56 min = std::min(logthresh, max); | 56 min = std::min(logthresh, max); |
57 | 57 |
58 // std::cerr << "LogRange::mapRange: spanning: min = " << min << ", max = " << max << std::endl; | 58 // DEBUG << "LogRange::mapRange: spanning: min = " << min << ", max = " << max << endl; |
59 } | 59 } |
60 | 60 |
61 if (min == max) min = max - 1; | 61 if (min == max) min = max - 1; |
62 } | 62 } |
63 | 63 |
102 size_t mi = values.size() / 2; | 102 size_t mi = values.size() / 2; |
103 | 103 |
104 float sd0 = sd(values, 0, mi); | 104 float sd0 = sd(values, 0, mi); |
105 float sd1 = sd(values, mi, values.size() - mi); | 105 float sd1 = sd(values, mi, values.size() - mi); |
106 | 106 |
107 std::cerr << "LogRange::useLogScale: sd0 = " | 107 DEBUG << "LogRange::useLogScale: sd0 = " |
108 << sd0 << ", sd1 = " << sd1 << std::endl; | 108 << sd0 << ", sd1 = " << sd1 << endl; |
109 | 109 |
110 if (sd0 == 0 || sd1 == 0) return false; | 110 if (sd0 == 0 || sd1 == 0) return false; |
111 | 111 |
112 // I wonder what method of determining "one sd much bigger than | 112 // I wonder what method of determining "one sd much bigger than |
113 // the other" would be appropriate here... | 113 // the other" would be appropriate here... |