[med-svn] [SCM] aghermann branch, master, updated. 4f7a3b774136ffffbaf9b05d90bd568347bc5461

Andrei Zavada johnhommer at gmail.com
Fri Nov 16 00:50:50 UTC 2012


The following commit has been merged in the master branch:
commit 946d3b2fbb5e30c8575c6915d82558e61c1c007c
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Fri Nov 9 02:01:34 2012 +0200

    isolate metrics (mc and psd) from libsigfile, and some code refresh & rename

diff --git a/configure.ac b/configure.ac
index 7e9491d..23cd0c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_COPYRIGHT([Copyright (c) 2008-12 Andrei Zavada <johnhommer at gmail.com>])
 
-AC_INIT([Aghermann], [0.7.3], [johnhommer at gmail.com])
+AC_INIT([Aghermann], [0.8.0], [johnhommer at gmail.com])
 AC_CONFIG_SRCDIR([src/main.cc])
 AC_CONFIG_MACRO_DIR([m4])
 AC_PREREQ(2.61)
@@ -194,8 +194,9 @@ AC_DEFINE( [FABUF], [printf( __FILE__ ":%d (%s): %s\n", __LINE__, __FUNCTION__,
 AC_OUTPUT([
 	Makefile
 	src/Makefile
-	src/libsigfile/Makefile
 	src/sigproc/Makefile
+	src/libsigfile/Makefile
+	src/metrics/Makefile
 	src/ica/Makefile
 	src/common/Makefile
 	src/expdesign/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index b288643..35fad5b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,9 @@
 SUBDIRS := \
-	common sigproc libsigfile ica \
-	expdesign model \
-	ui tools
+	common sigproc ica libsigfile \
+	metrics model \
+	expdesign \
+	ui \
+	tools
 
 AM_CXXFLAGS := \
 	-Wall -std=c++0x \
@@ -20,11 +22,12 @@ aghermann_LDADD := \
 	ui/sf/liba.a \
 	ui/mf/liba.a \
 	ui/liba.a \
-	model/libmodel.a \
-	expdesign/libexpdesign.a \
+	model/liba.a \
+	expdesign/liba.a \
+	metrics/liba.a \
 	libsigfile/libsigfile.a \
-	sigproc/libsigproc.a \
-	common/libcommon.a \
+	sigproc/liba.a \
+	common/liba.a \
 	$(FFTW3_LIBS) $(ITPP_LIBS) $(SAMPLERATE_LIBS) $(GSL_LIBS) \
 	$(GTK_LIBS) $(CAIRO_LIBS) $(UNIQUE_LIBS) $(VTE_LIBS) \
 	$(LIBCONFIGXX_LIBS) \
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index fe299ee..9ceb99b 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -3,9 +3,9 @@ AM_CXXFLAGS := \
 	-I$(top_srcdir)/src
 
 noinst_LIBRARIES := \
-	libcommon.a
+	liba.a
 
-libcommon_a_SOURCES := \
+liba_a_SOURCES := \
 	libcommon.cc \
 	config-validate.hh \
 	string.hh \
diff --git a/src/expdesign/Makefile.am b/src/expdesign/Makefile.am
index a053ac3..98c0275 100644
--- a/src/expdesign/Makefile.am
+++ b/src/expdesign/Makefile.am
@@ -3,9 +3,9 @@ AM_CXXFLAGS := \
 	$(OPENMP_CXXFLAGS) \
 	-I$(top_srcdir)/src
 
-noinst_LIBRARIES := libexpdesign.a
+noinst_LIBRARIES := liba.a
 
-libexpdesign_a_SOURCES := \
+liba_a_SOURCES := \
 	forward-decls.hh \
 	primaries.cc \
 	primaries-loadsave.cc \
diff --git a/src/expdesign/primaries-tree-scanner.cc b/src/expdesign/primaries-tree-scanner.cc
index 2145dc0..dfec6ea 100644
--- a/src/expdesign/primaries-tree-scanner.cc
+++ b/src/expdesign/primaries-tree-scanner.cc
@@ -43,8 +43,8 @@ agh::CExpDesign::TMsmtCollectProgressIndicatorFun
 int
 agh::CSubject::SEpisodeSequence::
 add_one( sigfile::CSource&& Fmc,
-	 const sigfile::SFFTParamSet& fft_params,
-	 const sigfile::SMCParamSet& mc_params,
+	 const metrics::psd::SFFTParamSet& fft_params,
+	 const metrics::mc::SMCParamSet& mc_params,
 	 float max_hours_apart)
 {
 	auto Ei = find( episodes.begin(), episodes.end(),
diff --git a/src/expdesign/primaries.cc b/src/expdesign/primaries.cc
index f493cf3..2f2b159 100644
--- a/src/expdesign/primaries.cc
+++ b/src/expdesign/primaries.cc
@@ -20,8 +20,8 @@
 #include <omp.h>
 #endif
 
-#include "../common/globals.hh"
-#include "../common/config-validate.hh"
+#include "common/globals.hh"
+#include "common/config-validate.hh"
 #include "primaries.hh"
 
 
@@ -34,7 +34,7 @@ agh::CExpDesign::
 CExpDesign (const string& session_dir_,
 	    TMsmtCollectProgressIndicatorFun progress_fun)
       : num_threads (0),
-	af_dampen_window_type (sigfile::SFFTParamSet::TWinType::welch),
+	af_dampen_window_type (sigproc::TWinType::welch),
 	af_dampen_factor (.95),
 	tunables0 (tstep, tlo, thi),
 	_id_pool (0),
@@ -54,8 +54,8 @@ CExpDesign (const string& session_dir_,
 	}),
 	config_keys_d ({
 		confval::SValidator<int>("smp.num_threads",		&num_threads,					confval::SValidator<int>::SVFRangeIn( 0, 20)),
-		confval::SValidator<int>("fftparam.WelchWindowType",	(int*)&fft_params.welch_window_type,		confval::SValidator<int>::SVFRangeIn( 0, (int)sigfile::SFFTParamSet::TWinType::_total - 1)),
-		confval::SValidator<int>("artifacts.DampenWindowType",	(int*)&af_dampen_window_type,			confval::SValidator<int>::SVFRangeIn( 0, (int)sigfile::SFFTParamSet::TWinType::_total - 1)),
+		confval::SValidator<int>("fftparam.WelchWindowType",	(int*)&fft_params.welch_window_type,		confval::SValidator<int>::SVFRangeIn( 0, (int)sigproc::TWinType::_total - 1)),
+		confval::SValidator<int>("artifacts.DampenWindowType",	(int*)&af_dampen_window_type,			confval::SValidator<int>::SVFRangeIn( 0, (int)sigproc::TWinType::_total - 1)),
 		confval::SValidator<int>("ctlparam.ItersFixedT",	&ctl_params0.siman_params.iters_fixed_T,	confval::SValidator<int>::SVFRangeIn( 1, 1000000)),
 		confval::SValidator<int>("ctlparam.NTries",		&ctl_params0.siman_params.n_tries,		confval::SValidator<int>::SVFRangeIn( 1, 10000)),
 		confval::SValidator<int>("ctlparam.NSWALadenPagesBeforeSWA0",
@@ -226,7 +226,7 @@ for_all_modruns( const TModelRunOpFun& F, const TModelRunReportFun& report, cons
 	vector<tuple<CJGroup*,
 		     CSubject*,
 		     const string*,
-		     const sigfile::TMetricType*,
+		     const metrics::TMetricType*,
 		     const string*,
 		     const pair<float,float>*,
 		     ach::CModelRun*>> v;
@@ -437,8 +437,8 @@ agh::CSubject::
 
 agh::CSubject::SEpisode::
 SEpisode (sigfile::CSource&& F_,
-	  const sigfile::SFFTParamSet& fft_params,
-	  const sigfile::SMCParamSet& mc_params)
+	  const metrics::psd::SFFTParamSet& fft_params,
+	  const metrics::mc::SMCParamSet& mc_params)
 {
       // move it in place
 	sources.emplace_back( move(F_));
diff --git a/src/expdesign/primaries.hh b/src/expdesign/primaries.hh
index 00b2070..f26427e 100644
--- a/src/expdesign/primaries.hh
+++ b/src/expdesign/primaries.hh
@@ -23,12 +23,13 @@
 #include <map>
 #include <stdexcept>
 
-#include "../common/config-validate.hh"
-#include "../model/achermann.hh"
+#include "common/config-validate.hh"
+#include "sigproc/sigproc.hh" // for TWinType
+#include "model/achermann.hh"
 #include "recording.hh"
 #include "forward-decls.hh"
 
-#include "../ui/forward-decls.hh"
+//#include "ui/forward-decls.hh"
 
 #if HAVE_CONFIG_H && !defined(VERSION)
 #  include "config.h"
@@ -83,8 +84,8 @@ class CSubject {
 			recordings; // one per channel, naturally
 
 		SEpisode (sigfile::CSource&& Fmc,
-			  const sigfile::SFFTParamSet& fft_params,
-			  const sigfile::SMCParamSet& ucont_params);
+			  const metrics::psd::SFFTParamSet& fft_params,
+			  const metrics::mc::SMCParamSet& ucont_params);
 
 		const char*
 		name() const
@@ -145,12 +146,6 @@ class CSubject {
 	class SEpisodeSequence {
 		friend class agh::CExpDesign;
 		friend class agh::CSCourse;
-		// figure why these guys need rw access to episodes (I
-		// know why, but then, figure what they need it for,
-		// and provide generic methods so these classes can be
-		// unfriended)
-		friend class aghui::SExpDesignUI;
-		friend class aghui::SScoringFacility;
 	    public:
 		list<SEpisode> episodes;
 		size_t
@@ -194,12 +189,12 @@ class CSubject {
 	      // existing one (add F to its sources)
 		int
 		add_one( sigfile::CSource&&,
-			 const sigfile::SFFTParamSet&,
-			 const sigfile::SMCParamSet&,
+			 const metrics::psd::SFFTParamSet&,
+			 const metrics::mc::SMCParamSet&,
 			 float max_hours_apart = 7*24.);
 
 	      // simulations rather belong here
-		typedef map<sigfile::TMetricType,
+		typedef map<metrics::TMetricType,
 			    map<string, // channel
 				map< pair<float, float>,  // frequency range
 				     ach::CModelRun>>>
@@ -353,7 +348,7 @@ class CExpDesign {
 
       // model runs
 	int setup_modrun( const char* j, const char* d, const char* h,
-			  sigfile::TMetricType,
+			  metrics::TMetricType,
 			  float freq_from, float freq_upto,
 			  ach::CModelRun**);
 	void remove_all_modruns();
@@ -415,7 +410,7 @@ class CExpDesign {
 	typedef function<void(const CJGroup&,
 			      const CSubject&,
 			      const string&,
-			      const sigfile::TMetricType&,
+			      const metrics::TMetricType&,
 			      const string&,
 			      const pair<float,float>&,
 			      const ach::CModelRun&,
@@ -428,11 +423,11 @@ class CExpDesign {
 
       // inventory
 	int	num_threads;
-	sigfile::SFFTParamSet
+	metrics::psd::SFFTParamSet
 		fft_params;
-	sigfile::SMCParamSet
+	metrics::mc::SMCParamSet
 		mc_params;
-	sigfile::SFFTParamSet::TWinType // such a fussy
+	sigproc::TWinType // such a fussy
 		af_dampen_window_type;
 	double	af_dampen_factor;
 
diff --git a/src/expdesign/recording.cc b/src/expdesign/recording.cc
index 07c5c47..d268304 100644
--- a/src/expdesign/recording.cc
+++ b/src/expdesign/recording.cc
@@ -21,8 +21,8 @@ using namespace std;
 
 agh::CRecording::
 CRecording (sigfile::CSource& F, int sig_no,
-	    const sigfile::SFFTParamSet& fft_params,
-	    const sigfile::SMCParamSet& mc_params)
+	    const metrics::psd::SFFTParamSet& fft_params,
+	    const metrics::mc::SMCParamSet& mc_params)
       : CBinnedPower (F, sig_no, fft_params),
 	CBinnedMC (F, sig_no, mc_params,
 		   fft_params.pagesize),
@@ -102,7 +102,7 @@ CSCourse (CSubject& J, const string& d, const sigfile::SChannel& h,
 			pz = pa + F.length_in_seconds() / _pagesize;
 	      // anchor zero page, get pagesize from edf^W CBinnedPower^W either goes
 		printf( "CSCourse::CSCourse(): adding %s of [%s, %s, %s] %zu pages (%d indeed) recorded %s",
-			sigfile::metric_method(params._profile_type), F.subject(), F.session(), F.episode(),
+			metrics::metric_method(params._profile_type), F.subject(), F.session(), F.episode(),
 			F.pages(), pz-pa, ctime( &F.start_time()));
 
 		if ( pz - pa != (int)F.pages() ) {
@@ -156,7 +156,7 @@ CSCourse (CRecording& M,
 	int	pa = (size_t)difftime( M.F().start_time(), _0at) / _pagesize,
 		pz = (size_t)difftime( M.F().end_time(), _0at) / _pagesize;
 	printf( "CSCourse::CSCourse(): adding single recording %s of [%s, %s, %s] %zu pages (%d indeed) recorded %s",
-		sigfile::metric_method(params._profile_type), M.F().subject(), M.F().session(), M.F().episode(),
+		metrics::metric_method(params._profile_type), M.F().subject(), M.F().session(), M.F().episode(),
 		M.F().pages(), pz-pa, ctime( &M.F().start_time()));
 
 	if ( pz - pa != (int)M.F().pages() ) {
diff --git a/src/expdesign/recording.hh b/src/expdesign/recording.hh
index c9b5d3a..f4e4962 100644
--- a/src/expdesign/recording.hh
+++ b/src/expdesign/recording.hh
@@ -14,19 +14,19 @@
 #ifndef _AGH_EXPDESIGN_RECORDING_H
 #define _AGH_EXPDESIGN_RECORDING_H
 
-#include "../libsigfile/psd.hh"
-#include "../libsigfile/mc.hh"
-#include "../libsigfile/source.hh"
-#include "../model/beersma.hh"
-#include "../expdesign/forward-decls.hh"
+#include "libsigfile/source.hh"
+#include "metrics/psd.hh"
+#include "metrics/mc.hh"
+#include "model/beersma.hh"
+#include "expdesign/forward-decls.hh"
 
 namespace agh {
 
 using namespace std;
 
 class CRecording
-  : public sigfile::CBinnedPower,
-    public sigfile::CBinnedMC {
+  : public metrics::psd::CBinnedPower,
+    public metrics::mc::CBinnedMC {
 
     friend class CExpDesign;
 
@@ -35,8 +35,8 @@ class CRecording
 
     public:
 	CRecording (sigfile::CSource& F, int sig_no,
-		    const sigfile::SFFTParamSet&,
-		    const sigfile::SMCParamSet&);
+		    const metrics::psd::SFFTParamSet&,
+		    const metrics::mc::SMCParamSet&);
 
 	const char* subject() const      {  return _source.subject(); }
 	const char* session() const      {  return _source.session(); }
@@ -77,7 +77,7 @@ class CRecording
 	// this one damn identical in two bases
 	size_t pagesize() const
 		{
-			return ((sigfile::CBinnedPower*)this) -> sigfile::CPageMetrics_base::pagesize();
+			return ((metrics::psd::CBinnedPower*)this) -> metrics::CPageMetrics_base::pagesize();
 		}
 
 	size_t total_pages() const
@@ -95,7 +95,8 @@ class CRecording
 
 	template <typename T>
 	valarray<T>
-	course( sigfile::TMetricType metric, double freq_from, double freq_upto) const;
+	course( metrics::TMetricType metric,
+		double freq_from, double freq_upto) const;
 
 	bool have_uc_determined() const
 		{
@@ -119,7 +120,7 @@ class CRecording
 
 
 struct SSCourseParamSet {
-	sigfile::TMetricType
+	metrics::TMetricType
 		_profile_type;
 	double	_freq_from,
 		_freq_upto;
@@ -144,7 +145,7 @@ class CSCourse
 		}
 	void create_timeline();
 
-	sigfile::TMetricType profile_type() const
+	metrics::TMetricType profile_type() const
 					{ return _profile_type; }
 	double freq_from() const	{ return _freq_from; }
 	double freq_upto() const	{ return _freq_upto; }
@@ -242,13 +243,14 @@ class CSCourse
 template <typename T>
 valarray<T>
 CRecording::
-course( sigfile::TMetricType metric, double freq_from, double freq_upto) const
+course( metrics::TMetricType metric,
+	double freq_from, double freq_upto) const
 {
 	switch ( metric ) {
-	case sigfile::TMetricType::Psd:
+	case metrics::TMetricType::psd:
 		return (((CBinnedPower*)this)->compute(),
 			CBinnedPower::course<T>( freq_from, freq_upto));
-	case sigfile::TMetricType::Mc:
+	case metrics::TMetricType::mc:
 		return (((CBinnedMC*)this)->compute(),
 			CBinnedMC::course<T>(
 			min( (size_t)((freq_from) / bandwidth),
diff --git a/src/libsigfile/Makefile.am b/src/libsigfile/Makefile.am
index 47c7a66..668901f 100644
--- a/src/libsigfile/Makefile.am
+++ b/src/libsigfile/Makefile.am
@@ -1,6 +1,5 @@
 AM_CXXFLAGS := \
 	-Wall -std=c++0x -shared \
-	$(OPENMP_CXXFLAGS) \
 	-I$(top_srcdir)/src \
 	-fPIC
 
@@ -8,8 +7,8 @@ pkglib_LTLIBRARIES := \
 	libsigfile.la
 
 noinst_LIBRARIES := \
-	libsigfile.a
-libsigfile_a_CXXFLAGS = $(AM_CXXFLAGS)
+	liba.a
+liba_a_CXXFLAGS = $(AM_CXXFLAGS)
 # see http://www.gnu.org/software/automake/manual/html_node/Objects-created-both-with-libtool-and-without.html#Objects-created-both-with-libtool-and-without
 
 # noinst_RELOCATABLES = \
@@ -28,29 +27,12 @@ libsigfile_la_SOURCES := \
 	edf.ii \
 	edf.hh \
 	page.cc \
-	page.hh \
-	page-metrics-base.hh \
-	page-metrics-base.cc \
-	psd.cc \
-	psd.hh \
-	mc.cc \
-	mc.hh \
-	artifacts.hh \
-	artifacts.cc
-libsigfile_a_SOURCES := \
+	page.hh
+liba_a_SOURCES := \
 	$(libsigfile_la_SOURCES)
 
 # libsigfile_la_parts = \
-# 	source-base.o \
-# 	source.o \
-# 	channel.o \
-# 	source-base.o \
-# 	channel.o \
-# 	edf.o \
-# 	mc.o \
-# 	page-metrics-base.o \
-# 	page.o \
-# 	psd.o
+# 	source-base.o \ ...
 
 libsigfile_la_LDFLAGS := \
 	-avoid-version \
@@ -73,8 +55,7 @@ libsigfile_la_LDFLAGS := \
 # 	source.hh \
 # 	edf.ii \
 # 	edf.hh \
-# 	page.hh \
-# 	psd.hh
+# 	page.hh
 
 if DO_PCH
 BUILT_SOURCES := \
@@ -83,11 +64,7 @@ BUILT_SOURCES := \
 	source-base.hh.gch \
 	source.hh.gch \
 	edf.hh.gch \
-	page.hh.gch \
-	page-metrics-base.hh \
-	psd.hh.gch \
-	mc.hh.gch \
-	artifacts.hh.gch
+	page.hh.gch
 %.hh.gch: %.hh
 	$(CXXCOMPILE) -c $<
 CLEANFILES = \
diff --git a/src/libsigfile/edf.cc b/src/libsigfile/edf.cc
index e3fed0a..301b8b0 100644
--- a/src/libsigfile/edf.cc
+++ b/src/libsigfile/edf.cc
@@ -24,8 +24,8 @@
 #include <stdexcept>
 #include <iterator>
 
-#include "../common/lang.hh"
-#include "../common/string.hh"
+#include "common/lang.hh"
+#include "common/string.hh"
 #include "edf.hh"
 #include "source.hh"
 
diff --git a/src/libsigfile/edf.hh b/src/libsigfile/edf.hh
index 822f4d9..436055e 100644
--- a/src/libsigfile/edf.hh
+++ b/src/libsigfile/edf.hh
@@ -23,8 +23,7 @@
 #include <map>
 #include <stdexcept>
 
-#include "../sigproc/sigproc.hh"
-
+#include "sigproc/sigproc.hh"
 #include "channel.hh"
 #include "source-base.hh"
 
@@ -424,7 +423,7 @@ class CEDFFile
 
 	string details( bool channels_too = true) const;
 
-	SFFTParamSet::TWinType af_dampen_window_type; // master copy
+	sigproc::TWinType af_dampen_window_type; // master copy
 
       // static fields (mmapped)
 	struct SEDFHeader {
diff --git a/src/libsigfile/forward-decls.hh b/src/libsigfile/forward-decls.hh
index 79e8a1f..083c607 100644
--- a/src/libsigfile/forward-decls.hh
+++ b/src/libsigfile/forward-decls.hh
@@ -14,8 +14,6 @@
 #ifndef _SIGFILE_FORWARD_DECLS_H
 #define _SIGFILE_FORWARD_DECLS_H
 
-
-
 namespace sigfile {
 
 struct SPage;
@@ -27,12 +25,6 @@ class CSource_base;
 class CSource;
 class CHypnogram;
 
-class CPageMetrics_base;
-struct SFFTParamSet;
-class CBinnedPower;
-struct SMCParamSet;
-class CBinnedMC;
-
 } // namespace sigfile
 
 #endif // _SIGFILE_FORWARD_DECLS_H
diff --git a/src/libsigfile/source-base.hh b/src/libsigfile/source-base.hh
index 1cf7c0d..cc60386 100644
--- a/src/libsigfile/source-base.hh
+++ b/src/libsigfile/source-base.hh
@@ -13,10 +13,10 @@
 #ifndef _SIGFILE_SOURCE_BASE_H
 #define _SIGFILE_SOURCE_BASE_H
 
+#include "common/fs.hh"
+#include "common/alg.hh"
+#include "sigproc/sigproc.hh"
 #include "channel.hh"
-#include "psd.hh"
-#include "../common/fs.hh"
-#include "../common/alg.hh"
 
 #if HAVE_CONFIG_H && !defined(VERSION)
 #  include "config.h"
@@ -65,7 +65,8 @@ make_fname_filters( const T& _filename)
 
 
 struct SArtifacts {
-	SArtifacts( float f_ = 0.95, SFFTParamSet::TWinType dwt_ = SFFTParamSet::TWinType::welch)
+	SArtifacts (float f_ = 0.95,
+		    sigproc::TWinType dwt_ = sigproc::TWinType::welch)
 	      : factor (f_),
 		dampen_window_type (dwt_)
 		{}
@@ -73,7 +74,7 @@ struct SArtifacts {
 	list<agh::alg::SSpan<size_t>>
 		obj;
 	float	factor;
-	SFFTParamSet::TWinType
+	sigproc::TWinType
 		dampen_window_type;
 
 	list<agh::alg::SSpan<size_t>>&
@@ -121,7 +122,9 @@ struct SAnnotation {
 };
 
 inline void
-mark_annotation( list<SAnnotation>& annotations, size_t aa, size_t az, const char* label)
+mark_annotation( list<SAnnotation>& annotations,
+		 size_t aa, size_t az,
+		 const char* label)
 {
 	annotations.emplace_back( aa, az, label);
 }
diff --git a/src/libsigfile/source.hh b/src/libsigfile/source.hh
index edb86c0..58a326c 100644
--- a/src/libsigfile/source.hh
+++ b/src/libsigfile/source.hh
@@ -16,7 +16,6 @@
 #include "source-base.hh"
 #include "edf.hh"
 //#include "other.hh"
-#include "psd.hh"
 #include "page.hh"
 
 #if HAVE_CONFIG_H && !defined(VERSION)
diff --git a/src/metrics/Makefile.am b/src/metrics/Makefile.am
new file mode 100644
index 0000000..65a45ac
--- /dev/null
+++ b/src/metrics/Makefile.am
@@ -0,0 +1,31 @@
+AM_CXXFLAGS := \
+	-Wall -std=c++0x -shared \
+	$(OPENMP_CXXFLAGS) \
+	-I$(top_srcdir)/src \
+	-fPIC
+
+noinst_LIBRARIES := \
+	liba.a
+liba_a_SOURCES := \
+	forward-decls.hh \
+	page-metrics-base.hh \
+	page-metrics-base.cc \
+	psd.cc \
+	psd.hh \
+	mc.cc \
+	mc.hh \
+	mc-artifacts.cc \
+	mc-artifacts.hh
+
+if DO_PCH
+BUILT_SOURCES := \
+	forward-decls.hh.gch \
+	page-metrics-base.hh \
+	psd.hh.gch \
+	mc.hh.gch \
+	mc-artifacts.hh.gch
+%.hh.gch: %.hh
+	$(CXXCOMPILE) -c $<
+CLEANFILES = \
+	*.gch
+endif
diff --git a/src/metrics/forward-decls.hh b/src/metrics/forward-decls.hh
new file mode 100644
index 0000000..3b053e9
--- /dev/null
+++ b/src/metrics/forward-decls.hh
@@ -0,0 +1,36 @@
+// ;-*-C++-*-
+/*
+ *       File name:  metrics/forward-decls.hh
+ *         Project:  Aghermann
+ *          Author:  Andrei Zavada <johnhommer at gmail.com>
+ * Initial version:  2012-11-08
+ *
+ *         Purpose:  profile metrics forward declarations
+ *
+ *         License:  GPL
+ */
+
+
+#ifndef _METRICS_FORWARD_DECLS_H
+#define _METRICS_FORWARD_DECLS_H
+
+namespace metrics {
+
+class CPageMetrics_base;
+
+namespace psd {
+struct SFFTParamSet;
+class CBinnedPower;
+}
+
+namespace mc {
+struct SMCParamSet;
+class CBinnedMC;
+struct SArtifactDetectionPP;
+}
+
+} // namespace metrics
+
+#endif // _METRICS_FORWARD_DECLS_H
+
+// eof
diff --git a/src/libsigfile/artifacts.cc b/src/metrics/mc-artifacts.cc
similarity index 91%
rename from src/libsigfile/artifacts.cc
rename to src/metrics/mc-artifacts.cc
index d216a77..06dff6d 100644
--- a/src/libsigfile/artifacts.cc
+++ b/src/metrics/mc-artifacts.cc
@@ -1,6 +1,6 @@
 // ;-*-C++-*-
 /*
- *       File name:  libsigfile/artifacts.cc
+ *       File name:  metrics/mc-artifacts.cc
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <johnhommer at gmail.com>
  *
@@ -13,10 +13,10 @@
 
 #include <gsl/gsl_histogram.h>
 
-#include "../common/lang.hh"
-#include "../sigproc/sigproc.hh"
+#include "common/lang.hh"
+#include "sigproc/sigproc.hh"
 #include "mc.hh"
-#include "artifacts.hh"
+#include "mc-artifacts.hh"
 
 #if HAVE_CONFIG_H && !defined(VERSION)
 #  include "config.h"
@@ -26,7 +26,7 @@ using namespace std;
 
 
 vector<size_t>
-sigfile::
+metrics::mc::
 detect_artifacts( const valarray<TFloat>& signal, size_t sr,
 		  const SArtifactDetectionPP& P)
 {
@@ -69,7 +69,7 @@ detect_artifacts( const valarray<TFloat>& signal, size_t sr,
 
 
 TFloat
-sigfile::
+metrics::mc::
 estimate_E( const valarray<TFloat>& sssu_diff,
 	    size_t sssu_hist_size,
 	    TFloat dmin, TFloat dmax)
@@ -86,6 +86,4 @@ estimate_E( const valarray<TFloat>& sssu_diff,
 
 
 
-
-
 // eof
diff --git a/src/libsigfile/artifacts.hh b/src/metrics/mc-artifacts.hh
similarity index 83%
rename from src/libsigfile/artifacts.hh
rename to src/metrics/mc-artifacts.hh
index 6c890e0..d2e04c1 100644
--- a/src/libsigfile/artifacts.hh
+++ b/src/metrics/mc-artifacts.hh
@@ -1,18 +1,18 @@
 // ;-*-C++-*-
 /*
- *       File name:  libsigfile/artifacts.hh
+ *       File name:  metrics/mc-artifacts.hh
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <johnhommer at gmail.com>
  *
  * Initial version:  2012-10-21
  *
- *         Purpose:  artifacts, mostly MC-based
+ *         Purpose:  artifacts, MC-based
  *
  *         License:  GPL
  */
 
-#ifndef _SIGFILE_ARTIFACTS_H
-#define _SIGFILE_ARTIFACTS_H
+#ifndef _METRICS_MC_ARTIFACTS_H
+#define _METRICS_MC_ARTIFACTS_H
 
 #include <vector>
 #include <valarray>
@@ -24,7 +24,8 @@
 
 using namespace std;
 
-namespace sigfile {
+namespace metrics {
+namespace mc {
 
 struct SArtifactDetectionPP {
 	double	scope,
@@ -65,9 +66,10 @@ estimate_E( const valarray<TFloat>& sssu_diff,
 }
 
 
-} // namespace sigfile
+} // namespace mc
+} // namespace metrics
 
 
-#endif // _SIGFILE_ARTIFACTS_H
+#endif // _METRICS_MC_ARTIFACTS_H
 
 // eof
diff --git a/src/libsigfile/mc.cc b/src/metrics/mc.cc
similarity index 94%
rename from src/libsigfile/mc.cc
rename to src/metrics/mc.cc
index 6808f24..1af85ec 100644
--- a/src/libsigfile/mc.cc
+++ b/src/metrics/mc.cc
@@ -1,6 +1,6 @@
 // ;-*-C++-*-
 /*
- *       File name:  libsigfile/mc.cc
+ *       File name:  metrics/mc.cc
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <johnhommer at gmail.com>
  *
@@ -11,9 +11,9 @@
  *         License:  GPL
  */
 
-#include "../common/lang.hh"
+#include "common/lang.hh"
+#include "libsigfile/source.hh"
 #include "mc.hh"
-#include "source.hh"
 
 #if HAVE_CONFIG_H && !defined(VERSION)
 #  include "config.h"
@@ -23,7 +23,7 @@ using namespace std;
 
 
 string
-sigfile::CBinnedMC::
+metrics::mc::CBinnedMC::
 fname_base() const
 {
 	DEF_UNIQUE_CHARP (_);
@@ -39,8 +39,6 @@ fname_base() const
 }
 
 
-
-
 inline int
 heaviside( TFloat x)
 {
@@ -50,10 +48,8 @@ heaviside( TFloat x)
 
 
 
-
-
 void
-sigfile::SMCParamSet::
+metrics::mc::SMCParamSet::
 check( size_t) const
 {
         if ( mc_gain < 1.0 )
@@ -65,7 +61,7 @@ check( size_t) const
 
 
 void
-sigfile::SMCParamSet::
+metrics::mc::SMCParamSet::
 reset()
 {
 	scope			=     30 / 6.;  // 5 sec is close to 4 sec ('recommended')
@@ -81,8 +77,8 @@ reset()
 
 
 
-sigfile::CBinnedMC::
-CBinnedMC (const CSource& F, int sig_no,
+metrics::mc::CBinnedMC::
+CBinnedMC (const sigfile::CSource& F, int sig_no,
 	   const SMCParamSet &params,
 	   size_t pagesize)
       : CPageMetrics_base (F, sig_no,
@@ -98,7 +94,7 @@ CBinnedMC (const CSource& F, int sig_no,
 
 
 int
-sigfile::CBinnedMC::
+metrics::mc::CBinnedMC::
 compute( const SMCParamSet& req_params,
 	 bool force)
 {
@@ -188,8 +184,8 @@ compute( const SMCParamSet& req_params,
 
 
 
-sigfile::CBinnedMC::TSSSU
-sigfile::CBinnedMC::
+metrics::mc::CBinnedMC::TSSSU
+metrics::mc::CBinnedMC::
 do_sssu_reduction( const valarray<TFloat>& signal,
 		   size_t samplerate, double scope,
 		   double mc_gain, double iir_backpolate,
@@ -242,7 +238,7 @@ do_sssu_reduction( const valarray<TFloat>& signal,
 
 
 int
-sigfile::CBinnedMC::
+metrics::mc::CBinnedMC::
 export_tsv( const string& fname) const
 {
 	FILE *f = fopen( fname.c_str(), "w");
@@ -278,7 +274,7 @@ export_tsv( const string& fname) const
 
 
 int
-sigfile::CBinnedMC::
+metrics::mc::CBinnedMC::
 export_tsv( size_t bin,
 	    const string& fname) const
 {
@@ -304,6 +300,4 @@ export_tsv( size_t bin,
 }
 
 
-
-
 // eof
diff --git a/src/libsigfile/mc.hh b/src/metrics/mc.hh
similarity index 87%
rename from src/libsigfile/mc.hh
rename to src/metrics/mc.hh
index d3bdfd1..98d5326 100644
--- a/src/libsigfile/mc.hh
+++ b/src/metrics/mc.hh
@@ -1,6 +1,6 @@
 // ;-*-C++-*-
 /*
- *       File name:  libsigfile/mc.hh
+ *       File name:  metrics/mc.hh
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <johnhommer at gmail.com>
  *
@@ -12,10 +12,10 @@
  *         License:  GPL
  */
 
-#ifndef _SIGFILE_MC_H
-#define _SIGFILE_MC_H
+#ifndef _METRICS_MC_H
+#define _METRICS_MC_H
 
-#include "../sigproc/ext-filters.hh"
+#include "sigproc/ext-filters.hh"
 #include "forward-decls.hh"
 #include "page-metrics-base.hh"
 
@@ -25,7 +25,8 @@
 
 using namespace std;
 
-namespace sigfile {
+namespace metrics {
+namespace mc {
 
 
 
@@ -76,14 +77,14 @@ class CBinnedMC
 	void operator=( const CBinnedMC&) = delete;
 
     protected:
-	CBinnedMC( const CSource& F, int sig_no,
+	CBinnedMC( const sigfile::CSource& F, int sig_no,
 		   const SMCParamSet &params,
 		   size_t pagesize);
 
     public:
 	const char* method() const
 		{
-			return metric_method( TMetricType::Mc);
+			return metric_method( TMetricType::mc);
 		}
 
 	int
@@ -114,11 +115,9 @@ class CBinnedMC
 };
 
 
+} // namespace mc
+} // namespace metrics
 
-
-} // namespace sigfile
-
-
-#endif // _SIGFILE_MC_H
+#endif // _METRICS_MC_H
 
 // eof
diff --git a/src/libsigfile/page-metrics-base.cc b/src/metrics/page-metrics-base.cc
similarity index 87%
rename from src/libsigfile/page-metrics-base.cc
rename to src/metrics/page-metrics-base.cc
index 68b2edb..d55ecde 100644
--- a/src/libsigfile/page-metrics-base.cc
+++ b/src/metrics/page-metrics-base.cc
@@ -1,6 +1,6 @@
 // ;-*-C++-*-
 /*
- *       File name:  libsigfile/page-metrics-base.cc
+ *       File name:  metrics/page-metrics-base.cc
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <johnhommer at gmail.com>
  *
@@ -21,8 +21,8 @@
 #include <numeric>
 #include <valarray>
 
+#include "libsigfile/source.hh"
 #include "page-metrics-base.hh"
-#include "source.hh"
 
 #if HAVE_CONFIG_H && !defined(VERSION)
 #  include "config.h"
@@ -30,8 +30,8 @@
 
 using namespace std;
 
-sigfile::CPageMetrics_base::
-CPageMetrics_base (const CSource& F, int sig_no,
+metrics::CPageMetrics_base::
+CPageMetrics_base (const sigfile::CSource& F, int sig_no,
 		   size_t pagesize, size_t bins)
 	: _status (0),
 	  _bins (bins),
@@ -44,14 +44,14 @@ CPageMetrics_base (const CSource& F, int sig_no,
 }
 
 size_t
-sigfile::CPageMetrics_base::
+metrics::CPageMetrics_base::
 samplerate() const
 {
 	return _using_F.samplerate( _using_sig_no);
 }
 
 size_t
-sigfile::CPageMetrics_base::
+metrics::CPageMetrics_base::
 pages() const
 {
 	return _using_F.recording_time() / _pagesize;
@@ -60,7 +60,7 @@ pages() const
 
 
 list<agh::alg::SSpan<size_t>>
-sigfile::CPageMetrics_base::
+metrics::CPageMetrics_base::
 artifacts_in_samples() const
 {
 	return _using_F.artifacts( _using_sig_no)();
@@ -68,7 +68,7 @@ artifacts_in_samples() const
 
 
 list<agh::alg::SSpan<float>>
-sigfile::CPageMetrics_base::
+metrics::CPageMetrics_base::
 artifacts_in_seconds() const
 {
 	list<agh::alg::SSpan<float>> ret;
@@ -83,7 +83,7 @@ artifacts_in_seconds() const
 
 
 int
-sigfile::CPageMetrics_base::
+metrics::CPageMetrics_base::
 _mirror_enable( const char *fname)
 {
 	int fd, retval = 0;
@@ -96,7 +96,7 @@ _mirror_enable( const char *fname)
 
 
 int
-sigfile::CPageMetrics_base::
+metrics::CPageMetrics_base::
 _mirror_back( const char *fname)
 {
 	int fd = -1;
@@ -123,7 +123,7 @@ _mirror_back( const char *fname)
 
 
 int
-sigfile::CPageMetrics_base::
+metrics::CPageMetrics_base::
 export_tsv( const string& fname) const
 {
 	FILE *f = fopen( fname.c_str(), "w");
diff --git a/src/libsigfile/page-metrics-base.hh b/src/metrics/page-metrics-base.hh
similarity index 87%
rename from src/libsigfile/page-metrics-base.hh
rename to src/metrics/page-metrics-base.hh
index cff0592..2273a3e 100644
--- a/src/libsigfile/page-metrics-base.hh
+++ b/src/metrics/page-metrics-base.hh
@@ -1,6 +1,6 @@
 // ;-*-C++-*-
 /*
- *       File name:  libsigfile/page-metrics-base.hh
+ *       File name:  metrics/page-metrics-base.hh
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <johnhommer at gmail.com>
  *
@@ -11,17 +11,17 @@
  *         License:  GPL
  */
 
-#ifndef _SIGFILE_PAGE_METRICS_BASE_H
-#define _SIGFILE_PAGE_METRICS_BASE_H
+#ifndef _METRICS_PAGE_METRICS_BASE_H
+#define _METRICS_PAGE_METRICS_BASE_H
 
-#include <stdexcept>
 #include <list>
-#include <array>
-#include <numeric>
+//#include <array>
+//#include <numeric>
 #include <valarray>
 
-#include "../common/lang.hh"
-#include "../common/alg.hh"
+#include "common/lang.hh"
+#include "common/alg.hh"
+#include "libsigfile/forward-decls.hh"
 #include "forward-decls.hh"
 
 #if HAVE_CONFIG_H && !defined(VERSION)
@@ -30,19 +30,18 @@
 
 using namespace std;
 
-namespace sigfile {
+namespace metrics {
 
-
-enum TMetricType { invalid, Psd, Mc };
+enum class TMetricType { invalid, psd, mc };
 
 inline const char*
 __attribute__ ((pure))
 metric_method( TMetricType t)
 {
 	switch ( t ) {
-	case Psd:
+	case TMetricType::psd:
 		return "PSD";
-	case Mc:
+	case TMetricType::mc:
 		return "Microcontinuity";
 	default:
 		return "(unknown metric)";
@@ -57,7 +56,7 @@ metric_method( TMetricType t)
 class CPageMetrics_base {
 
     protected:
-	CPageMetrics_base (const CSource& F, int sig_no,
+	CPageMetrics_base (const sigfile::CSource& F, int sig_no,
 			   size_t pagesize, size_t bins);
 	CPageMetrics_base (const CPageMetrics_base& rv) = default;
     public:
@@ -115,7 +114,7 @@ class CPageMetrics_base {
 
 	virtual int export_tsv( const string& fname) const;
 
-	const CSource& source() const
+	const sigfile::CSource& source() const
 		{
 			return _using_F;
 		}
@@ -141,7 +140,7 @@ class CPageMetrics_base {
 	size_t  // hash
 		_signature;
 
-	const CSource& _using_F;
+	const sigfile::CSource& _using_F;
 	int _using_sig_no;
 
 	int _mirror_enable( const char*);
@@ -189,13 +188,10 @@ CPageMetrics_base::course( size_t m) const
 }
 
 
-
 template <>
 inline valarray<double>
 CPageMetrics_base::spectrum( size_t p) const
 {
-	if ( unlikely (p >= pages()) )
-		throw out_of_range("CPageMetrics_base::power_spectrum(): page out of range");
 	return _data[ slice(p * _bins, _bins, 1) ];
 }
 
@@ -213,7 +209,6 @@ CPageMetrics_base::spectrum( size_t p) const
 
 } // namespace sigfile
 
-
 #endif // _SIGFILE_PAGE_METRICS_BASE_H
 
 // eof
diff --git a/src/libsigfile/psd.cc b/src/metrics/psd.cc
similarity index 93%
rename from src/libsigfile/psd.cc
rename to src/metrics/psd.cc
index c755cf0..41cf09a 100644
--- a/src/libsigfile/psd.cc
+++ b/src/metrics/psd.cc
@@ -1,10 +1,11 @@
 // ;-*-C++-*-
 /*
- *       File name:  libsigfile/psd.cc
+ *       File name:  metrics/psd.cc
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <johnhommer at gmail.com>
  *                   Parts from PhysioToolKit (http://www.physionet.org/physiotools,
  *                   by George B. Moody (george at mit.edu))
+ *
  * Initial version:  2010-04-28
  *
  *         Purpose:  CBinnedPower methods
@@ -22,11 +23,11 @@
 
 #include <fftw3.h>
 
-#include "../common/lang.hh"
-#include "../common/fs.hh"
-#include "../sigproc/sigproc.hh"
+#include "common/lang.hh"
+#include "common/fs.hh"
+#include "sigproc/sigproc.hh"
+#include "libsigfile/source.hh"
 #include "psd.hh"
-#include "source.hh"
 
 using namespace std;
 
@@ -34,14 +35,14 @@ using namespace std;
 
 
 void
-sigfile::SFFTParamSet::
+metrics::psd::SFFTParamSet::
 check() const
 {
 	if ( pagesize != 4  && pagesize != 20 &&
 	     pagesize != 30 && pagesize != 60 )
 		throw invalid_argument ("Invalid pagesize");
 
-	if ( welch_window_type > TWinType::_total )
+	if ( welch_window_type > sigproc::TWinType::_total )
 		throw invalid_argument ("Invalid window type");
 
 	if ( binsize != .1 && binsize != .25 && binsize != .5 )
@@ -49,11 +50,11 @@ check() const
 }
 
 void
-sigfile::SFFTParamSet::
+metrics::psd::SFFTParamSet::
 reset()
 {
 	pagesize = 30;
-	welch_window_type = TWinType::welch;
+	welch_window_type = sigproc::TWinType::welch;
 	binsize = .25;
 }
 
@@ -62,7 +63,7 @@ reset()
 
 // must match those defined in glade
 const array<const char*, 8>
-	sigfile::SFFTParamSet::welch_window_type_names = {{
+	metrics::psd::SFFTParamSet::welch_window_type_names = {{
 	"Bartlett", "Blackman", "Blackman-Harris",
 	"Hamming",  "Hanning",  "Parzen",
 	"Square",   "Welch"
@@ -73,8 +74,8 @@ const array<const char*, 8>
 
 
 
-sigfile::CBinnedPower::
-CBinnedPower (const CSource& F, int sig_no,
+metrics::psd::CBinnedPower::
+CBinnedPower (const sigfile::CSource& F, int sig_no,
 	      const SFFTParamSet &fft_params)
 	: CPageMetrics_base (F, sig_no,
 			     fft_params.pagesize,
@@ -86,7 +87,7 @@ CBinnedPower (const CSource& F, int sig_no,
 
 
 string
-sigfile::CBinnedPower::
+metrics::psd::CBinnedPower::
 fname_base() const
 {
 	DEF_UNIQUE_CHARP (_);
@@ -123,7 +124,7 @@ to_vad( const valarray<float>& rv)
 
 
 int
-sigfile::CBinnedPower::
+metrics::psd::CBinnedPower::
 compute( const SFFTParamSet& req_params,
 	 bool force)
 {
@@ -250,7 +251,7 @@ compute( const SFFTParamSet& req_params,
 	{
 		size_t	t9 = spp - window,   // start of the last window but one
 			t;
-		auto wfun = sigproc::winf[SFFTParamSet::TWinType::welch];
+		auto wfun = sigproc::winf[sigproc::TWinType::welch];
 		for ( t = 0; t < window/2; ++t )
 			W[t] = wfun( t, window);
 		for ( t = window/2; t < window; ++t )
@@ -305,7 +306,7 @@ compute( const SFFTParamSet& req_params,
 
 
 int
-sigfile::CBinnedPower::
+metrics::psd::CBinnedPower::
 export_tsv( const string& fname) const
 {
 	FILE *f = fopen( fname.c_str(), "w");
@@ -343,7 +344,7 @@ export_tsv( const string& fname) const
 
 
 int
-sigfile::CBinnedPower::
+metrics::psd::CBinnedPower::
 export_tsv( float from, float upto,
 	    const string& fname) const
 {
diff --git a/src/libsigfile/psd.hh b/src/metrics/psd.hh
similarity index 84%
rename from src/libsigfile/psd.hh
rename to src/metrics/psd.hh
index 454989e..57fa05b 100644
--- a/src/libsigfile/psd.hh
+++ b/src/metrics/psd.hh
@@ -1,6 +1,6 @@
 // ;-*-C++-*-
 /*
- *       File name:  libsigfile/psd.hh
+ *       File name:  metrics/psd.hh
  *         Project:  Aghermann
  *          Author:  Andrei Zavada <johnhommer at gmail.com>
  *
@@ -22,6 +22,7 @@
 #include <numeric>
 #include <valarray>
 
+#include "sigproc/sigproc.hh"
 #include "forward-decls.hh"
 #include "page-metrics-base.hh"
 
@@ -31,27 +32,16 @@
 
 using namespace std;
 
-namespace sigfile {
-
+namespace metrics {
+namespace psd {
 
 
 struct SFFTParamSet {
 
-	enum TWinType : int {
-		bartlett,
-		blackman,
-		blackman_harris,
-		hamming,
-		hanning,
-		parzen,
-		square,
-		welch,
-		_total
-	};
 	static const array<const char*, 8> welch_window_type_names;
-	static const char* welch_window_type_name( TWinType i)
+	static const char* welch_window_type_name( sigproc::TWinType i)
 		{
-			return (likely (i < TWinType::_total))
+			return (likely (i < sigproc::TWinType::_total))
 				? welch_window_type_names[(int)i]
 				: "(bad window type)";
 		}
@@ -79,7 +69,7 @@ struct SFFTParamSet {
 	void reset();
 
 	size_t	pagesize;
-	TWinType
+	sigproc::TWinType
 		welch_window_type;
 	double	binsize;
 };
@@ -106,13 +96,13 @@ class CBinnedPower
     public SFFTParamSet {
 
     protected:
-	CBinnedPower (const CSource& F, int sig_no,
+	CBinnedPower (const sigfile::CSource& F, int sig_no,
 		      const SFFTParamSet &fft_params);
 
     public:
 	const char* method() const
 		{
-			return metric_method( TMetricType::Psd);
+			return metric_method( TMetricType::psd);
 		}
 
 	// in a frequency range
@@ -143,9 +133,10 @@ class CBinnedPower
 			const string& fname) const;
 };
 
-} // namespace sigfile
+} // namespace psd
+} // namespace metrics
 
 
-#endif // _SIGFILE_PSD_H
+#endif // _METRICS_PSD_H
 
 // eof
diff --git a/src/model/Makefile.am b/src/model/Makefile.am
index eb3379a..0b1fa73 100644
--- a/src/model/Makefile.am
+++ b/src/model/Makefile.am
@@ -2,9 +2,9 @@ AM_CXXFLAGS := \
 	-Wall -std=c++0x \
 	-I$(top_srcdir)/src
 
-noinst_LIBRARIES := libmodel.a
+noinst_LIBRARIES := liba.a
 
-libmodel_a_SOURCES := \
+liba_a_SOURCES := \
 	achermann-tunable.cc \
 	achermann-tunable.hh \
 	achermann.cc \
diff --git a/src/model/achermann-siman.cc b/src/model/achermann-siman.cc
index 2a5bd63..d55800f 100644
--- a/src/model/achermann-siman.cc
+++ b/src/model/achermann-siman.cc
@@ -15,8 +15,8 @@
 #include <gsl/gsl_math.h>
 #include <gsl/gsl_siman.h>
 
-#include "../common/globals.hh"
-#include "../expdesign/recording.hh"
+#include "common/globals.hh"
+#include "expdesign/recording.hh"
 #include "achermann.hh"
 
 using namespace std;
diff --git a/src/model/achermann.cc b/src/model/achermann.cc
index 70992af..0e87770 100644
--- a/src/model/achermann.cc
+++ b/src/model/achermann.cc
@@ -12,8 +12,8 @@
 
 #include <list>
 
-#include "../expdesign/recording.hh"
-#include "../expdesign/primaries.hh"
+#include "expdesign/recording.hh"
+#include "expdesign/primaries.hh"
 #include "achermann-tunable.hh"
 #include "achermann.hh"
 
@@ -83,7 +83,7 @@ operator==( const SControlParamSet &rv) const
 int
 agh::CExpDesign::
 setup_modrun( const char* j, const char* d, const char* h,
-	      sigfile::TMetricType metric_type,
+	      metrics::TMetricType metric_type,
 	      float freq_from, float freq_upto,
 	      agh::ach::CModelRun** Rpp)
 {
@@ -123,7 +123,7 @@ setup_modrun( const char* j, const char* d, const char* h,
 
 agh::ach::CModelRun::
 CModelRun (CSubject& subject, const string& session, const sigfile::SChannel& channel,
-	   sigfile::TMetricType metric_type,
+	   metrics::TMetricType metric_type,
 	   double freq_from, double freq_upto,
 	   const SControlParamSet& _ctl_params,
 	   const STunableSetWithState& t0)
diff --git a/src/model/achermann.hh b/src/model/achermann.hh
index feff436..450c211 100644
--- a/src/model/achermann.hh
+++ b/src/model/achermann.hh
@@ -19,10 +19,10 @@
 #include <gsl/gsl_rng.h>
 #include <gsl/gsl_siman.h>
 
-#include "../libsigfile/forward-decls.hh"
-#include "../libsigfile/page-metrics-base.hh"
-#include "../libsigfile/page.hh"
-#include "../expdesign/recording.hh"
+#include "libsigfile/forward-decls.hh"
+#include "libsigfile/page.hh"
+#include "metrics/page-metrics-base.hh"
+#include "expdesign/recording.hh"
 #include "achermann-tunable.hh"
 
 
@@ -89,7 +89,7 @@ class CModelRun
 		}
 	CModelRun (CModelRun&&);
 	CModelRun (CSubject&, const string& session, const sigfile::SChannel&,
-		   sigfile::TMetricType,
+		   metrics::TMetricType,
 		   double freq_from, double freq_upto,
 		   const SControlParamSet&, const STunableSetWithState&);
 
diff --git a/src/model/beersma.hh b/src/model/beersma.hh
index 47bacc5..61bde7a 100644
--- a/src/model/beersma.hh
+++ b/src/model/beersma.hh
@@ -16,8 +16,8 @@
 #include <list>
 #include <gsl/gsl_math.h>
 #include <gsl/gsl_siman.h>
-#include "../libsigfile/page-metrics-base.hh"
-#include "../expdesign/forward-decls.hh"
+#include "metrics/page-metrics-base.hh"
+#include "expdesign/forward-decls.hh"
 
 
 #if HAVE_CONFIG_H && !defined(VERSION)
@@ -45,7 +45,7 @@ struct SClassicFit {
 };
 
 struct SClassicFitCtl {
-	sigfile::TMetricType
+	metrics::TMetricType
 		metric;
 	double	freq_from,
 		freq_upto;
@@ -103,7 +103,7 @@ struct SUltradianCycleDetails {
 
 
 struct SUltradianCycleCtl {
-	sigfile::TMetricType
+	metrics::TMetricType
 		metric;
 	double	freq_from,
 		freq_upto;
diff --git a/src/model/borbely.cc b/src/model/borbely.cc
index 02ce908..67d9c4c 100644
--- a/src/model/borbely.cc
+++ b/src/model/borbely.cc
@@ -15,9 +15,9 @@
 #include <gsl/gsl_multifit_nlin.h>
 #include <gsl/gsl_blas.h>
 
-#include "../libsigfile/psd.hh"
-#include "../libsigfile/mc.hh"
-#include "../expdesign/recording.hh"
+#include "metrics/psd.hh"
+#include "metrics/mc.hh"
+#include "expdesign/recording.hh"
 #include "beersma.hh"
 
 using namespace std;
diff --git a/src/sigproc/Makefile.am b/src/sigproc/Makefile.am
index 65836ff..b91c016 100644
--- a/src/sigproc/Makefile.am
+++ b/src/sigproc/Makefile.am
@@ -2,9 +2,9 @@ AM_CXXFLAGS := \
 	-Wall -std=c++0x \
 	-I$(top_srcdir)/src
 
-noinst_LIBRARIES := libsigproc.a
+noinst_LIBRARIES := liba.a
 
-libsigproc_a_SOURCES := \
+liba_a_SOURCES := \
 	exstrom.cc exstrom.hh \
 	ext-filters.cc ext-filters.hh \
 	sigproc.cc sigproc.hh
diff --git a/src/sigproc/sigproc.hh b/src/sigproc/sigproc.hh
index bce0de2..1fd162e 100644
--- a/src/sigproc/sigproc.hh
+++ b/src/sigproc/sigproc.hh
@@ -31,6 +31,18 @@ using namespace std;
 
 namespace sigproc {
 
+enum TWinType : int {
+	bartlett,
+	blackman,
+	blackman_harris,
+	hamming,
+	hanning,
+	parzen,
+	square,
+	welch,
+	_total
+};
+
 extern TFloat (*winf[])(size_t, size_t);
 
 
@@ -140,7 +152,7 @@ struct SPatternParamPack {
 
 template <typename T>
 class CPattern {
-	CPattern() = delete;
+	CPattern () = delete;
 
     public:
       // the complete pattern signature is made of:
@@ -159,7 +171,7 @@ class CPattern {
 		match_b,
 		match_c;
 
-	CPattern( const valarray<T>& pattern,
+	CPattern (const valarray<T>& pattern,
 		  size_t _context_before, size_t _context_after,
 		  size_t _samplerate,
 		  const SPatternParamPack&,
diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am
index 39e48e7..e0d0036 100644
--- a/src/tools/Makefile.am
+++ b/src/tools/Makefile.am
@@ -11,17 +11,17 @@ edfcat_SOURCES := \
 	edfcat.cc
 edfcat_LDADD := \
 	../libsigfile/libsigfile.a \
-	../sigproc/libsigproc.a \
-	../common/libcommon.a \
+	../sigproc/liba.a \
+	../common/liba.a \
 	$(FFTW3_LIBS) $(ITPP_LIBS) $(SAMPLERATE_LIBS) $(GSL_LIBS) \
 	$(OPENMP_LDADD) $(LIBFFTW3_LDADD)
 
 edfhed_SOURCES := \
 	edfhed.cc
 edfhed_LDADD := \
-	../libsigfile/libsigfile.a \
-	../sigproc/libsigproc.a \
-	../common/libcommon.a \
+	../libsigfile/liba.a \
+	../sigproc/liba.a \
+	../common/liba.a \
 	$(FFTW3_LIBS) $(ITPP_LIBS) $(SAMPLERATE_LIBS) $(GSL_LIBS) \
 	$(OPENMP_LDADD) $(LIBFFTW3_LDADD)
 
@@ -30,9 +30,9 @@ edfhed_gtk_SOURCES := \
 edfhed_gtk_CXXFLAGS := \
 	$(AM_CXXFLAGS) 	$(GTK_CFLAGS) -DPACKAGE_DATADIR=\"$(datadir)\"
 edfhed_gtk_LDADD := \
-	../libsigfile/libsigfile.a \
-	../sigproc/libsigproc.a \
-	../common/libcommon.a \
+	../libsigfile/liba.a \
+	../sigproc/liba.a \
+	../common/liba.a \
 	../ui/liba.a \
 	$(FFTW3_LIBS) $(ITPP_LIBS) $(SAMPLERATE_LIBS) $(GSL_LIBS) \
 	$(GTK_LIBS) \
diff --git a/src/ui/mw/mw-construct.cc b/src/ui/mw/mw-construct.cc
index c8969d5..5a27e5e 100644
--- a/src/ui/mw/mw-construct.cc
+++ b/src/ui/mw/mw-construct.cc
@@ -424,16 +424,16 @@ SExpDesignUIWidgets ()
 		throw runtime_error ("Failed to construct widgets");
 
       // --------- Bands
-	if ( !(eBand[sigfile::TBand::delta][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandDeltaFrom")) ||
-	     !(eBand[sigfile::TBand::delta][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandDeltaUpto")) ||
-	     !(eBand[sigfile::TBand::theta][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandThetaFrom")) ||
-	     !(eBand[sigfile::TBand::theta][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandThetaUpto")) ||
-	     !(eBand[sigfile::TBand::alpha][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandAlphaFrom")) ||
-	     !(eBand[sigfile::TBand::alpha][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandAlphaUpto")) ||
-	     !(eBand[sigfile::TBand::beta ][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandBetaFrom" )) ||
-	     !(eBand[sigfile::TBand::beta ][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandBetaUpto" )) ||
-	     !(eBand[sigfile::TBand::gamma][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandGammaFrom")) ||
-	     !(eBand[sigfile::TBand::gamma][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandGammaUpto")) )
+	if ( !(eBand[metrics::psd::TBand::delta][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandDeltaFrom")) ||
+	     !(eBand[metrics::psd::TBand::delta][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandDeltaUpto")) ||
+	     !(eBand[metrics::psd::TBand::theta][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandThetaFrom")) ||
+	     !(eBand[metrics::psd::TBand::theta][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandThetaUpto")) ||
+	     !(eBand[metrics::psd::TBand::alpha][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandAlphaFrom")) ||
+	     !(eBand[metrics::psd::TBand::alpha][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandAlphaUpto")) ||
+	     !(eBand[metrics::psd::TBand::beta ][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandBetaFrom" )) ||
+	     !(eBand[metrics::psd::TBand::beta ][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandBetaUpto" )) ||
+	     !(eBand[metrics::psd::TBand::gamma][0]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandGammaFrom")) ||
+	     !(eBand[metrics::psd::TBand::gamma][1]   = (GtkSpinButton*)gtk_builder_get_object( builder, "eBandGammaUpto")) )
 		throw runtime_error ("Failed to construct widgets");
 
       // --------- Misc
diff --git a/src/ui/mw/mw-loadsave.cc b/src/ui/mw/mw-loadsave.cc
index 0b91adb..fcb5577 100644
--- a/src/ui/mw/mw-loadsave.cc
+++ b/src/ui/mw/mw-loadsave.cc
@@ -105,7 +105,7 @@ load_settings()
 		}
 
 		try {
-			for ( size_t i = sigfile::TBand::delta; i < sigfile::TBand::_total; ++i ) {
+			for ( size_t i = metrics::psd::TBand::delta; i < metrics::psd::TBand::_total; ++i ) {
 				auto& A = conf.lookup(string("Band.")+FreqBandNames[i]);
 				float	f0 = A[0],
 					f1 = A[1];
@@ -158,7 +158,8 @@ load_settings()
 
 
 int
-aghui::SExpDesignUI::save_settings()
+aghui::SExpDesignUI::
+save_settings()
 {
 	libconfig::Config conf;
 
@@ -182,7 +183,7 @@ aghui::SExpDesignUI::save_settings()
 			      forward_list<double> {C.clr.red, C.clr.green, C.clr.blue, C.clr.alpha});
 	}
 
-	for ( unsigned short i = sigfile::TBand::delta; i < sigfile::TBand::_total; ++i )
+	for ( unsigned i = metrics::psd::TBand::delta; i < metrics::psd::TBand::_total; ++i )
 		confval::put( conf, string("Band.") + FreqBandNames[i],
 			      forward_list<double> {freq_bands[i][0], freq_bands[i][1]});
 
diff --git a/src/ui/mw/mw-measurements.cc b/src/ui/mw/mw-measurements.cc
index 3f17e0e..cf960c2 100644
--- a/src/ui/mw/mw-measurements.cc
+++ b/src/ui/mw/mw-measurements.cc
@@ -117,7 +117,7 @@ draw_timeline( cairo_t *cr) const
 	tl_start_fixed_tm.tm_min = 0;
 	time_t tl_start_fixed = mktime( &tl_start_fixed_tm);
 
-	auto	scale = (_p._p.display_profile_type == sigfile::TMetricType::Psd)
+	auto	scale = (_p._p.display_profile_type == metrics::TMetricType::psd)
 		? _p._p.profile_scale_psd
 		: _p._p.profile_scale_mc;
 
diff --git a/src/ui/mw/mw-populate.cc b/src/ui/mw/mw-populate.cc
index c10897e..7790c9f 100644
--- a/src/ui/mw/mw-populate.cc
+++ b/src/ui/mw/mw-populate.cc
@@ -97,15 +97,21 @@ populate( bool do_load)
 
 		gtk_combo_box_set_active( eGlobalADProfiles, 0);
 
-		if ( display_profile_type == sigfile::TMetricType::Psd ) {
+		switch ( display_profile_type ) {
+		case metrics::TMetricType::psd:
 			gtk_combo_box_set_active( eMsmtProfileType, 0);
 			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParams2, FALSE);
 			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParams1, TRUE);
 			gtk_widget_grab_focus( (GtkWidget*)eMsmtOpFreqFrom);
-		} else {
+		    break;
+		case metrics::TMetricType::mc:
 			gtk_combo_box_set_active( eMsmtProfileType, 1);
 			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParams1, FALSE);
 			gtk_widget_set_visible( (GtkWidget*)cMsmtProfileParams2, TRUE);
+		    break;
+		default:
+			// throw something
+		    break;
 		}
 
 		set_controls_for_empty_experiment( false);
@@ -515,7 +521,7 @@ populate_1()
 	snprintf_buf( "<small>%zusec/%gHz/%s</small>",
 		      ED->fft_params.pagesize,
 		      ED->fft_params.binsize,
-		      sigfile::SFFTParamSet::welch_window_type_name( ED->fft_params.welch_window_type));
+		      metrics::psd::SFFTParamSet::welch_window_type_name( ED->fft_params.welch_window_type));
 	gtk_label_set_markup( lMsmtPSDInfo, __buf__);
 
 	snprintf_buf( "<small>%gHz/%g/%g</small>",
diff --git a/src/ui/mw/mw-simulations.cc b/src/ui/mw/mw-simulations.cc
index 62d2b3f..7df4c6b 100644
--- a/src/ui/mw/mw-simulations.cc
+++ b/src/ui/mw/mw-simulations.cc
@@ -51,7 +51,7 @@ populate_2()
 
 				gtk_tree_store_append( mSimulations, &iter_m, &iter_j);
 				gtk_tree_store_set( mSimulations, &iter_m,
-						    0, sigfile::metric_method(MT),
+						    0, metrics::metric_method(MT),
 						    msimulations_visibility_switch_col, TRUE,
 						    -1);
 
@@ -101,7 +101,7 @@ populate_2()
 
 				gtk_tree_store_append( mSimulations, &iter_m, &iter_j);
 				gtk_tree_store_set( mSimulations, &iter_m,
-						    0, sigfile::metric_method(display_profile_type),
+						    0, metrics::metric_method(display_profile_type),
 						    -1);
 				gtk_tree_store_append( mSimulations, &iter_h, &iter_m);
 				gtk_tree_store_set( mSimulations, &iter_h,
diff --git a/src/ui/mw/mw-simulations_cb.cc b/src/ui/mw/mw-simulations_cb.cc
index 3e0c9c8..e4642ea 100644
--- a/src/ui/mw/mw-simulations_cb.cc
+++ b/src/ui/mw/mw-simulations_cb.cc
@@ -51,17 +51,22 @@ iSimulationsRunBatch_activate_cb( GtkMenuItem*, gpointer userdata)
 	gtk_entry_set_text( ED.eBatchSetupChannels, agh::str::join( ED.ED->enumerate_eeg_channels(), "; ").c_str());
 
       // prevent inapplicable inputs when type == mc
-	if ( ED.display_profile_type == sigfile::TMetricType::Mc ) {
+	switch ( ED.display_profile_type ) {
+	case metrics::TMetricType::mc:
 		gtk_spin_button_set_value( ED.eBatchSetupRangeWidth, ED.ED->mc_params.bandwidth);
 		gtk_spin_button_set_value( ED.eBatchSetupRangeInc, ED.ED->mc_params.bandwidth);
 		gtk_widget_set_sensitive( (GtkWidget*)ED.eBatchSetupRangeWidth, FALSE);
 		gtk_widget_set_sensitive( (GtkWidget*)ED.eBatchSetupRangeInc, FALSE);
-	} else {
-		auto bw = ED.operating_range_upto - ED.operating_range_from;
+	    break;
+	case metrics::TMetricType::psd:
+	{	auto bw = ED.operating_range_upto - ED.operating_range_from;
 		gtk_spin_button_set_value( ED.eBatchSetupRangeWidth, bw);
 		gtk_spin_button_set_value( ED.eBatchSetupRangeInc, bw);
-		gtk_widget_set_sensitive( (GtkWidget*)ED.eBatchSetupRangeWidth, TRUE);
+	}	gtk_widget_set_sensitive( (GtkWidget*)ED.eBatchSetupRangeWidth, TRUE);
 		gtk_widget_set_sensitive( (GtkWidget*)ED.eBatchSetupRangeInc, TRUE);
+	    break;
+	default:
+	    break;
 	}
 
 	if ( gtk_dialog_run( ED.wBatchSetup) == GTK_RESPONSE_OK ) {
@@ -101,7 +106,7 @@ iSimulationsRunBatch_activate_cb( GtkMenuItem*, gpointer userdata)
 			[&ED]( const CJGroup&,
 			       const CSubject& J,
 			       const string& D,
-			       const sigfile::TMetricType& T,
+			       const metrics::TMetricType& T,
 			       const string& H,
 			       const pair<float,float>& Q,
 			       const ach::CModelRun&,
diff --git a/src/ui/mw/mw-widgets.hh b/src/ui/mw/mw-widgets.hh
index b2e0740..7475c51 100644
--- a/src/ui/mw/mw-widgets.hh
+++ b/src/ui/mw/mw-widgets.hh
@@ -16,7 +16,7 @@
 #include <map>
 #include <gtk/gtk.h>
 #include "libsigfile/page.hh" // for various enums
-#include "libsigfile/psd.hh"
+#include "metrics/psd.hh"
 #include "model/achermann-tunable.hh"
 #include "ui/ui.hh"  // for SManagedColor
 
@@ -173,7 +173,7 @@ struct SExpDesignUIWidgets {
 		*jFreqFrom,
 		*jFreqWidth;
 	GtkSpinButton
-		*eBand[sigfile::TBand::_total][2];
+		*eBand[metrics::psd::TBand::_total][2];
 	GtkEntry
 		*eBrowseCommand;
 
@@ -364,7 +364,7 @@ struct SExpDesignUIWidgets {
 			return (TColour)((unsigned)s + (unsigned)TColour::score_none);
 		}
 	static TColour
-	band2colour( sigfile::TBand b)
+	band2colour( metrics::psd::TBand b)
 		{
 			return (TColour)((unsigned)b + (unsigned)TColour::band_delta);
 		}
diff --git a/src/ui/mw/mw.cc b/src/ui/mw/mw.cc
index 53ffd87..500b176 100644
--- a/src/ui/mw/mw.cc
+++ b/src/ui/mw/mw.cc
@@ -16,9 +16,9 @@
 #include <signal.h>
 
 #include "common/config-validate.hh"
-#include "libsigfile/page-metrics-base.hh"
+#include "metrics/page-metrics-base.hh"
+#include "metrics/mc-artifacts.hh"
 #include "expdesign/primaries.hh"
-#include "libsigfile/artifacts.hh"
 #include "model/beersma.hh"
 #include "ui/misc.hh"
 #include "ui/sf/sf.hh"
@@ -94,7 +94,7 @@ subject_presentation_by_csubject( const agh::CSubject& j)
 
 
 const char
-	*const aghui::SExpDesignUI::FreqBandNames[(size_t)sigfile::TBand::_total] = {
+*const aghui::SExpDesignUI::FreqBandNames[metrics::psd::TBand::_total] = {
 	"Delta", "Theta", "Alpha", "Beta", "Gamma",
 };
 
@@ -119,7 +119,7 @@ SExpDesignUI (aghui::SSessionChooser *parent,
 	suppress_redraw (false),
 	dl_pid (-1),
 	close_this_SF_now (nullptr),
-	display_profile_type (sigfile::TMetricType::Psd),
+	display_profile_type (metrics::TMetricType::psd),
 	operating_range_from (2.),
 	operating_range_upto (3.),
 	uc_accuracy_factor (1.),
@@ -188,7 +188,7 @@ SExpDesignUI (aghui::SSessionChooser *parent,
 					placeholders::_1, placeholders::_2, placeholders::_3));
 	load_artifact_detection_profiles();
 	if ( global_artifact_detection_profiles.empty() )
-		global_artifact_detection_profiles["default"] = sigfile::SArtifactDetectionPP ();
+		global_artifact_detection_profiles["default"] = metrics::mc::SArtifactDetectionPP ();
 
 	nodestroy_by_cb = false;
 
@@ -207,7 +207,7 @@ SExpDesignUI (aghui::SSessionChooser *parent,
 	W_V1.reg( eUltradianCycleDetectionAccuracy, &uc_accuracy_factor);
 	for ( size_t i = 0; i < sigfile::SPage::TScore::_total; ++i )
 		W_V1.reg( eScoreCode[i], &ext_score_codes[i]);
-	for ( size_t i = 0; i < sigfile::TBand::_total; ++i ) {
+	for ( size_t i = 0; i < metrics::psd::TBand::_total; ++i ) {
 		W_V1.reg( eBand[i][0], &freq_bands[i][0]);
 		W_V1.reg( eBand[i][1], &freq_bands[i][1]);
 	}
@@ -264,7 +264,7 @@ load_artifact_detection_profiles()
 	FILE *domien = fopen( (ED->session_dir() + "/.AD_profiles").c_str(), "r");
 	if ( domien ) {
 		while ( !feof (domien) ) {
-			sigfile::SArtifactDetectionPP P;
+			metrics::mc::SArtifactDetectionPP P;
 			DEF_UNIQUE_CHARP (_);
 			int int_estimate_E, int_use_range;
 // at least gcc 4.7.2 fails to recognize "%as" (dynamic allocation), so
@@ -435,7 +435,7 @@ adjust_op_freq_spinbuttons()
 	suppress_redraw = true;
 
 	switch ( display_profile_type ) {
-	case sigfile::Psd:
+	case metrics::TMetricType::psd:
 		gtk_adjustment_set_step_increment( jMsmtOpFreqFrom,  ED->fft_params.binsize);
 		gtk_adjustment_set_step_increment( jMsmtOpFreqWidth, ED->fft_params.binsize);
 		if ( not used_eeg_samplerates.empty() )
@@ -445,7 +445,7 @@ adjust_op_freq_spinbuttons()
 
 		gtk_widget_set_sensitive( (GtkWidget*)eMsmtOpFreqWidth, TRUE);
 	    break;
-	case sigfile::Mc:
+	case metrics::TMetricType::mc:
 		gtk_adjustment_set_step_increment( jMsmtOpFreqFrom, ED->mc_params.bandwidth);
 		gtk_spin_button_set_value( eMsmtOpFreqWidth, ED->mc_params.bandwidth);
 		if ( not used_eeg_samplerates.empty() )
@@ -456,7 +456,7 @@ adjust_op_freq_spinbuttons()
 
 		gtk_widget_set_sensitive( (GtkWidget*)eMsmtOpFreqWidth, FALSE);
 	    break;
-	case sigfile::invalid:
+	default:
 	    break;
 	}
 
@@ -480,13 +480,13 @@ calculate_profile_scale()
 	avg_profile_height /= valid_episodes;
 
 	switch ( display_profile_type ) {
-	case sigfile::TMetricType::Psd:
+	case metrics::TMetricType::psd:
 		profile_scale_psd = timeline_height / avg_profile_height * .3;
 	    break;
-	case sigfile::TMetricType::Mc:
+	case metrics::TMetricType::mc:
 		profile_scale_mc = timeline_height / avg_profile_height * .3;
 	    break;
-	case sigfile::invalid:
+	default:
 	    break;
 	}
 }
diff --git a/src/ui/mw/mw.hh b/src/ui/mw/mw.hh
index 2e88284..5c35947 100644
--- a/src/ui/mw/mw.hh
+++ b/src/ui/mw/mw.hh
@@ -23,7 +23,7 @@
 
 #include "common/lang.hh"
 #include "common/config-validate.hh"
-#include "libsigfile/artifacts.hh"
+#include "metrics/mc-artifacts.hh"
 #include "model/forward-decls.hh"
 #include "expdesign/primaries.hh"
 #include "ui/ui.hh"
@@ -212,13 +212,13 @@ class SExpDesignUI
 		*close_this_SF_now;
 
 	// common artifact detection profiles
-	map<string, sigfile::SArtifactDetectionPP>
+	map<string, metrics::mc::SArtifactDetectionPP>
 		global_artifact_detection_profiles;
 	void load_artifact_detection_profiles();
 	void save_artifact_detection_profiles() const;
 
       // own variables aka saved settings
-	sigfile::TMetricType
+	metrics::TMetricType
 		display_profile_type;
 	double	operating_range_from,
 		operating_range_upto;
@@ -245,8 +245,8 @@ class SExpDesignUI
 		ext_score_codes;
 
 	static const char
-		*const FreqBandNames[(size_t)sigfile::TBand::_total];
-	double	freq_bands[(size_t)sigfile::TBand::_total][2];
+		*const FreqBandNames[metrics::psd::TBand::_total];
+	double	freq_bands[metrics::psd::TBand::_total][2];
 
 	double	profile_scale_psd,
 		profile_scale_mc;
@@ -281,14 +281,14 @@ class SExpDesignUI
 		timeline_height_saved;
 	int	pagesize_item_saved,
 		binsize_item_saved;
-	sigfile::SFFTParamSet::TWinType
+	sigproc::TWinType
 		fft_params_welch_window_type_saved,
 		af_dampen_window_type_saved;
 	double	af_dampen_factor_saved;
 
 	// sigfile::SFFTParamSet
 	// 	fft_params_saved; // members not represented in widgets as is
-	sigfile::SMCParamSet
+	metrics::mc::SMCParamSet
 		mc_params_saved;
 	SUIVarCollection
 		W_V1,
diff --git a/src/ui/mw/mw_cb.cc b/src/ui/mw/mw_cb.cc
index b0dbe0f..6b26ce3 100644
--- a/src/ui/mw/mw_cb.cc
+++ b/src/ui/mw/mw_cb.cc
@@ -63,7 +63,7 @@ tTaskSelector_switch_page_cb( GtkNotebook*, gpointer, guint page_num, gpointer u
 		gtk_label_set_markup( ED.lSimulationsSession, __buf__);
 		snprintf_buf( "Channel: <b>%s</b>", ED.AghT());
 		gtk_label_set_markup( ED.lSimulationsChannel, __buf__);
-		snprintf_buf( "Metric: <b>%s</b>", sigfile::metric_method(ED.display_profile_type));
+		snprintf_buf( "Metric: <b>%s</b>", metrics::metric_method(ED.display_profile_type));
 		gtk_label_set_markup( ED.lSimulationsProfile, __buf__);
 		gtk_widget_set_sensitive( (GtkWidget*)ED.iExpClose, FALSE);
 		ED.populate_2();
@@ -196,7 +196,7 @@ iExpGloballyDetectArtifacts_activate_cb( GtkMenuItem*, gpointer userdata)
 			if ( not keep_existing )
 				af.clear_all();
 			auto	marked
-				= sigfile::detect_artifacts( signal_original, sr, P);
+				= metrics::mc::detect_artifacts( signal_original, sr, P);
 			for ( size_t p = 0; p < marked.size(); ++p )
 				af.mark_artifact(
 					marked[p] * P.scope * sr,
@@ -411,12 +411,12 @@ eMsmtProfileType_changed_cb( GtkComboBox* b, gpointer userdata)
 	case 0:
 		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParams1, TRUE);
 		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParams2, FALSE);
-		ED.display_profile_type = sigfile::TMetricType::Psd;
+		ED.display_profile_type = metrics::TMetricType::psd;
 	    break;
 	case 1:
 		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParams1, FALSE);
 		gtk_widget_set_visible( (GtkWidget*)ED.cMsmtProfileParams2, TRUE);
-		ED.display_profile_type = sigfile::TMetricType::Mc;
+		ED.display_profile_type = metrics::TMetricType::mc;
 	    break;
 	}
 
diff --git a/src/ui/sf/sf-channel.cc b/src/ui/sf/sf-channel.cc
index d01e7db..765801d 100644
--- a/src/ui/sf/sf-channel.cc
+++ b/src/ui/sf/sf-channel.cc
@@ -104,7 +104,7 @@ SChannel( agh::CRecording& r,
 
 	      // power in bands
 		size_t n_bands = 0;
-		while ( n_bands != sigfile::TBand::_total )
+		while ( n_bands != metrics::psd::TBand::_total )
 			if ( _p._p.freq_bands[n_bands][0] >= spectrum_upper_freq )
 				break;
 			else
@@ -113,13 +113,13 @@ SChannel( agh::CRecording& r,
 		get_psd_in_bands( false);
 
 	      // mc profile
-		mc.bin = (_p._p.operating_range_from - sigfile::SMCParamSet::freq_from) / crecording.bandwidth;
+		mc.bin = (_p._p.operating_range_from - metrics::mc::SMCParamSet::freq_from) / crecording.bandwidth;
 		get_mc_course( false);
 
 	      // delta comes first, calibrate display scale against it
 		//update_profile_display_scales();
 		// don't: interchannel_gap is rubbish yet
-		psd.focused_band = sigfile::TBand::delta;
+		psd.focused_band = metrics::psd::TBand::delta;
 
 	} else if ( type == sigfile::SChannel::TType::emg ) {
 		valarray<TFloat> env_u, env_l;
@@ -230,8 +230,8 @@ void
 aghui::SScoringFacility::SChannel::
 get_psd_course( bool force)
 {
-	auto tmp = (crecording.sigfile::CBinnedPower::compute( force),
-		    crecording.sigfile::CBinnedPower::course<TFloat>( psd.from, psd.upto));
+	auto tmp = (crecording.metrics::psd::CBinnedPower::compute( force),
+		    crecording.metrics::psd::CBinnedPower::course<TFloat>( psd.from, psd.upto));
 	if ( resample_power ) {
 		auto xi = vector<size_t> (tmp.size());
 		for ( size_t i = 0; i < tmp.size(); ++i )
@@ -245,7 +245,7 @@ void
 aghui::SScoringFacility::SChannel::
 get_psd_in_bands( bool force)
 {
-	crecording.sigfile::CBinnedPower::compute( force);
+	crecording.metrics::psd::CBinnedPower::compute( force);
 	if ( resample_power ) {
 		auto xi = vector<size_t> (crecording.CBinnedPower::pages());
 		for ( size_t i = 0; i < xi.size(); ++i )
@@ -253,7 +253,7 @@ get_psd_in_bands( bool force)
 		for ( size_t b = 0; b <= psd.uppermost_band; ++b ) {
 			auto	_from = _p._p.freq_bands[b][0],
 				_upto = _p._p.freq_bands[b][1];
-			auto tmp = crecording.sigfile::CBinnedPower::course<TFloat>( _from, _upto);
+			auto tmp = crecording.metrics::psd::CBinnedPower::course<TFloat>( _from, _upto);
 			psd.course_in_bands[b] =
 				sigproc::interpolate( xi, 3600/_p.pagesize(),
 						      tmp,
@@ -264,7 +264,7 @@ get_psd_in_bands( bool force)
 			auto	_from = _p._p.freq_bands[b][0],
 				_upto = _p._p.freq_bands[b][1];
 			psd.course_in_bands[b] =
-				crecording.sigfile::CBinnedPower::course<TFloat>( _from, _upto);
+				crecording.metrics::psd::CBinnedPower::course<TFloat>( _from, _upto);
 		}
 }
 
@@ -273,8 +273,8 @@ void
 aghui::SScoringFacility::SChannel::
 get_mc_course( bool force)
 {
-	auto tmp = (crecording.sigfile::CBinnedMC::compute( force),
-		    crecording.sigfile::CBinnedMC::course<TFloat>( mc.bin));
+	auto tmp = (crecording.metrics::mc::CBinnedMC::compute( force),
+		    crecording.metrics::mc::CBinnedMC::course<TFloat>( mc.bin));
 	if ( resample_power ) {
 		auto xi = vector<size_t> (tmp.size());
 		for ( size_t i = 0; i < tmp.size(); ++i )
@@ -291,13 +291,13 @@ void
 aghui::SScoringFacility::SChannel::
 get_spectrum( size_t p)
 {
-	spectrum = crecording.sigfile::CBinnedPower::spectrum<TFloat>( p);
+	spectrum = crecording.metrics::psd::CBinnedPower::spectrum<TFloat>( p);
 }
 void
 aghui::SScoringFacility::SChannel::
 get_spectrum()
 {
-	spectrum = crecording.sigfile::CBinnedPower::spectrum<TFloat>( _p.cur_page());
+	spectrum = crecording.metrics::psd::CBinnedPower::spectrum<TFloat>( _p.cur_page());
 }
 
 
@@ -340,10 +340,10 @@ calculate_dirty_percent()
 
 void
 aghui::SScoringFacility::SChannel::
-detect_artifacts( const sigfile::SArtifactDetectionPP& P)
+detect_artifacts( const metrics::mc::SArtifactDetectionPP& P)
 {
 	auto marked =
-		sigfile::detect_artifacts( signal_original, samplerate(), P);
+		metrics::mc::detect_artifacts( signal_original, samplerate(), P);
 	for ( size_t p = 0; p < marked.size(); ++p )
 		crecording.F().artifacts(_h).mark_artifact(
 			marked[p] * P.scope * samplerate(), (marked[p]+1) * P.scope * samplerate());
@@ -504,7 +504,7 @@ _put_selection()
 		_p.artifact_detection_dialog.W_V.down();
 		auto& P = _p.artifact_detection_dialog.P;
 		auto sssu =
-			sigfile::CBinnedMC::do_sssu_reduction(
+			metrics::mc::CBinnedMC::do_sssu_reduction(
 				signal_filtered[ slice (selection_start, (selection_end - selection_start), 1) ],
 				samplerate(), (selection_end - selection_start) / samplerate(),
 				P.mc_gain, P.iir_backpolate,
diff --git a/src/ui/sf/sf-montage.cc b/src/ui/sf/sf-montage.cc
index d8b8b4b..c304499 100644
--- a/src/ui/sf/sf-montage.cc
+++ b/src/ui/sf/sf-montage.cc
@@ -602,9 +602,9 @@ draw_overlays( cairo_t* cr,
 		guint i;
 
 		if ( draw_bands ) {
-			for ( size_t b = sigfile::TBand::delta; b <= psd.uppermost_band; ++b ) {
+			for ( size_t b = metrics::psd::TBand::delta; b <= psd.uppermost_band; ++b ) {
 				auto& P = psd.course_in_bands[b];
-				_p._p.CwB[SExpDesignUI::band2colour((sigfile::TBand)b)].set_source_rgba( cr, .5);
+				_p._p.CwB[SExpDesignUI::band2colour((metrics::psd::TBand)b)].set_source_rgba( cr, .5);
 				double zero = 0.5 / P.size() * _p.da_wd;
 				cairo_move_to( cr, zero,
 					       - P[0] * psd.display_scale + pbot);
diff --git a/src/ui/sf/sf-montage_cb.cc b/src/ui/sf/sf-montage_cb.cc
index c46ab99..30eca74 100644
--- a/src/ui/sf/sf-montage_cb.cc
+++ b/src/ui/sf/sf-montage_cb.cc
@@ -350,7 +350,7 @@ daSFMontage_scroll_event_cb( GtkWidget *wid, GdkEventScroll *event, gpointer use
 			switch ( event->direction ) {
 			case GDK_SCROLL_DOWN:
 				if ( Ch->draw_bands ) {
-					if ( Ch->psd.focused_band > sigfile::TBand::delta ) {
+					if ( Ch->psd.focused_band > metrics::psd::TBand::delta ) {
 						--Ch->psd.focused_band;
 						if ( Ch->autoscale_profile )
 							Ch->update_profile_display_scales();
@@ -403,8 +403,8 @@ daSFMontage_scroll_event_cb( GtkWidget *wid, GdkEventScroll *event, gpointer use
 				}
 				break;
 			case GDK_SCROLL_UP:
-				if ( Ch->mc.bin < Ch->crecording.sigfile::SMCParamSet::compute_n_bins(
-					     Ch->crecording.sigfile::CBinnedMC::samplerate()) - 1 ) {
+				if ( Ch->mc.bin < Ch->crecording.metrics::mc::SMCParamSet::compute_n_bins(
+					     Ch->crecording.metrics::mc::CBinnedMC::samplerate()) - 1 ) {
 					++Ch->mc.bin;
 					Ch->get_mc_course( false);
 					if ( Ch->autoscale_profile )
diff --git a/src/ui/sf/sf-phasediff.cc b/src/ui/sf/sf-phasediff.cc
index e8867a3..894563f 100644
--- a/src/ui/sf/sf-phasediff.cc
+++ b/src/ui/sf/sf-phasediff.cc
@@ -151,8 +151,8 @@ draw( cairo_t* cr, int wd, int ht)
 
       // psd course in selected freq range
 	{
-		auto	C1 = channel1->crecording.sigfile::CBinnedPower::course<TFloat>( from, upto);
-//			C2 = channel2->crecording.sigfile::CBinnedPower::course<TFloat>( from, upto) * display_scale + ht/2;
+		auto	C1 = channel1->crecording.metrics::psd::CBinnedPower::course<TFloat>( from, upto);
+//			C2 = channel2->crecording.metrics::psd::CBinnedPower::course<TFloat>( from, upto) * display_scale + ht/2;
 
 		ED.CwB[SExpDesignUI::TColour::profile_psd_sf].set_source_rgba( cr, .5);
 		auto	scale =
diff --git a/src/ui/sf/sf.cc b/src/ui/sf/sf.cc
index 7b74c84..48cc722 100644
--- a/src/ui/sf/sf.cc
+++ b/src/ui/sf/sf.cc
@@ -159,7 +159,7 @@ SScoringFacility (agh::CSubject& J,
 			if ( not isfinite(h.psd.display_scale) || h.psd.display_scale <= DBL_MIN )
 				h.psd.display_scale =
 					agh::alg::calibrate_display_scale(
-						h.psd.course_in_bands[sigfile::TBand::delta],
+						h.psd.course_in_bands[metrics::psd::TBand::delta],
 						h.psd.course.size(),
 						interchannel_gap / 4);
 			if ( not isfinite(h.mc.display_scale) || h.mc.display_scale <= DBL_MIN )
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index ee43f2e..ffbab3c 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -19,7 +19,7 @@
 
 #include "common/config-validate.hh"
 #include "sigproc/sigproc.hh"
-#include "libsigfile/page-metrics-base.hh"
+#include "metrics/page-metrics-base.hh"
 #include "expdesign/primaries.hh"
 #include "ica/ica.hh"
 #include "ui/globals.hh"
@@ -105,7 +105,7 @@ class SScoringFacility
 	      // artifacts
 		float calculate_dirty_percent();
 		float	percent_dirty;
-		void detect_artifacts( const sigfile::SArtifactDetectionPP&);
+		void detect_artifacts( const metrics::mc::SArtifactDetectionPP&);
 
 	      // annotations
 		list<sigfile::SAnnotation*>
@@ -157,7 +157,7 @@ class SScoringFacility
 				course; // can possibly live outside in core, no?
 			double	from, upto;
 			double	display_scale; // saved via libconfig, requiring it to be double
-			array<valarray<TFloat>, sigfile::TBand::_total>
+			array<valarray<TFloat>, metrics::psd::TBand::_total>
 				course_in_bands;
 			size_t	focused_band,
 				uppermost_band;
@@ -621,7 +621,7 @@ class SScoringFacility
 		SArtifactDetectionDialog (SScoringFacility&);
 	       ~SArtifactDetectionDialog ();
 
-		sigfile::SArtifactDetectionPP
+		metrics::mc::SArtifactDetectionPP
 			P;
 		sigfile::SArtifacts
 			artifacts_backup;

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list