24 using std::istringstream;
34 const string myname =
"test_ThresholdNoiseRemovalService: ";
36 cout << myname <<
"NDEBUG must be off." <<
endl;
39 string line =
"-----------------------------";
41 cout << myname << line <<
endl;
42 cout << myname <<
"Create top-level FCL." <<
endl;
44 std::ostringstream oss;
45 oss <<
"services.AdcChannelNoiseRemovalService: {" <<
endl;
46 oss <<
" service_provider: ThresholdNoiseRemovalService" <<
endl;
47 oss <<
" Threshold: " << threshold <<
endl;
48 oss <<
" LogLevel: " << a_LogLevel <<
endl;
52 const unsigned int nsig = 100;
55 for (
unsigned int isig=0; isig<nsig; ++isig ) {
56 acd.
samples.push_back(20*sin(0.47*isig));
62 for (
AdcSignal& sig : sigsexp )
if ( fabs(sig) < threshold ) sig = 0.0;
64 cout << myname << line <<
endl;
65 cout << myname <<
"Fetch the noise removal." <<
endl;
67 hanr->
print(cout, myname);
69 cout << myname << line <<
endl;
70 cout << myname <<
"Remove noise." <<
endl;
71 assert( hanr->
update(acd) == 0 );
72 for (
unsigned int isig=0; isig<nsig; ++isig ) {
73 cout << myname <<
setw(4) << isig <<
": " 77 assert( sigs[isig] == sigsexp[isig] );
80 cout << myname << line <<
endl;
81 cout << myname <<
"Done." <<
endl;
90 istringstream ssarg(argv[1]);
static void load_services(std::string const &config)
Q_EXPORT QTSManip setprecision(int p)
void setChannelInfo(ChannelInfoPtr pchi)
virtual std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const =0
int main(int argc, char *argv[])
Q_EXPORT QTSManip setw(int w)
int test_ThresholdNoiseRemovalService(int a_LogLevel=1)
void line(double t, double *p, double &x, double &y, double &z)
virtual int update(AdcChannelData &data) const =0
std::vector< AdcSignal > AdcSignalVector
QTextStream & endl(QTextStream &s)