[med-svn] [SCM] aghermann branch, master, updated. 06bda7dfaa687aaf0708a024d192024e2cd58421
Andrei Zavada
johnhommer at gmail.com
Thu Jan 24 00:43:34 UTC 2013
The following commit has been merged in the master branch:
commit 19efaeaae4150d6e66f8c45ad54cc8df34faa65a
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Thu Jan 10 19:09:40 2013 +0200
patterns WIP
diff --git a/src/sigproc/patterns.hh b/src/sigproc/patterns.hh
index d18f13f..416f2d8 100644
--- a/src/sigproc/patterns.hh
+++ b/src/sigproc/patterns.hh
@@ -34,10 +34,6 @@ struct TMatch : public valarray<T> {
: valarray<T> (4)
{}
- TMatch<T>& operator/( T dvsr)
- {
- return (*this) / dvsr;
- }
bool operator==( const TMatch<T>& rv) const
{
for ( size_t i = 0; i < 4; ++i )
diff --git a/src/sigproc/patterns.ii b/src/sigproc/patterns.ii
index b64c1a7..c6f4388 100644
--- a/src/sigproc/patterns.ii
+++ b/src/sigproc/patterns.ii
@@ -38,13 +38,14 @@ find( const valarray<T>& fenv_u,
return (size_t)-1;
}
- // printf( "course.size = %zu, fcourse.size = %zu, start = %zu\n",
- // course.size(), fcourse.size(), start);
+ printf( "field = %zu, thing = %zu(%zu), start = %zu, size_essential = %zu\n",
+ ftarget_freq.size(), ptarget_freq.signal.size(),
+ penv.centre(SPatternPPack<T>::env_tightness).size(), start, size_essential());
+ printf( " %4g %4g %4g %4g\n",
+ SPatternPPack<T>::criteria[0], SPatternPPack<T>::criteria[1], SPatternPPack<T>::criteria[2], SPatternPPack<T>::criteria[3]);
ssize_t iz = (inc > 0) ? ftarget_freq.size() - size_with_context() : 0;
size_t essential_part = size_essential();
- // bool looking_further = false;
- // T ax, bx, cx;
- for ( ssize_t i = start; (inc > 0) ? i < iz : i > iz; i += inc ) {
+ for ( ssize_t i = start; (inc > 0) ? i+inc < iz : i+inc > iz; i += inc ) {
TMatch<T>
diff;
for ( size_t j = 0; j < essential_part; ++j ) {
@@ -62,11 +63,10 @@ find( const valarray<T>& fenv_u,
fdzcdf[i+j]);
}
- diff = diff / essential_part;
- diff[0] /= crit_linear_unity; // normalise
- diff[1] /= crit_linear_unity;
- diff[2] /= crit_linear_unity;
- diff[3] /= crit_dzcdf_unity;
+ diff[0] /= essential_part * crit_linear_unity; // normalise
+ diff[1] /= essential_part * crit_linear_unity;
+ diff[2] /= essential_part * crit_linear_unity;
+ diff[3] /= essential_part * crit_dzcdf_unity;
// if ( i % 250 == 0 ) printf( "at %zu diff_course = %g,\tdiff_breadth = %g\t diff_dzcdf = %g\n", i, diff_course, diff_breadth, diff_dzcd);
if ( diff.good_enough(SPatternPPack<T>::criteria) ) {
@@ -75,6 +75,8 @@ find( const valarray<T>& fenv_u,
match = diff;
return i;
}
+ // printf( " %17zu : %4g %4g %4g %4g\n",
+ // i, diff[0], diff[1], diff[2], diff[3]);
}
match = {1., 1., 1., 1.};
diff --git a/src/sigproc/sigproc.hh b/src/sigproc/sigproc.hh
index 5f04a5c..e5e1162 100644
--- a/src/sigproc/sigproc.hh
+++ b/src/sigproc/sigproc.hh
@@ -142,6 +142,7 @@ struct SCachedEnvelope
1./SSignalRef<T>::samplerate,
&lower,
&upper); // don't need anchor points, nor their count
+ mid.resize(lower.size());
mid = (upper + lower)/2;
}
return {lower, upper};
diff --git a/src/ui/sf/sf-channel.cc b/src/ui/sf/sf-channel.cc
index 51fad68..120ed40 100644
--- a/src/ui/sf/sf-channel.cc
+++ b/src/ui/sf/sf-channel.cc
@@ -138,7 +138,7 @@ SChannel( agh::CRecording& r,
} else if ( type == sigfile::SChannel::TType::emg ) {
valarray<TFloat> env_u, env_l;
- sigproc::envelope( {signal_original, samplerate()},
+ sigproc::envelope( {signal_original, samplerate()},
5, 1.,
&env_l, &env_u);
emg_profile.resize( env_l.size());
diff --git a/src/ui/sf/sf-patterns_cb.cc b/src/ui/sf/sf-patterns_cb.cc
index 6506269..1d02d80 100644
--- a/src/ui/sf/sf-patterns_cb.cc
+++ b/src/ui/sf/sf-patterns_cb.cc
@@ -86,6 +86,8 @@ bPatternFind_clicked_cb( GtkButton *button, gpointer userdata)
: FD.pattern_size_essential());
aghui::SBusyBlock bb (FD._p.wPattern);
+ FD.W_V.down();
+ FD.Pp.criteria = FD.tolerance;
FD.search( from);
if ( FD.last_find == (size_t)-1 )
--
Sleep experiment manager
More information about the debian-med-commit
mailing list