pappso::FilterGreatestYperWindow Class Reference

keep N datapoints form the greatest intensities to the lowest within a mass range in dalton More...

`#include <filterpass.h>`

Inheritance diagram for pappso::FilterGreatestYperWindow:

## Public Member Functions

| FilterGreatestYperWindow (double window_range, std::size_t number_of_points_per_window)
| constructor with the number of datapoints to keep More...
| FilterGreatestYperWindow (const FilterGreatestYperWindow &other)
virtual | ~FilterGreatestYperWindow ()
FilterGreatestYperWindow & | operator= (const FilterGreatestYperWindow &other)
Trace & | filter (Trace &data_points) const override
std::size_t | getNumberOfPoints () const
Public Member Functions inherited from pappso::FilterInterface
virtual | ~FilterInterface ()

## Private Attributes

double | m_xWindowRange = 1
std::size_t | m_numberOfPoints = 0

## Detailed Description

keep N datapoints form the greatest intensities to the lowest within a mass range in dalton

Definition at line 121 of file filterpass.h.

## Constructor & Destructor Documentation

## FilterGreatestYperWindow() [1/2]

FilterGreatestYperWindow::FilterGreatestYperWindow | ( | double | window_range,
|  | std::size_t | number_of_points_per_window
| ) |  |

constructor with the number of datapoints to keep

Parameters

  window_range | mass range to consider (must be greater than 0.5)
  number_of_points_per_window | maximum number of points accepted per mass window in resulting spectrum

Definition at line 197 of file filterpass.cpp.

: m_xWindowRange(window_range), m_numberOfPoints(number_of_points_per_window)
{
qDebug();
if(m_xWindowRange < 0.5)
{
throw pappso::ExceptionOutOfRange(
QObject::tr("window_range must be greater than 0.5"));
}
qDebug();
}
pappso::ExceptionOutOfRange
Definition: exceptionoutofrange.h:32
pappso::FilterGreatestYperWindow::m_numberOfPoints
std::size_t m_numberOfPoints
Definition: filterpass.h:143
pappso::FilterGreatestYperWindow::m_xWindowRange
double m_xWindowRange
Definition: filterpass.h:142

References m_xWindowRange.

## FilterGreatestYperWindow() [2/2]

FilterGreatestYperWindow::FilterGreatestYperWindow | ( | const FilterGreatestYperWindow & | other | ) |

Definition at line 213 of file filterpass.cpp.

: m_xWindowRange(other.m_xWindowRange),
m_numberOfPoints(other.m_numberOfPoints)
{
qDebug();
}

## ~FilterGreatestYperWindow()

virtual pappso::FilterGreatestYperWindow::~FilterGreatestYperWindow | ( |  | ) |

inline virtual

Definition at line 133 of file filterpass.h.

{};

## Member Function Documentation

## filter()

Trace & FilterGreatestYperWindow::filter | ( | Trace & | data_points | ) | const

override virtual

Implements pappso::FilterInterface.

Definition at line 233 of file filterpass.cpp.

{
std::vector<DataPoint> new_trace(data_points);
data_points.clear();
int window_number = 0;
int old_window_number = -1;
std::size_t number_of_peaks_in_window = 0;
auto itbegin = data_points.begin();
std::vector<DataPoint>::iterator it_min;
// std::sort(data_points.begin(),
// data_points.end(),
// [](const DataPoint &a, const DataPoint &b) { return (a.y > b.y);
// });
qDebug() << " m_xWindowRange=" << m_xWindowRange
<< " m_numberOfPoints=" << m_numberOfPoints;
for(const pappso::DataPoint &data_point : new_trace)
{
qDebug() << " data_point.x=" << data_point.x
<< " data_point.y=" << data_point.y;
window_number = trunc(data_point.x / m_xWindowRange);
qDebug() << window_number;
if(window_number != old_window_number)
{
old_window_number = window_number;
number_of_peaks_in_window = 0;
itbegin = data_points.end();
}
if(number_of_peaks_in_window < m_numberOfPoints)
{
qDebug();
data_points.push_back(data_point);
number_of_peaks_in_window++;
if(number_of_peaks_in_window == 1)
{
itbegin = data_points.begin() + (data_points.size() - 1);
}
}
else
{
qDebug();
it_min = minYDataPoint(itbegin, data_points.end());
if(it_min != data_points.end())
{
qDebug();
if(it_min->y < data_point.y)
{
qDebug();
*it_min = data_point;
// it_min->x = data_point.x;
// it_min->y = data_point.y;
}
}
}
}
qDebug();
// new_trace.sortX();
// qDebug() << new_trace.size();
// data_points.clear();
// data_points = new_trace;
// data_points = std::move(new_trace);
// qDebug() << data_points.size();
data_points.sortX();
qDebug();
return data_points;
}
pappso::Trace::sortX
void sortX()
Definition: trace.cpp:905
pappso::minYDataPoint
std::vector< DataPoint >::const_iterator minYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition: trace.cpp:117
pappso::DataPoint
Definition: datapoint.h:21

References m_numberOfPoints, m_xWindowRange, pappso::minYDataPoint(), and pappso::Trace::sortX().

## getNumberOfPoints()

std::size_t FilterGreatestYperWindow::getNumberOfPoints | ( |  | ) | const

Definition at line 306 of file filterpass.cpp.

{
return m_numberOfPoints;
}

References m_numberOfPoints.

## operator=()

FilterGreatestYperWindow & FilterGreatestYperWindow::operator= | ( | const FilterGreatestYperWindow & | other | ) |

Definition at line 222 of file filterpass.cpp.

{
qDebug();
m_numberOfPoints = other.m_numberOfPoints;
m_xWindowRange = other.m_xWindowRange;
return *this;
}

References m_numberOfPoints, and m_xWindowRange.

## Member Data Documentation

## m_numberOfPoints

std::size_t pappso::FilterGreatestYperWindow::m_numberOfPoints = 0

private

Definition at line 143 of file filterpass.h.

Referenced by filter(), getNumberOfPoints(), and operator=().

## m_xWindowRange

double pappso::FilterGreatestYperWindow::m_xWindowRange = 1

private

Definition at line 142 of file filterpass.h.

Referenced by FilterGreatestYperWindow(), filter(), and operator=().

The documentation for this class was generated from the following files:

- pappsomspp/processing/filters/filterpass.h
- pappsomspp/processing/filters/filterpass.cpp