This is an automated email from the git hooks/post-receive script. hmmr-guest pushed a commit to branch WIP in repository aghermann.
commit 8132f7c08dfec36934d14c1997c0fa4cf63b69af Author: Andrei Zavada <[email protected]> Date: Tue Oct 8 02:25:53 2013 +0300 compute EMG steady tone, tone distribution --- upstream/src/aghermann/ui/sf/channel.cc | 27 +++++++++++++++++++++++++-- upstream/src/aghermann/ui/sf/channel.hh | 13 +++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/upstream/src/aghermann/ui/sf/channel.cc b/upstream/src/aghermann/ui/sf/channel.cc index 70b1007..a4fd284 100644 --- a/upstream/src/aghermann/ui/sf/channel.cc +++ b/upstream/src/aghermann/ui/sf/channel.cc @@ -13,10 +13,13 @@ #include <type_traits> #include "common/lang.hh" +#include "common/alg.hh" #include "common/config-validate.hh" #include "libsigproc/exstrom.hh" #include "libmetrics/bands.hh" +#include "aghermann/globals.hh" #include "aghermann/patterns/patterns.hh" +#include "aghermann/rk1968/rk1968.hh" #include "aghermann/ui/globals.hh" #include "aghermann/ui/mw/mw.hh" @@ -141,9 +144,29 @@ SChannel (agh::CRecording& r, // don't: interchannel_gap is rubbish yet psd.focused_band = metrics::TBand::delta; - } else if ( schannel().type() == sigfile::SChannel::TType::emg ) + } else if ( schannel().type() == sigfile::SChannel::TType::emg ) { get_raw_profile(); + hist_range_min = 0.; + hist_binsize = raw_profile.max() / hist_bins; + histogram.resize( hist_bins); + for ( size_t i = 0; i < raw_profile.size(); ++i ) + ++histogram[ agh::alg::value_within( + (size_t)roundf((raw_profile[i] - hist_range_min) / hist_binsize), + 0lu, hist_bins-1) ]; + + static const size_t steady_secs = 10; + static const double max_dev_factor = 1.1; + size_t steady_tone_at; + tie (steady_tone, steady_tone_at) = + agh::rk1968::emg_steady_tone( + sigproc::SSignalRef<TFloat> {raw_profile, 1. / raw_profile_dt}, + steady_secs, + max_dev_factor); + + APPLOG_INFO ( "%s amplitude max %g count %zu, binsize %g; steady tone %g at %g sec", name(), raw_profile.max(), histogram.max(), hist_binsize, steady_tone, steady_tone_at * raw_profile_dt); + } + // let it be so to avoid libconfig::readFile throwing exceptions psd.display_scale = mc.display_scale = swu.display_scale = DBL_MIN; @@ -287,7 +310,7 @@ get_raw_profile() { raw_profile = sigproc::raw_signal_profile<TFloat>( {signal_filtered, samplerate()}, - 1., 3.); + 1., raw_profile_dt); } diff --git a/upstream/src/aghermann/ui/sf/channel.hh b/upstream/src/aghermann/ui/sf/channel.hh index 761cb64..1b6c3e1 100644 --- a/upstream/src/aghermann/ui/sf/channel.hh +++ b/upstream/src/aghermann/ui/sf/channel.hh @@ -171,10 +171,19 @@ struct SScoringFacility::SChannel { void get_spectrum(); // at current page void get_spectrum( size_t p); - // raw profile + // raw profile, histogram, steady tone for EMG + static constexpr double raw_profile_dt = 1.; valarray<TFloat> raw_profile; - void get_raw_profile(); + void + get_raw_profile(); + + TFloat steady_tone; + valarray<size_t> + histogram; + static const size_t hist_bins = 20; + double hist_range_min, + hist_binsize; // region void mark_region_as_artifact( bool do_mark); -- Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
