new marker type: negative peak table

This commit is contained in:
Jan Käberich 2023-01-05 19:52:54 +01:00
parent 5ad44c780c
commit 0dbf362f57
4 changed files with 23 additions and 4 deletions

View file

@ -1361,12 +1361,15 @@ double Trace::findExtremum(bool max, double xmin, double xmax)
return freq;
}
std::vector<double> Trace::findPeakFrequencies(unsigned int maxPeaks, double minLevel, double minValley, double xmin, double xmax)
std::vector<double> Trace::findPeakFrequencies(unsigned int maxPeaks, double minLevel, double minValley, double xmin, double xmax, bool negativePeaks)
{
if(lastMath->getDataType() != DataType::Frequency) {
// not in frequency domain
return vector<double>();
}
if(negativePeaks) {
minLevel = -minLevel;
}
using peakInfo = struct peakinfo {
double frequency;
double level_dbm;
@ -1380,6 +1383,9 @@ std::vector<double> Trace::findPeakFrequencies(unsigned int maxPeaks, double min
continue;
}
double dbm = Util::SparamTodB(d.y);
if(negativePeaks) {
dbm = -dbm;
}
if((dbm >= max_dbm) && (min_dbm <= dbm - minValley)) {
// potential peak frequency
frequency = d.x;