Skip to content

Commit

Permalink
add avg removal
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyDurachenko committed Feb 7, 2017
1 parent 9f995d9 commit 4f2c270
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/miniseedutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,14 @@ bool miniseed_to_datasamples_skip_gap(const QString &fileName,
throw QString(ms_errorstr(retcode));
}

double avg = 0.0;
for (qint64 i = 0; i < samplecnt; ++i) {
avg += datasamples[i] / samplecnt;
}

double absMax = 0.0;
for (qint64 i = 0; i < samplecnt; ++i) {
datasamples[i] -= avg;
if (qAbs(datasamples[i]) > absMax) {
absMax = qAbs(datasamples[i]);
}
Expand Down

0 comments on commit 4f2c270

Please sign in to comment.