15 using namespace yarp::os;
16 using namespace yarp::sig;
21 ModifiedThompsonTau::ModifiedThompsonTau()
137 set<size_t> ModifiedThompsonTau::detect(
const Vector &
data,
const Property &options)
145 size_t N=
data.length()-recurIdx.size();
147 if (options.check(
"mean") && options.check(
"std"))
149 mean=options.find(
"mean").asFloat64();
150 stdev=options.find(
"std").asFloat64();
155 for (
size_t i=0; i<
data.length(); i++)
158 if (recurIdx.find(i)==recurIdx.end())
166 stdev=sqrt(stdev/N-mean*mean);
170 double delta_check=0.0;
171 if (options.check(
"sorted"))
175 for (i_1=0; recurIdx.find(i_1)!=recurIdx.end(); i_1++);
176 for (i_n=
data.length()-1; recurIdx.find(i_n)!=recurIdx.end(); i_n--);
178 double delta_1=fabs(
data[i_1]-mean);
179 double delta_n=fabs(
data[i_n]-mean);
192 else for (
size_t i=0; i<
data.length(); i++)
195 if (recurIdx.find(i)==recurIdx.end())
197 double delta=fabs(
data[i]-mean);
198 if (delta>delta_check)
224 if (delta_check>tau*stdev)
230 if (options.check(
"recursive"))
233 recurIdx.insert(i_check);
236 set<size_t> tmpRes=detect(
data,options);
243 else for (set<size_t>::iterator it=tmpRes.begin(); it!=tmpRes.end(); it++)