[med-svn] [SCM] aghermann branch, master, updated. 5727b0b7844548ed4c4fceab25995fc02b87da50
Andrei Zavada
johnhommer at gmail.com
Tue Dec 4 00:35:24 UTC 2012
The following commit has been merged in the master branch:
commit 91af9094f6fbfe56f388596c3975080cc8e8fccb
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Sun Dec 2 03:53:43 2012 +0200
tentative SWU computation
diff --git a/src/metrics/swu.cc b/src/metrics/swu.cc
index af8f183..e0fb91a 100644
--- a/src/metrics/swu.cc
+++ b/src/metrics/swu.cc
@@ -37,6 +37,7 @@ metrics::swu::SPPack::
reset()
{
metrics::SPPack::reset();
+ min_upswing_duration = .3;
}
@@ -99,11 +100,31 @@ go_compute()
{
_data.resize( pages() * _bins);
- auto S = _using_F.get_signal_filtered( _using_sig_no);
+ auto dS = sigproc::derivative(
+ _using_F.get_signal_filtered( _using_sig_no));
for ( size_t p = 0; p < pages(); ++p ) {
+ auto a = p * (samplerate() * Pp.pagesize),
+ z = (p+1) * (samplerate() * Pp.pagesize);
+ auto la = a, lz = a;
+ double Q = 0.;
+ // find a stretch of uninterrupted positive values
+ for ( auto i = a; i < z; ++i ) {
+ double q = 0.;
+ auto j = i;
+ while ( dS[j] > 0 ) {
+ q += dS[j];
+ if ( not (j < z) )
+ break;
+ ++j;
+ }
+ la = i; lz = j;
+ double upswing_duration = (lz - la) * samplerate();
+ if ( upswing_duration > Pp.min_upswing_duration )
+ Q += q;
+ }
nmth_bin(p, 0) =
- sin(p * M_PI);
+ Q;
}
return 0;
diff --git a/src/metrics/swu.hh b/src/metrics/swu.hh
index 57a5bd6..46a2b3d 100644
--- a/src/metrics/swu.hh
+++ b/src/metrics/swu.hh
@@ -34,6 +34,7 @@ namespace swu {
struct SPPack
: public metrics:: SPPack {
+ double min_upswing_duration;
size_t
compute_n_bins( size_t _samplerate) const
{
--
Sleep experiment manager
More information about the debian-med-commit
mailing list