The following commit has been merged in the master branch:
commit 6912179b9cbbd7a4fc30a3c42f119d3ee50a3dfd
Author: Andrei Zavada <[email protected]>
Date:   Sun Jun 9 19:02:25 2013 +0300

    forgot to give metrics::swu::SPPack some defaults
    
    also, move some simple methods to headers

diff --git a/src/aghermann/metrics/mc.cc b/src/aghermann/metrics/mc.cc
index c641c46..3e7524b 100644
--- a/src/aghermann/metrics/mc.cc
+++ b/src/aghermann/metrics/mc.cc
@@ -21,37 +21,6 @@
 using namespace std;
 
 
-void
-metrics::mc::SPPack::
-check() const
-{
-        if ( mc_gain < 1.0 )
-               throw invalid_argument ("mc_gain must be >= 1.0");
-       // if ( (int)(pagesize/scope) != (double)pagesize / (double)scope )
-       //      throw invalid_argument ("Page size not a multiple of MC scope");
-}
-
-
-
-void
-metrics::mc::SPPack::
-reset()
-{
-       scope                   =     30 / 6.;  // 5 sec is close to 4 sec 
('recommended')
-       f0fc                    =      .8;
-       bandwidth               =     1.5;
-       iir_backpolate          =     0.5;      // 0.0 < Backpolate < 1.0 on s: 
standard 0.5
-       mc_gain                 =    10.0;      // Gain (DigiRange/PhysiRange) 
of MicroContinuity
-       smooth_side             =     0;
-       freq_from               =     0.5;
-       freq_inc                =      .5;
-       n_bins                  =     5;
-}
-
-
-
-
-
 
 metrics::mc::CProfile::
 CProfile (const sigfile::CTypedSource& F, int sig_no,
diff --git a/src/aghermann/metrics/mc.hh b/src/aghermann/metrics/mc.hh
index 7539e7f..fb14e18 100644
--- a/src/aghermann/metrics/mc.hh
+++ b/src/aghermann/metrics/mc.hh
@@ -30,11 +30,12 @@ namespace mc {
 struct SPPack
   : public metrics::SPPack {
        double  scope,
-               f0fc,//f0, // = 1.,
+               f0fc,
+               //f0, // = 1.,
                //fc, // = 1.8;
-               bandwidth, // = 1.5;
-               iir_backpolate,                 // = 0.5;       // 0.0 < 
Backpolate < 1.0 on s: standard 0.5
-               mc_gain;                        // = 10.0;      // Gain 
(DigiRange/PhysiRange) of MicroContinuity
+               bandwidth,      // = 1.5;
+               iir_backpolate, // = 0.5;       // 0.0 < Backpolate < 1.0 on s: 
standard 0.5
+               mc_gain;        // = 10.0;      // Gain (DigiRange/PhysiRange) 
of MicroContinuity
        size_t  smooth_side;
        double  freq_from,
                freq_inc;
@@ -73,8 +74,26 @@ struct SPPack
                        n_bins = rv.n_bins;
                }
 
-       void check() const; // throws
-       void reset();
+       void check() const // throws
+               {
+                       if ( mc_gain < 1.0 )
+                               throw invalid_argument ("mc_gain must be >= 
1.0");
+                       // if ( (int)(pagesize/scope) != (double)pagesize / 
(double)scope )
+                       //      throw invalid_argument ("Page size not a 
multiple of MC scope");
+               }
+
+       void reset()
+               {
+                       scope                   =     30 / 6.;  // 5 sec is 
close to 4 sec ('recommended')
+                       f0fc                    =      .8;
+                       bandwidth               =     1.5;
+                       iir_backpolate          =     0.5;      // 0.0 < 
Backpolate < 1.0 on s: standard 0.5
+                       mc_gain                 =    10.0;      // Gain 
(DigiRange/PhysiRange) of MicroContinuity
+                       smooth_side             =     0;
+                       freq_from               =     0.5;
+                       freq_inc                =      .5;
+                       n_bins                  =     5;
+               }
 
        size_t
        compute_n_bins( size_t) const // to match psd::SPPack::compute_n_bins
diff --git a/src/aghermann/metrics/psd.cc b/src/aghermann/metrics/psd.cc
index a54bf25..80f0ecb 100644
--- a/src/aghermann/metrics/psd.cc
+++ b/src/aghermann/metrics/psd.cc
@@ -39,44 +39,6 @@ metrics::psd::TFFTWPlanType
 
 
 
-void
-metrics::psd::SPPack::
-check() const
-{
-       metrics::SPPack::check();
-
-       if ( welch_window_type > sigproc::TWinType::TWinType_total )
-#ifdef _OPENMP
-#pragma omp single
-#endif
-               throw invalid_argument ("Invalid window type");
-       if ( plan_type != metrics::psd::TFFTWPlanType::estimate &&
-            plan_type != metrics::psd::TFFTWPlanType::measure )
-#ifdef _OPENMP
-#pragma omp single
-#endif
-               throw invalid_argument ("Invalid FFTW plan type");
-       for ( auto c : {.1, .25, .5} )
-               if ( binsize == c )
-                       return;
-#ifdef _OPENMP
-#pragma omp single
-#endif
-       throw invalid_argument ("Invalid binsize");
-}
-
-void
-metrics::psd::SPPack::
-reset()
-{
-       metrics::SPPack::reset();
-       binsize = .25;
-}
-
-
-
-
-
 
 
 metrics::psd::CProfile::
diff --git a/src/aghermann/metrics/psd.hh b/src/aghermann/metrics/psd.hh
index c5d9559..2599f56 100644
--- a/src/aghermann/metrics/psd.hh
+++ b/src/aghermann/metrics/psd.hh
@@ -91,8 +91,32 @@ struct SPPack
                        return (samplerate * pagesize + 1) / 2 / samplerate / 
binsize;
                }
 
-       void check() const;  // throws if not ok
-       void reset();
+       void check() const
+               {
+                       metrics::SPPack::check();
+
+                       if ( welch_window_type > 
sigproc::TWinType::TWinType_total )
+// What was that?
+// #ifdef _OPENMP
+// #pragma omp single
+// #endif
+                               throw invalid_argument ("Invalid window type");
+
+                       if ( plan_type != metrics::psd::TFFTWPlanType::estimate 
&&
+                            plan_type != metrics::psd::TFFTWPlanType::measure )
+                               throw invalid_argument ("Invalid FFTW plan 
type");
+
+                       for ( auto c : {.1, .25, .5} )
+                               if ( binsize == c )
+                                       return;
+                       throw invalid_argument ("Invalid binsize");
+               }
+
+       void reset()
+               {
+                       metrics::SPPack::reset();
+                       binsize = .25;
+               }
 };
 
 
diff --git a/src/aghermann/metrics/swu.cc b/src/aghermann/metrics/swu.cc
index 0e94b04..fb46599 100644
--- a/src/aghermann/metrics/swu.cc
+++ b/src/aghermann/metrics/swu.cc
@@ -23,28 +23,6 @@
 using namespace std;
 
 
-
-void
-metrics::swu::SPPack::
-check() const
-{
-       metrics::SPPack::check();
-}
-
-void
-metrics::swu::SPPack::
-reset()
-{
-       metrics::SPPack::reset();
-       min_upswing_duration = .3;
-}
-
-
-
-
-
-
-
 metrics::swu::CProfile::
 CProfile (const sigfile::CTypedSource& F, int sig_no,
          const SPPack &params)
diff --git a/src/aghermann/metrics/swu.hh b/src/aghermann/metrics/swu.hh
index 8bd8e4c..c4991c8 100644
--- a/src/aghermann/metrics/swu.hh
+++ b/src/aghermann/metrics/swu.hh
@@ -31,17 +31,30 @@ namespace swu {
 
 
 struct SPPack
-  : public metrics:: SPPack {
+  : public metrics::SPPack {
 
        double  min_upswing_duration;
+
+       SPPack ()
+               {
+                       reset();
+               }
        size_t
        compute_n_bins( size_t _samplerate) const
                {
                        return 1;
                }
 
-       void check() const;  // throws if not ok
-       void reset();
+       void check() const  // throws if not ok
+               {
+                       metrics::SPPack::check();
+               }
+
+       void reset()
+               {
+                       metrics::SPPack::reset();
+                       min_upswing_duration = .3;
+               }
 };
 
 

-- 
Sleep experiment manager

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to