remove empirical filter to remove outliers from corrupted data

This commit is contained in:
Axel Kohlmeyer
2024-10-13 22:52:40 -04:00
parent 1c9daad657
commit 1e63f031f0

View File

@ -423,27 +423,6 @@ void ChartViewer::add_data(int step, double data)
{
if (last_step < step) {
last_step = step;
// do not add data that deviates by more than 4 sigma from the average
// over the last 5 to 20 data items. this is a hack to work around
// getting corrupted data from lammps_get_last_thermo()
const auto &points = series->points();
const auto count = points.count();
if (count > 4) {
double ysum = 0.0;
double ysumsq = 0.0;
int first = count - 20;
if (first < 0) first = 0;
for (int i = first; i < count; ++i) {
double val = points[i].y();
ysum += val;
ysumsq += val * val;
}
const double num = count - first;
const double avg = ysum / num;
const double avgsq = ysumsq / num;
if (fabs(data - avg) > (5.0 * sqrt(avgsq - (avg * avg)))) return;
}
series->append(step, data);
QSettings settings;