[med-svn] [aghermann] 06/14: refactor sigfile:: definitions wrt types & channel classification

andrei zavada hmmr-guest at moszumanska.debian.org
Sat Jan 30 18:16:02 UTC 2016


This is an automated email from the git hooks/post-receive script.

hmmr-guest pushed a commit to branch WIP
in repository aghermann.

commit 014de4b283298218dbbb1bea3a78059d479ed4d2
Author: Andrei Zavada <hmmr at asium>
Date:   Tue Nov 17 11:02:57 2015 +0200

    refactor sigfile:: definitions wrt types & channel classification
    
    Work towards accommodating prefixed channel names like "FZ-AV",
    seen in the wild (that Ivan's EEG from oberig.ua).
    
    * use enum class for signal types;
    * have channel represented in static registry as {"Fz", types::eeg}, thus
      avoiding enum channels that can/should/may have or not have comparable
      elements;
    * sigfile::SChannel::TType -> sigfile::definitions::types throughout.
---
 upstream/src/aghermann/artifact-detection/3in1.cc  |  17 +-
 upstream/src/aghermann/expdesign/dirlevel.cc       |   8 -
 upstream/src/aghermann/expdesign/expdesign.cc      |  13 +-
 upstream/src/aghermann/expdesign/expdesign.hh      |   9 +-
 upstream/src/aghermann/expdesign/profile.hh        |   7 -
 upstream/src/aghermann/expdesign/recording.hh      |  11 +-
 upstream/src/aghermann/expdesign/subject.hh        |   9 +-
 upstream/src/aghermann/expdesign/tree-scanner.cc   |  11 +-
 upstream/src/aghermann/globals.hh                  |   7 -
 upstream/src/aghermann/model/achermann.hh          |   7 -
 upstream/src/aghermann/rk1968/rk1968.cc            |  11 +-
 upstream/src/aghermann/ui/mw/mainmenu_cb.cc        |  17 +-
 upstream/src/aghermann/ui/mw/mw.hh                 |   4 +-
 upstream/src/aghermann/ui/mw/mw_cb.cc              |  14 +-
 upstream/src/aghermann/ui/mw/populate.cc           |  13 +-
 upstream/src/aghermann/ui/sf/channel.cc            |  22 +--
 upstream/src/aghermann/ui/sf/channel.hh            |  11 +-
 .../src/aghermann/ui/sf/d/phasediff-construct.cc   |  11 +-
 upstream/src/aghermann/ui/sf/ica.cc                |  10 +-
 upstream/src/aghermann/ui/sf/montage-menus_cb.cc   |  13 +-
 upstream/src/aghermann/ui/sf/montage-overlays.cc   |  16 +-
 upstream/src/aghermann/ui/sf/montage.cc            |  12 +-
 upstream/src/aghermann/ui/sf/montage_cb.cc         |  21 +--
 upstream/src/aghermann/ui/sf/sf.cc                 |  41 ++---
 upstream/src/aghermann/ui/sm/sm.cc                 |   7 -
 upstream/src/common/log-facility.hh                |   7 -
 upstream/src/common/subject_id.cc                  |   9 -
 upstream/src/libmetrics/mc.cc                      |  16 +-
 upstream/src/libmetrics/page-metrics-base.cc       |  11 +-
 upstream/src/libmetrics/psd.cc                     |  17 +-
 upstream/src/libmetrics/swu.cc                     |  18 +-
 upstream/src/libsigfile/channel.cc                 | 200 ++++++++++-----------
 upstream/src/libsigfile/channel.hh                 | 192 ++++++--------------
 upstream/src/libsigfile/edf-io.cc                  |  11 +-
 upstream/src/libsigfile/edf.cc                     |  47 ++---
 upstream/src/libsigfile/edf.hh                     |  15 +-
 upstream/src/libsigfile/source-base.hh             |  13 +-
 upstream/src/libsigfile/tsv.cc                     |  10 +-
 upstream/src/libsigfile/tsv.hh                     |  21 +--
 upstream/src/libsigfile/typed-source.cc            |   8 -
 upstream/src/libsigfile/typed-source.hh            |   7 -
 upstream/src/tools/edfhed-gtk.cc                   |   8 -
 upstream/src/tools/edfhed.cc                       |  14 +-
 43 files changed, 259 insertions(+), 687 deletions(-)

diff --git a/upstream/src/aghermann/artifact-detection/3in1.cc b/upstream/src/aghermann/artifact-detection/3in1.cc
index 853c23f..12c35e3 100644
--- a/upstream/src/aghermann/artifact-detection/3in1.cc
+++ b/upstream/src/aghermann/artifact-detection/3in1.cc
@@ -106,15 +106,16 @@ detect_artifacts( sigfile::SNamedChannel& N,
 
       // 2. EMG perturbations
         if ( P.do_emg_perturbations &&
-             N.source.signal_type(N.sig_no) != sigfile::SChannel::TType::emg ) {
+             N.source.signal_type(N.sig_no) != sigfile::definitions::types::emg ) {
                 // which EMG channels are there?
                 list<int> emgRR;
                 for ( int h = 0; h < (int)N.source.n_channels(); ++h )
-                        if ( N.source.signal_type(h) == sigfile::SChannel::TType::emg )
+                        if ( N.source.signal_type(h) == sigfile::definitions::types::emg )
                                 emgRR.push_front( h);
 
                 if ( emgRR.empty() )
-                        APPLOG_INFO ("No EMG recordings in %s:%s, skipping EMG perturbation-bound artifact detection", N.source.filename(), N.source.channel_by_id(N.sig_no).name());
+                        APPLOG_INFO ("No EMG recordings in %s:%s, skipping EMG perturbation-bound artifact detection",
+                                     N.source.filename(), N.source.channel_by_id(N.sig_no).custom_name());
 
                 for ( const int h : emgRR ) {
                         sigproc::SSignalRef<TFloat> sigref {N.source.get_signal_original(h), N.source.samplerate(h)};
@@ -140,7 +141,7 @@ detect_artifacts( sigfile::SNamedChannel& N,
 
         // 3. MC-based
         if ( P.do_mc_based &&
-             N.source.signal_type(N.sig_no) == sigfile::SChannel::TType::eeg ) {
+             N.source.signal_type(N.sig_no) == sigfile::definitions::types::eeg ) {
                 auto marked =
                         metrics::mc::detect_artifacts( S, sr, P.MC);
                 for ( size_t p = 0; p < marked.size(); ++p ) {
@@ -172,11 +173,3 @@ detect_artifacts( sigfile::CSource& F,
                 agh::ad::detect_artifacts( N, P);
         }
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/expdesign/dirlevel.cc b/upstream/src/aghermann/expdesign/dirlevel.cc
index 0a07650..dea8285 100644
--- a/upstream/src/aghermann/expdesign/dirlevel.cc
+++ b/upstream/src/aghermann/expdesign/dirlevel.cc
@@ -164,11 +164,3 @@ serialize() const
                         "%s/%s %s (%s/%s/%s)",
                         subdir.c_str(), name.c_str(), exp_dir_level_s(), level_id.g.c_str(), level_id.j.c_str(), level_id.d.c_str()));
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/expdesign/expdesign.cc b/upstream/src/aghermann/expdesign/expdesign.cc
index 4d57397..713ed34 100644
--- a/upstream/src/aghermann/expdesign/expdesign.cc
+++ b/upstream/src/aghermann/expdesign/expdesign.cc
@@ -404,7 +404,7 @@ enumerate_eeg_channels() const
                                 for ( auto &E : D.second.episodes )
                                         for ( auto &F : E.sources )
                                                 for ( size_t h = 0; h < F().n_channels(); ++h )
-                                                        if ( F().signal_type(h) == sigfile::SChannel::TType::eeg )
+                                                        if ( F().signal_type(h) == sigfile::definitions::types::eeg )
                                                                 recp.push_back( F().channel_by_id(h));
         recp.sort();
         recp.unique();
@@ -433,7 +433,7 @@ enumerate_all_channels() const
 
 list<size_t>
 agh::CExpDesign::
-used_samplerates( sigfile::SChannel::TType type) const
+used_samplerates( sigfile::definitions::types type) const
 {
         list<size_t> recp;
         for ( auto &G : groups )
@@ -442,7 +442,7 @@ used_samplerates( sigfile::SChannel::TType type) const
                                 for ( auto &E : D.second.episodes )
                                         for ( auto &F : E.sources )
                                                 for ( size_t h = 0; h < F().n_channels(); ++h )
-                                                        if ( type == sigfile::SChannel::TType::other or
+                                                        if ( type == sigfile::definitions::types::invalid or
                                                              type == F().signal_type(h) ) {
                                                                 recp.push_back( F().samplerate(h));
                                                         }
@@ -612,10 +612,3 @@ purge_cached_profiles()
                         session_dir())
                 .c_str());
 }
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/expdesign/expdesign.hh b/upstream/src/aghermann/expdesign/expdesign.hh
index f8d9828..43bc0cf 100644
--- a/upstream/src/aghermann/expdesign/expdesign.hh
+++ b/upstream/src/aghermann/expdesign/expdesign.hh
@@ -147,7 +147,7 @@ class CExpDesign {
         list<string> enumerate_episodes() const;
         list<sigfile::SChannel> enumerate_all_channels() const;
         list<sigfile::SChannel> enumerate_eeg_channels() const;
-        list<size_t> used_samplerates( sigfile::SChannel::TType type = sigfile::SChannel::TType::other) const;
+        list<size_t> used_samplerates( sigfile::definitions::types type = sigfile::definitions::types::invalid) const;
 
       // omp-enabled lists:foreach
         typedef function<void(CSubject&)>
@@ -363,10 +363,3 @@ load_profiles_from_location( const string& subdir,
 } // namespace agh
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/expdesign/profile.hh b/upstream/src/aghermann/expdesign/profile.hh
index a668d13..c00f805 100644
--- a/upstream/src/aghermann/expdesign/profile.hh
+++ b/upstream/src/aghermann/expdesign/profile.hh
@@ -163,10 +163,3 @@ CProfile::nth_episode_end_page( size_t n) const
 } // namespace agh
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/expdesign/recording.hh b/upstream/src/aghermann/expdesign/recording.hh
index 99e201c..7538082 100644
--- a/upstream/src/aghermann/expdesign/recording.hh
+++ b/upstream/src/aghermann/expdesign/recording.hh
@@ -145,9 +145,9 @@ class CRecording {
         const char* subject() const      {  return _source().subject().name.c_str(); }
         const char* session() const      {  return _source().session(); }
         const char* episode() const      {  return _source().episode(); }
-        const char* channel() const      {  return _source().channel_by_id(_sig_no).name(); }
+        const char* channel() const      {  return _source().channel_by_id(_sig_no).custom_name(); }
 
-        sigfile::SChannel::TType
+        sigfile::definitions::types
         signal_type() const
                 { return _source().signal_type(_sig_no); }
 
@@ -284,10 +284,3 @@ course( const SProfileParamSet::MC& p)
 } // namespace agh
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/expdesign/subject.hh b/upstream/src/aghermann/expdesign/subject.hh
index 53fb96f..2c269c8 100644
--- a/upstream/src/aghermann/expdesign/subject.hh
+++ b/upstream/src/aghermann/expdesign/subject.hh
@@ -82,7 +82,7 @@ struct SEpisode {
 
                 const char*
                 channel() const
-                        { return (_h == -1) ? "(embedded)" : _source.channel_by_id(_h).name(); }
+                        { return (_h == -1) ? "(embedded)" : _source.channel_by_id(_h).custom_name(); }
 
                 agh::alg::SSpan<float>
                 page_span( size_t pagesize) const
@@ -212,10 +212,3 @@ class CSubject : public SSubjectId {
 } // namespace agh
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/expdesign/tree-scanner.cc b/upstream/src/aghermann/expdesign/tree-scanner.cc
index 35203c2..1e7af1f 100644
--- a/upstream/src/aghermann/expdesign/tree-scanner.cc
+++ b/upstream/src/aghermann/expdesign/tree-scanner.cc
@@ -390,20 +390,13 @@ compute_profiles()
                      size_t i, size_t total)
                 {
                         only_progress_fun(
-                                string ("Compute ") + R.F().filename() + ":"+R.F().channel_by_id(R.h()).name(),
+                                string ("Compute ") + R.F().filename() + ":"+R.F().channel_by_id(R.h()).custom_name(),
                                 total, i);
                 };
         TRecordingFilterFun filter =
                 [&]( CRecording& R)
                 {
-                        return R.signal_type() == sigfile::SChannel::TType::eeg;
+                        return R.signal_type() == sigfile::definitions::types::eeg;
                 };
         for_all_recordings( F, G, filter);
 }
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/globals.hh b/upstream/src/aghermann/globals.hh
index 163332c..a311245 100644
--- a/upstream/src/aghermann/globals.hh
+++ b/upstream/src/aghermann/globals.hh
@@ -44,10 +44,3 @@ void fini();
 } // namespace agh
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/model/achermann.hh b/upstream/src/aghermann/model/achermann.hh
index 0026620..3e9660c 100644
--- a/upstream/src/aghermann/model/achermann.hh
+++ b/upstream/src/aghermann/model/achermann.hh
@@ -141,10 +141,3 @@ _which_gc( size_t p) const // selects episode egc by page, or returns &gc if !AZ
 } // namespace agh
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/rk1968/rk1968.cc b/upstream/src/aghermann/rk1968/rk1968.cc
index 6fa2808..66ec05c 100644
--- a/upstream/src/aghermann/rk1968/rk1968.cc
+++ b/upstream/src/aghermann/rk1968/rk1968.cc
@@ -265,7 +265,7 @@ host_get_data( lua_State *L)
                 lua_settop( L, 0);  // now we can push
                 lua_pushinteger( L, E.recordings.size());
                 for ( auto& H : E.recordings )
-                        lua_pushstring( L, H.first.c_str());
+                        lua_pushstring( L, H.first.custom_name());
 
                 return 1 + E.recordings.size();
         }
@@ -286,7 +286,7 @@ host_get_data( lua_State *L)
                 lua_pushinteger( L, hh_of_type);
                 for ( auto& H : E.recordings )
                         if ( 0 == strcasecmp( H.first.type_s(), type) )
-                                lua_pushstring( L, H.first.c_str());
+                                lua_pushstring( L, H.first.custom_name());
 
                 return 1 + hh_of_type;
         }
@@ -470,10 +470,3 @@ host_mark_page( lua_State *L)
 }
 
 } // extern "C"
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
index 051dde7..700c446 100644
--- a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
+++ b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
@@ -334,7 +334,7 @@ iExpGloballyScore_activate_cb(
                 filter =
                 [&]( SEpisode& E)
                 {
-                        return true;  // R.signal_type() == sigfile::SChannel::TType::eeg;
+                        return true;  // R.signal_type() == sigfile::definitions::types::eeg;
                 };
             break;
 
@@ -364,7 +364,7 @@ iExpGloballyScore_activate_cb(
 
         for ( auto& SF : ED.open_scoring_facilities ) {
                 for ( auto& H : SF->channels )
-                        if ( H.type() == sigfile::SChannel::TType::eeg )
+                        if ( H.type() == sigfile::definitions::types::eeg )
                                 H.get_signal_filtered();
                 SF->queue_redraw_all();
         }
@@ -460,7 +460,7 @@ iExpGloballyDetectArtifacts_activate_cb(
                 };
                 filter = [&]( SEpisode& E)
                 {
-                        return true;  // R.signal_type() == sigfile::SChannel::TType::eeg;
+                        return true;  // R.signal_type() == sigfile::definitions::types::eeg;
                 };
             break;
 
@@ -490,7 +490,7 @@ iExpGloballyDetectArtifacts_activate_cb(
 
         for ( auto& SF : ED.open_scoring_facilities ) {
                 for ( auto& H : SF->channels )
-                        if ( H.type() == sigfile::SChannel::TType::eeg )
+                        if ( H.type() == sigfile::definitions::types::eeg )
                                 H.get_signal_filtered();
                 SF->queue_redraw_all();
         }
@@ -568,7 +568,7 @@ iExpGloballySetFilters_activate_cb(
 
                 for ( auto& SF : ED.open_scoring_facilities ) {
                         for ( auto& H : SF->channels )
-                                if ( H.type() == sigfile::SChannel::TType::eeg )
+                                if ( H.type() == sigfile::definitions::types::eeg )
                                         H.get_signal_filtered();
                         SF->queue_redraw_all();
                 }
@@ -649,10 +649,3 @@ iExpQuit_activate_cb(
 
 
 } // extern "C"
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/mw/mw.hh b/upstream/src/aghermann/ui/mw/mw.hh
index da5a758..7927191 100644
--- a/upstream/src/aghermann/ui/mw/mw.hh
+++ b/upstream/src/aghermann/ui/mw/mw.hh
@@ -177,8 +177,8 @@ class SExpDesignUI
                 _AghGi,
                 _AghDi,
                 _AghEi;
-        const char* AghH() const { return (_AghHi != AghHH.end()) ? _AghHi->name() : "(invalid channel)"; }
-        const char* AghT() const { return (_AghTi != AghTT.end()) ? _AghTi->name() : "(invalid channel)"; }
+        const char* AghH() const { return (_AghHi != AghHH.end()) ? _AghHi->canonical_name() : "(invalid channel)"; }
+        const char* AghT() const { return (_AghTi != AghTT.end()) ? _AghTi->canonical_name() : "(invalid channel)"; }
         const char* AghG() const { return (_AghGi != AghGG.end()) ? _AghGi->c_str() : "(invalid group)"; }
         const char* AghD() const { return (_AghDi != AghDD.end()) ? _AghDi->c_str() : "(invalid session)"; }
         const char* AghE() const { return (_AghEi != AghEE.end()) ? _AghEi->c_str() : "(invalid episode)"; }
diff --git a/upstream/src/aghermann/ui/mw/mw_cb.cc b/upstream/src/aghermann/ui/mw/mw_cb.cc
index e8c571e..02d05cb 100644
--- a/upstream/src/aghermann/ui/mw/mw_cb.cc
+++ b/upstream/src/aghermann/ui/mw/mw_cb.cc
@@ -360,10 +360,9 @@ eMsmtChannel_changed_cb(
         auto& ED = *(SExpDesignUI*)userdata;
         auto oldval = ED._AghTi;
         auto newval = gtk_combo_box_get_active_id( combobox);
-        ED._AghTi = find( ED.AghTT.begin(), ED.AghTT.end(),
-                          newval);
-        ED._AghHi = find( ED.AghHH.begin(), ED.AghHH.end(),
-                          newval);
+        auto F = [&newval](const sigfile::SChannel& h) { return h.fuzzy_equal(newval); };
+        ED._AghTi = find_if( ED.AghTT.begin(), ED.AghTT.end(), F);
+        ED._AghHi = find_if( ED.AghHH.begin(), ED.AghHH.end(), F);
         if ( /* _AghTi != AghTT.end() && */ oldval != ED._AghTi )
                 ED.populate_1();
         if ( ED.autoscale )
@@ -391,10 +390,3 @@ bMainCloseThatSF_clicked_cb(
 }
 
 } // extern "C"
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/mw/populate.cc b/upstream/src/aghermann/ui/mw/populate.cc
index d5cfe32..93e0672 100644
--- a/upstream/src/aghermann/ui/mw/populate.cc
+++ b/upstream/src/aghermann/ui/mw/populate.cc
@@ -53,7 +53,7 @@ populate( bool do_load)
         used_samplerates =
                 ED->used_samplerates();
         used_eeg_samplerates =
-                ED->used_samplerates( sigfile::SChannel::TType::eeg);
+                ED->used_samplerates( sigfile::definitions::types::eeg);
         if ( used_eeg_samplerates.size() == 1 )
                 APPLOG_INFO ("single common EEG samplerate: %zu", used_eeg_samplerates.front());
         else {
@@ -246,7 +246,7 @@ populate_mChannels()
                 GtkTreeIter iter;
                 gtk_list_store_append( mEEGChannels, &iter);
                 gtk_list_store_set( mEEGChannels, &iter,
-                                    0, H.name(),
+                                    0, H.custom_name(),
                                     -1);
         }
 
@@ -254,7 +254,7 @@ populate_mChannels()
                 GtkTreeIter iter;
                 gtk_list_store_append( mAllChannels, &iter);
                 gtk_list_store_set( mAllChannels, &iter,
-                                    0, H.name(),
+                                    0, H.custom_name(),
                                     -1);
         }
 
@@ -649,10 +649,3 @@ operator<( const SSubjectPresentation& rv) const
 
         return result;
 }
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sf/channel.cc b/upstream/src/aghermann/ui/sf/channel.cc
index 6c07b31..e2d5f68 100644
--- a/upstream/src/aghermann/ui/sf/channel.cc
+++ b/upstream/src/aghermann/ui/sf/channel.cc
@@ -148,7 +148,7 @@ SChannel (agh::CRecording& r,
                 // don't: interchannel_gap is rubbish yet
                 psd.focused_band = metrics::TBand::delta;
 
-        } else if ( type() == sigfile::SChannel::TType::emg ) {
+        } else if ( type() == sigfile::definitions::types::emg ) {
                 get_raw_profile();
 
                 hist_range_min = 0.;
@@ -323,7 +323,7 @@ SScoringFacility::SChannel::
 which_profile( const metrics::TType metric)
 {
         switch ( type() ) {
-        case sigfile::SChannel::TType::eeg:
+        case sigfile::definitions::types::eeg:
                 switch ( metric ) {
                 case metrics::TType::mc:
                         return tuple<metrics::TType, valarray<TFloat>&>(metric, mc.course);
@@ -409,7 +409,7 @@ detect_artifacts( const agh::ad::SComprehensiveArtifactDetectionPPack& P)
 
         calculate_dirty_percent();
         get_signal_filtered();
-        if ( type() == sigfile::SChannel::TType::eeg ) {
+        if ( type() == sigfile::definitions::types::eeg ) {
                 get_psd_course();
                 get_psd_in_bands();
                 get_spectrum( _p.cur_page());
@@ -442,7 +442,7 @@ mark_region_as_artifact( const bool do_mark)
 
         get_signal_filtered();
 
-        if ( type() == sigfile::SChannel::TType::eeg ) {
+        if ( type() == sigfile::definitions::types::eeg ) {
                 get_psd_course();
                 get_psd_in_bands();
                 get_spectrum( _p.cur_page());
@@ -509,8 +509,8 @@ update_channel_menu_items( const double x)
         gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawEnvelope, draw_selection_envelope);
         gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawDzxdf,    draw_selection_dzcdf);
 
-        bool    is_eeg = (type() == sigfile::SChannel::TType::eeg),
-                is_emg = (type() == sigfile::SChannel::TType::emg),
+        bool    is_eeg = (type() == sigfile::definitions::types::eeg),
+                is_emg = (type() == sigfile::definitions::types::emg),
                 have_profile = is_eeg or is_emg;
         gtk_widget_set_visible( (GtkWidget*)_p.iSFPageProfilesSubmenuSeparator, have_profile);
         gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageProfiles,                have_profile);
@@ -549,7 +549,7 @@ update_power_menu_items()
 
         gtk_widget_set_visible(
                 (GtkWidget*)_p.iSFPowerDrawBands,
-                (type() == sigfile::SChannel::TType::eeg &&
+                (type() == sigfile::definitions::types::eeg &&
                  draw_psd));
         _p.suppress_redraw = false;
 }
@@ -611,11 +611,3 @@ _put_selection()
                 selection_SU = sssu.second[0];
         }
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sf/channel.hh b/upstream/src/aghermann/ui/sf/channel.hh
index 7ce5e38..c3cce44 100644
--- a/upstream/src/aghermann/ui/sf/channel.hh
+++ b/upstream/src/aghermann/ui/sf/channel.hh
@@ -66,8 +66,8 @@ struct SScoringFacility::SChannel {
                 { return crecording.h(); }
         const char*
         name() const
-                { return schannel.name(); }
-        sigfile::SChannel::TType
+                { return schannel.custom_name(); }
+        sigfile::definitions::types
         type() const
                 { return schannel.type(); }
         size_t n_samples() const;
@@ -378,10 +378,3 @@ samplerate() const
 } // namespace agh::ui
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc b/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc
index e6c4bf7..230313a 100644
--- a/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc
+++ b/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc
@@ -38,7 +38,7 @@ SPhasediffDialogWidgets (SScoringFacility& SF)
 
         // filter channels we don't have
         for ( auto &H : SF.channels )
-                if ( H.type() == sigfile::SChannel::TType::eeg ) {
+                if ( H.type() == sigfile::definitions::types::eeg ) {
                         GtkTreeIter iter;
                         gtk_list_store_append(
                                 mSFPDChannels,
@@ -78,12 +78,3 @@ SPhasediffDialogWidgets::
         g_object_unref( (GObject*)mSFPDChannels);
         g_object_unref( (GObject*)builder);
 }
-
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sf/ica.cc b/upstream/src/aghermann/ui/sf/ica.cc
index a88f22e..10fbc36 100644
--- a/upstream/src/aghermann/ui/sf/ica.cc
+++ b/upstream/src/aghermann/ui/sf/ica.cc
@@ -284,7 +284,7 @@ apply_remix( const bool do_backup)
                 H.signal_reconstituted = valarray<TFloat> (0);
                 H.get_signal_original();
                 H.get_signal_filtered();
-                if ( H.type() ==  sigfile::SChannel::TType::eeg ) {
+                if ( H.type() ==  sigfile::definitions::types::eeg ) {
                         H.get_psd_course();
                         H.get_psd_in_bands();
                         H.get_mc_course();
@@ -337,11 +337,3 @@ ic_of( const SChannel* ch) const
         }
         throw out_of_range ("SScoringFacility::ic_of(): bad channel");
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sf/montage-menus_cb.cc b/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
index 5ff2937..e1eda9c 100644
--- a/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
+++ b/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
@@ -294,7 +294,7 @@ iSFPageFilter_activate_cb(
                 H.filters = FD.P;
                 H.get_signal_filtered();
 
-                if ( H.type() == sigfile::SChannel::TType::eeg ) {
+                if ( H.type() == sigfile::definitions::types::eeg ) {
                         H.get_psd_course();
                         H.get_psd_in_bands();
                         H.get_spectrum( SF.cur_page());
@@ -343,7 +343,7 @@ iSFPageArtifactsClear_activate_cb(
                         SF.using_channel->artifacts().clear();
                         SF.using_channel->get_signal_filtered();
 
-                        if ( SF.using_channel->type() == sigfile::SChannel::TType::eeg ) {
+                        if ( SF.using_channel->type() == sigfile::definitions::types::eeg ) {
                                 SF.using_channel->get_psd_course();
                                 SF.using_channel->get_psd_in_bands();
                                 SF.using_channel->get_spectrum();
@@ -813,7 +813,7 @@ iSFPowerSmooth_toggled_cb(
         auto& SF = *(SScoringFacility*)userdata;
         if ( SF.suppress_redraw )
                 return;
-        if ( likely (SF.using_channel->type() == sigfile::SChannel::TType::eeg ) ) {
+        if ( likely (SF.using_channel->type() == sigfile::definitions::types::eeg ) ) {
                 SF.using_channel->resample_power = (bool)gtk_check_menu_item_get_active( menuitem);
                 SF.using_channel->get_psd_course();
                 SF.using_channel->get_psd_in_bands();
@@ -870,10 +870,3 @@ iSFPowerAutoscale_toggled_cb(
 
 
 } // extern "C"
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sf/montage-overlays.cc b/upstream/src/aghermann/ui/sf/montage-overlays.cc
index 18cfb39..6a41aaa 100644
--- a/upstream/src/aghermann/ui/sf/montage-overlays.cc
+++ b/upstream/src/aghermann/ui/sf/montage-overlays.cc
@@ -34,7 +34,7 @@ draw_overlays( cairo_t* cr,
         bool    overlay = false;
 
        // PSD profile
-        if ( draw_psd and type() == sigfile::SChannel::TType::eeg ) {
+        if ( draw_psd and type() == sigfile::definitions::types::eeg ) {
                 overlay = true;
 
                 cairo_set_line_width( cr, 1.);
@@ -181,7 +181,7 @@ draw_overlays( cairo_t* cr,
                 }
         }
 
-        if ( draw_mc and type() == sigfile::SChannel::TType::eeg ) {
+        if ( draw_mc and type() == sigfile::definitions::types::eeg ) {
                 overlay = true;
 
                 cairo_set_line_width( cr, 1.);
@@ -226,7 +226,7 @@ draw_overlays( cairo_t* cr,
 
         }
 
-        if ( draw_swu and type() == sigfile::SChannel::TType::eeg ) {
+        if ( draw_swu and type() == sigfile::definitions::types::eeg ) {
                 overlay = true;
 
                 cairo_set_line_width( cr, 1.);
@@ -299,7 +299,7 @@ draw_overlays( cairo_t* cr,
 
       // EMG profile
         if ( draw_emg and
-             type() == sigfile::SChannel::TType::emg ) {
+             type() == sigfile::definitions::types::emg ) {
                 overlay = true;
 
                 cairo_pattern_t *cp = cairo_pattern_create_linear( 0., pbot-EMGProfileHeight, 0., pbot);
@@ -394,11 +394,3 @@ _draw_hour_ticks( cairo_t *cr,
                 cairo_stroke( cr);
         }
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sf/montage.cc b/upstream/src/aghermann/ui/sf/montage.cc
index 2715336..5496fe6 100644
--- a/upstream/src/aghermann/ui/sf/montage.cc
+++ b/upstream/src/aghermann/ui/sf/montage.cc
@@ -366,7 +366,7 @@ draw_page( cairo_t *cr,
                         cairo_show_text( cr, global::buf);
 
                         // MC metrics
-                        if ( type() == sigfile::SChannel::TType::eeg &&
+                        if ( type() == sigfile::definitions::types::eeg &&
                              selection_end_time - selection_start_time > 2. ) {
 
                                 cairo_set_font_size( cr, 10);
@@ -617,7 +617,7 @@ draw_page( cairo_t *cr,
         }
 
        // EMG baseline tone
-        if ( draw_emg_steady_tone && type() == sigfile::SChannel::TType::emg ) {
+        if ( draw_emg_steady_tone && type() == sigfile::definitions::types::emg ) {
                 cairo_set_line_width( cr, 1.);
                 _p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
                 cairo_move_to( cr, 0, y0 - emg_steady_tone/2 * signal_display_scale);
@@ -867,11 +867,3 @@ draw_montage( cairo_t* cr)
                 cairo_stroke( cr);
         }
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sf/montage_cb.cc b/upstream/src/aghermann/ui/sf/montage_cb.cc
index 91fdd73..2908771 100644
--- a/upstream/src/aghermann/ui/sf/montage_cb.cc
+++ b/upstream/src/aghermann/ui/sf/montage_cb.cc
@@ -127,7 +127,7 @@ daSFMontage_button_press_event_cb(
 
         auto Ch = SF.using_channel = SF.channel_near( event->y);
 
-        if ( Ch->type() == sigfile::SChannel::TType::eeg &&
+        if ( Ch->type() == sigfile::definitions::types::eeg &&
              (Ch->draw_psd || Ch->draw_mc) && event->y > Ch->zeroy ) {
                 switch ( event->button ) {
                 case 1:
@@ -147,7 +147,7 @@ daSFMontage_button_press_event_cb(
                     break;
                 }
 
-        } else if ( Ch->type() == sigfile::SChannel::TType::emg &&
+        } else if ( Ch->type() == sigfile::definitions::types::emg &&
                     Ch->draw_emg && event->y > Ch->zeroy ) {
                 switch ( event->button ) {
                 case 1:
@@ -367,7 +367,7 @@ daSFMontage_button_release_event_cb(
                         }
                         gtk_widget_queue_draw( wid);
 
-                } else if ( Ch->type() == sigfile::SChannel::TType::eeg &&
+                } else if ( Ch->type() == sigfile::definitions::types::eeg &&
                             (Ch->draw_psd || Ch->draw_mc) && event->y > Ch->zeroy )
                         SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
 
@@ -490,13 +490,13 @@ daSFMontage_scroll_event_cb(
                         }
                         if ( event->state & GDK_CONTROL_MASK )
                                 for ( auto& H : SF.channels ) {
-                                        if ( Ch->type() == sigfile::SChannel::TType::eeg &&
-                                             H.type() == sigfile::SChannel::TType::eeg ) {
+                                        if ( Ch->type() == sigfile::definitions::types::eeg &&
+                                             H.type() == sigfile::definitions::types::eeg ) {
                                                 H.psd.display_scale = Ch->psd.display_scale;
                                                 H.mc.display_scale  = Ch->mc.display_scale;
                                                 H.swu.display_scale = Ch->swu.display_scale;
-                                        } else if ( Ch->type() == sigfile::SChannel::TType::emg &&
-                                             H.type() == sigfile::SChannel::TType::emg )
+                                        } else if ( Ch->type() == sigfile::definitions::types::emg &&
+                                             H.type() == sigfile::definitions::types::emg )
                                                 H.signal_display_scale = Ch->signal_display_scale;
                                 }
                         gtk_widget_queue_draw( wid);
@@ -526,10 +526,3 @@ daSFMontage_scroll_event_cb(
 
 
 } // extern "C"
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sf/sf.cc b/upstream/src/aghermann/ui/sf/sf.cc
index 6a27404..87083a6 100644
--- a/upstream/src/aghermann/ui/sf/sf.cc
+++ b/upstream/src/aghermann/ui/sf/sf.cc
@@ -112,30 +112,30 @@ SScoringFacility (agh::CSubject& J,
                 size_t  y = interchannel_gap / 2.;
                 int     seq = 1;
                 for ( auto &H : _sepisode.recordings )
-                        if ( H.second.signal_type() == sigfile::SChannel::TType::eeg ) {
-                                _p.sb_message( snprintf_buf( "Reading and processing EEG channel %s ...", H.first.c_str()));
+                        if ( H.second.signal_type() == sigfile::definitions::types::eeg ) {
+                                _p.sb_message( snprintf_buf( "Reading and processing EEG channel %s ...", H.first.custom_name()));
                                 channels.emplace_back( H.second, *this, y, seq++);
                                 y += interchannel_gap;
                         }
                 for ( auto &H : _sepisode.recordings )
-                        if ( H.second.signal_type() == sigfile::SChannel::TType::eog ) {
-                                _p.sb_message( snprintf_buf( "Reading and processing EOG channel %s ...", H.first.c_str()));
+                        if ( H.second.signal_type() == sigfile::definitions::types::eog ) {
+                                _p.sb_message( snprintf_buf( "Reading and processing EOG channel %s ...", H.first.custom_name()));
                                 channels.emplace_back( H.second, *this, y, seq++);
                                 y += interchannel_gap;
                         }
                 for ( auto &H : _sepisode.recordings )
-                        if ( H.second.signal_type() == sigfile::SChannel::TType::emg ) {
-                                _p.sb_message( snprintf_buf( "Reading and processing EMG channel %s ...", H.first.c_str()));
+                        if ( H.second.signal_type() == sigfile::definitions::types::emg ) {
+                                _p.sb_message( snprintf_buf( "Reading and processing EMG channel %s ...", H.first.custom_name()));
                                 channels.emplace_back( H.second, *this, y, seq++);
                                 y += interchannel_gap;
                         }
                 for ( auto &H : _sepisode.recordings ) {
                         auto type = H.second.signal_type();
-                        if ( type != sigfile::SChannel::TType::eeg &&
-                             type != sigfile::SChannel::TType::eog &&
-                             type != sigfile::SChannel::TType::emg &&
-                             type != sigfile::SChannel::TType::embedded_annotation ) {
-                                _p.sb_message( snprintf_buf( "Reading and processing channel %s ...", H.first.c_str()));
+                        if ( type != sigfile::definitions::types::eeg &&
+                             type != sigfile::definitions::types::eog &&
+                             type != sigfile::definitions::types::emg &&
+                             type != sigfile::definitions::types::edf_annotation ) {
+                                _p.sb_message( snprintf_buf( "Reading and processing channel %s ...", H.first.custom_name()));
                                 channels.emplace_back( H.second, *this, y, seq++);
                                 y += interchannel_gap;
                         }
@@ -162,7 +162,7 @@ SScoringFacility (agh::CSubject& J,
         n_eeg_channels =
                 count_if( channels.begin(), channels.end(),
                           [] (const SChannel& h)
-                          { return h.type() == sigfile::SChannel::TType::eeg; });
+                          { return h.type() == sigfile::definitions::types::eeg; });
 
       // load montage, recalibrate display scales as necessary
         load_montage();
@@ -184,7 +184,7 @@ SScoringFacility (agh::CSubject& J,
                                         interchannel_gap / 2);
                 agh::alg::ensure_within( h.signal_display_scale, scale_min, scale_max);
 
-                if ( h.type() == sigfile::SChannel::TType::eeg ) {
+                if ( h.type() == sigfile::definitions::types::eeg ) {
                       // calibrate profile display scales
                         if ( not sane_scale(h.psd.display_scale) )
                                 h.psd.display_scale =
@@ -530,7 +530,7 @@ set_cur_vpage( size_t p, const bool touch_self)
         if ( ap2p(p) != _cur_page ) { // vpage changed but page is same
                 _cur_page = ap2p(p);
                 for ( auto& H : channels )
-                        if ( H.type() == sigfile::SChannel::TType::eeg && H.draw_spectrum )
+                        if ( H.type() == sigfile::definitions::types::eeg && H.draw_spectrum )
                                 H.get_spectrum( _cur_page);
 
                 gtk_widget_set_sensitive( (GtkWidget*)bSFForward, _cur_vpage < total_vpages()-1);
@@ -756,9 +756,9 @@ load_montage()
                 h.selection_end = h.selection_end_time * h.samplerate();
 
               // make sure these won't cause any confusion later
-                if ( h.type() == sigfile::SChannel::TType::eeg )
+                if ( h.type() == sigfile::definitions::types::eeg )
                         h.draw_emg = false;
-                if ( h.type() == sigfile::SChannel::TType::emg )
+                if ( h.type() == sigfile::definitions::types::emg )
                         h.draw_psd = h.draw_swu = h.draw_mc = false;
         }
 
@@ -889,12 +889,3 @@ update_main_menu_items()
 
         suppress_redraw = false;
 }
-
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/aghermann/ui/sm/sm.cc b/upstream/src/aghermann/ui/sm/sm.cc
index fd1f816..60e918a 100644
--- a/upstream/src/aghermann/ui/sm/sm.cc
+++ b/upstream/src/aghermann/ui/sm/sm.cc
@@ -359,10 +359,3 @@ _sync_model_to_list()
                 some_items_left = gtk_tree_model_iter_next( (GtkTreeModel*)mSessionChooserList, &iter);
         }
 }
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/common/log-facility.hh b/upstream/src/common/log-facility.hh
index 91142a3..08610d3 100644
--- a/upstream/src/common/log-facility.hh
+++ b/upstream/src/common/log-facility.hh
@@ -74,10 +74,3 @@ struct SLoggingClient {
 }}  // namespace agh::log
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/common/subject_id.cc b/upstream/src/common/subject_id.cc
index 92d233d..e6ffa90 100644
--- a/upstream/src/common/subject_id.cc
+++ b/upstream/src/common/subject_id.cc
@@ -180,12 +180,3 @@ update_from( const SSubjectId& j)
 
         return mismatched_fields;
 }
-
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libmetrics/mc.cc b/upstream/src/libmetrics/mc.cc
index 05c4351..51b33de 100644
--- a/upstream/src/libmetrics/mc.cc
+++ b/upstream/src/libmetrics/mc.cc
@@ -64,7 +64,7 @@ fname_base() const
                 agh::str::sasprintf(
                         "%s.%s-%lu"
                         ":%g+%g-%g_%g" "_%g" "_%g_%g",
-                        _using_F().filename(), _using_F().channel_by_id(_using_sig_no).name(),
+                        _using_F().filename(), _using_F().channel_by_id(_using_sig_no).custom_name(),
                         _using_F().dirty_signature( _using_sig_no),
                         pagesize, step,
                         scope, iir_backpolate,
@@ -82,7 +82,7 @@ mirror_fname() const
                         ":%g+%g-%g_%g" "_%g" "_%g_%g" "_%g_%g@%zu"
                         ".mc",
                         agh::fs::make_fname_base (_using_F().filename(), "", agh::fs::TMakeFnameOption::hidden).c_str(),
-                        _using_F().channel_by_id(_using_sig_no).name(),
+                        _using_F().channel_by_id(_using_sig_no).custom_name(),
                         _using_F().dirty_signature( _using_sig_no),
                         pagesize, step,
                         scope, iir_backpolate,
@@ -144,7 +144,7 @@ export_tsv( const string& fname) const
                  "#Page\t",
                  _using_F().subject().name.c_str(), _using_F().session(), _using_F().episode(),
                  (int)strlen(asctime_)-1, asctime_,
-                 _using_F().channel_by_id(_using_sig_no).name(),
+                 _using_F().channel_by_id(_using_sig_no).custom_name(),
                  steps(), pagesize, step, freq_from, freq_from + bandwidth * bins(), bandwidth);
 
         for ( bin = 0; bin < _bins; ++bin, bum += bandwidth )
@@ -178,7 +178,7 @@ export_tsv( size_t bin,
                  "## Course (%zu %g-sec pages, step %g sec) in range %g-%g Hz\n",
                  _using_F().subject().name.c_str(), _using_F().session(), _using_F().episode(),
                  (int)strlen(asctime_)-1, asctime_,
-                 _using_F().channel_by_id(_using_sig_no).name(),
+                 _using_F().channel_by_id(_using_sig_no).custom_name(),
                  steps(), pagesize, step, freq_from, freq_from + (bin+1) * bandwidth);
 
         for ( size_t p = 0; p < steps(); ++p )
@@ -198,11 +198,3 @@ do_sssu_reduction( const valarray<TFloat>&,
                    double, double, double);
 
 const size_t sssu_hist_size = 100;
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libmetrics/page-metrics-base.cc b/upstream/src/libmetrics/page-metrics-base.cc
index 4c3b966..1d2d07c 100644
--- a/upstream/src/libmetrics/page-metrics-base.cc
+++ b/upstream/src/libmetrics/page-metrics-base.cc
@@ -250,7 +250,7 @@ export_tsv( const string& fname) const
                  "#Page\t",
                  _using_F().subject().name.c_str(), _using_F().session(), _using_F().episode(),
                  (int)strlen(asctime_)-1, asctime_,
-                 _using_F().channel_by_id(_using_sig_no).name());
+                 _using_F().channel_by_id(_using_sig_no).custom_name());
 
         for ( bin = 0; bin < _bins; ++bin )
                 fprintf( f, "%zu%c", bin, bin+1 == _bins ? '\n' : '\t');
@@ -265,12 +265,3 @@ export_tsv( const string& fname) const
         fclose( f);
         return 0;
 }
-
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libmetrics/psd.cc b/upstream/src/libmetrics/psd.cc
index 3445085..f8f13d1 100644
--- a/upstream/src/libmetrics/psd.cc
+++ b/upstream/src/libmetrics/psd.cc
@@ -86,7 +86,7 @@ fname_base() const
                 agh::str::sasprintf(
                         "%s.%s-%lu"
                         ":%g+%g-%g-%c%c",
-                        _using_F().filename(), _using_F().channel_by_id(_using_sig_no).name(),
+                        _using_F().filename(), _using_F().channel_by_id(_using_sig_no).custom_name(),
                         _using_F().dirty_signature( _using_sig_no),
                         pagesize, step, binsize,
                         'a'+(char)welch_window_type, 'a'+(char)plan_type)
@@ -105,7 +105,7 @@ mirror_fname() const
                         ":%g+%g-%g-%c%c@%zu"
                         ".psd",
                         agh::fs::make_fname_base (_using_F().filename(), "", agh::fs::TMakeFnameOption::hidden).c_str(),
-                        _using_F().channel_by_id(_using_sig_no).name(),
+                        _using_F().channel_by_id(_using_sig_no).custom_name(),
                         _using_F().dirty_signature( _using_sig_no),
                         pagesize, step, binsize,
                         'a'+(char)welch_window_type, 'a'+(char)plan_type,
@@ -253,7 +253,7 @@ export_tsv( const string& fname) const
                  "#Page\t",
                  _using_F().subject().name.c_str(), _using_F().session(), _using_F().episode(),
                  (int)strlen(asctime_)-1, asctime_,
-                 _using_F().channel_by_id(_using_sig_no).name(),
+                 _using_F().channel_by_id(_using_sig_no).custom_name(),
                  steps(), pagesize, step, _bins*binsize, binsize);
 
         for ( bin = 0; bin < _bins; ++bin, bum += binsize )
@@ -289,7 +289,7 @@ export_tsv( float from, float upto,
                  "## Course (%zu %g-sec pages, step %g) in range %g-%g Hz\n",
                  _using_F().subject().name.c_str(), _using_F().session(), _using_F().episode(),
                  (int)strlen(asctime_)-1, asctime_,
-                 _using_F().channel_by_id(_using_sig_no).name(),
+                 _using_F().channel_by_id(_using_sig_no).custom_name(),
                  steps(), pagesize, step, from, upto);
 
         valarray<TFloat> crs = course( from, upto);
@@ -299,12 +299,3 @@ export_tsv( float from, float upto,
         fclose( f);
         return 0;
 }
-
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libmetrics/swu.cc b/upstream/src/libmetrics/swu.cc
index f9d23e9..82f3791 100644
--- a/upstream/src/libmetrics/swu.cc
+++ b/upstream/src/libmetrics/swu.cc
@@ -54,7 +54,7 @@ fname_base() const
                 agh::str::sasprintf(
                         "%s.%s-%lu"
                         ":%g+%g-%g",
-                        _using_F().filename(), _using_F().channel_by_id(_using_sig_no).name(),
+                        _using_F().filename(), _using_F().channel_by_id(_using_sig_no).custom_name(),
                         _using_F().dirty_signature( _using_sig_no),
                         pagesize, step, min_upswing_duration));
 }
@@ -70,7 +70,7 @@ mirror_fname() const
                         ":%g+%g-%g@%zu"
                         ".swu",
                         agh::fs::make_fname_base (_using_F().filename(), "", agh::fs::TMakeFnameOption::hidden).c_str(),
-                        _using_F().channel_by_id(_using_sig_no).name(),
+                        _using_F().channel_by_id(_using_sig_no).custom_name(),
                         _using_F().dirty_signature( _using_sig_no),
                         pagesize, step, min_upswing_duration,
                         sizeof(TFloat)));
@@ -109,7 +109,7 @@ go_compute()
                                 Q += q;
                 }
               // 2. clean peaks
-                
+                // TODO
 
                 nmth_bin(p, 0) =
                         Q / pagesize;
@@ -142,7 +142,7 @@ export_tsv( const string& fname) const
                  "#Page\tSWU\n",
                  _using_F().subject().name.c_str(), _using_F().session(), _using_F().episode(),
                  (int)strlen(asctime_)-1, asctime_,
-                 _using_F().channel_by_id(_using_sig_no).name(),
+                 _using_F().channel_by_id(_using_sig_no).custom_name(),
                  steps(), pagesize, step);
 
         for ( size_t p = 0; p < steps(); ++p )
@@ -151,13 +151,3 @@ export_tsv( const string& fname) const
         fclose( f);
         return 0;
 }
-
-
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libsigfile/channel.cc b/upstream/src/libsigfile/channel.cc
index 494dd0e..8f25494 100644
--- a/upstream/src/libsigfile/channel.cc
+++ b/upstream/src/libsigfile/channel.cc
@@ -17,132 +17,124 @@
 #include "channel.hh"
 
 using namespace std;
-using sigfile::SChannel;
-
-const char* sigfile::edf_annotations_label =
-        "EDF Annotations";
 
+using namespace sigfile;
+using sigfile::SChannel;
 
 namespace {
+using definitions::types;
+
+const map<types, const char*> TYPES = {
+	{types::edf_annotation, "EDF Annotations"},
+        {types::eeg,     "EEG"},
+        {types::eog,     "EOG"},
+        {types::emg,     "EMG"},
+        {types::ecg,     "ECG"},
+        {types::erg,     "ERG"},
+        {types::nc,      "NC" },
+        {types::meg,     "MEG"},
+        {types::mcg,     "MCG"},
+        {types::ep,      "EP" },
+        {types::temp,    "Temp"},
+        {types::resp,    "Resp"},
+        {types::sao2,    "SaO2"},
+        {types::light,   "Light"},
+        {types::sound,   "Sound"},
+        {types::event,   "Event"},
+        {types::freq,    "Freq"},
+        {types::invalid, "(invalid type)"},
+};
 
-const map<SChannel::TType, vector<const char*>> _CT_ = {
-        {SChannel::TType::eeg,
-         {"(custom)",          // counted 'em all!
-          "Nz",
-          "Fp1", "Fpz", "Fp2",
-          "AF7", "AF3", "AFz", "AF4", "AF8",
-          "F9",  "F7", "F5", "F3", "F1", "Fz", "F2", "F4", "F6", "F8", "F10",
-          "FT9", "FT7", "FC5", "FC3", "FC1", "FCz", "FC2", "FC4", "FC6", "FCT8", "FT10",
-          "A1", "T9", "T7", "C5", "C3", "C1", "Cz", "C2", "C4", "C6", "T8", "T10", "A2",
-          "TP9", "TP7", "CP5", "CP3", "CP1", "CPz", "CP2", "CP4", "CP6", "TP8", "TP10",
-          "P9", "P7", "P5", "P3", "P1", "Pz", "P2", "P4", "P6", "P8", "P10",
-          "PO7", "PO3", "POz", "PO4", "PO8",
-          "O1", "Oz", "O2",
-          "Iz",}
-        },
-        {SChannel::TType::eog,
-         {"(invalid)",
-          "Left", "Right",}
-        },
-        {SChannel::TType::emg,
-         {"(invalid)",
-          "Chin",}
-        },
+#define Q(A, B) {make_tuple(A, types::B)}
+const vector<definitions::TNameWithType> NAMES = {
+        Q("Nz",  eeg),
+        Q("Fp1", eeg), Q("Fpz", eeg), Q("Fp2", eeg),
+        Q("AF7", eeg), Q("AF3", eeg), Q("AFz", eeg), Q("AF4", eeg), Q("AF8", eeg),
+        Q("F9",  eeg), Q("F7",  eeg), Q("F5",  eeg), Q("F3",  eeg), Q("F1",  eeg), Q("Fz",  eeg), Q("F2",  eeg), Q("F4",  eeg), Q("F6",  eeg), Q("F8",   eeg), Q("F10",  eeg),
+        Q("FT9", eeg), Q("FT7", eeg), Q("FC5", eeg), Q("FC3", eeg), Q("FC1", eeg), Q("FCz", eeg), Q("FC2", eeg), Q("FC4", eeg), Q("FC6", eeg), Q("FCT8", eeg), Q("FT10", eeg),
+        Q("A1",  eeg), Q("T9",  eeg), Q("T7",  eeg), Q("C5",  eeg), Q("C3",  eeg), Q("C1",  eeg), Q("Cz",  eeg), Q("C2",  eeg), Q("C4",  eeg), Q("C6",   eeg), Q("T8",   eeg), Q("T10", eeg), Q("A2", eeg),
+        Q("TP9", eeg), Q("TP7", eeg), Q("CP5", eeg), Q("CP3", eeg), Q("CP1", eeg), Q("CPz", eeg), Q("CP2", eeg), Q("CP4", eeg), Q("CP6", eeg), Q("TP8",  eeg), Q("TP10", eeg),
+        Q("P9",  eeg), Q("P7",  eeg), Q("P5",  eeg), Q("P3",  eeg), Q("P1",  eeg), Q("Pz",  eeg), Q("P2",  eeg), Q("P4",  eeg), Q("P6",  eeg), Q("P8",   eeg), Q("P10",  eeg),
+        Q("PO7", eeg), Q("PO3", eeg), Q("POz", eeg), Q("PO4", eeg), Q("PO8", eeg),
+        Q("O1",  eeg), Q("Oz",  eeg), Q("O2",  eeg),
+        Q("Iz",  eeg),
+
+        Q("Left", eog), Q("Right", eog),
+
+        Q("Chin", emg),
 };
 
-} // anonymous namespace
+const sigfile::definitions::TNameWithType invalid_name = Q("(invalid name)", invalid);
+#undef Q
+
+} // namespace anonymous
 
 
 const char*
-SChannel::
-type_s( SChannel::TType t)
+SChannel::type_s(definitions::types t)
 {
-        switch (t) {
-	case SChannel::TType::embedded_annotation: return sigfile::edf_annotations_label;
-        case SChannel::TType::eeg:   return "EEG";
-        case SChannel::TType::eog:   return "EOG";
-        case SChannel::TType::emg:   return "EMG";
-        case SChannel::TType::ecg:   return "ECG";
-        case SChannel::TType::erg:   return "ERG";
-        case SChannel::TType::nc:    return "NC" ;
-        case SChannel::TType::meg:   return "MEG";
-        case SChannel::TType::mcg:   return "MCG";
-        case SChannel::TType::ep:    return "EP" ;
-        case SChannel::TType::temp:  return "Temp";
-        case SChannel::TType::resp:  return "Resp";
-        case SChannel::TType::sao2:  return "SaO2";
-        case SChannel::TType::light: return "Light";
-        case SChannel::TType::sound: return "Sound";
-        case SChannel::TType::event: return "Event";
-        case SChannel::TType::freq:  return "Freq";
-        case SChannel::TType::other: return "(other)";
-        default:                     return "invalid";
-	}
+        return TYPES.at(t);
 }
 
 
-template <SChannel::TType t>
-const char*
-SChannel::
-channel_s( int idx)
-{
-        return _CT_.at(t)[idx];
-}
 
-namespace sigfile {
-template <>
-const char*
+const definitions::TNameWithType&
 SChannel::
-channel_s<SChannel::TType::invalid>(int)
+classify_channel( const string& x)
 {
-        return "(invalid)";
-}
+        auto tI = find_if(NAMES.begin(), NAMES.end(),
+                          [&x](const definitions::TNameWithType& y)
+                          {
+                                  auto& canonical = get<0>(y);
+                                  return 0 == strncasecmp(x.c_str(), canonical, strlen(canonical));
+                          });
+        return ( tI == NAMES.end() ) ? invalid_name : *tI;
 }
 
-template const char* SChannel::channel_s<SChannel::TType::eeg>( int);
-template const char* SChannel::channel_s<SChannel::TType::eog>( int);
-template const char* SChannel::channel_s<SChannel::TType::emg>( int);
-template const char* SChannel::channel_s<SChannel::TType::ecg>( int);
-template const char* SChannel::channel_s<SChannel::TType::erg>( int);
-
 
 
-tuple<SChannel::TType, int>
+tuple<definitions::types, const char* const, string>
 SChannel::
 figure_type_and_name( const string& h_)
 {
-        auto tt = agh::str::tokens( h_, "-");
-        if ( tt.size() == 2 ) {
-                for ( auto& T : _CT_ )
-                        if ( all_of( tt.begin(), tt.end(),
-                                     [&]( const string& t)
-                                     {
-                                             return any_of( T.second.begin(), T.second.end(),
-                                                            [&]( const string& h)
-                                                            {
-                                                                    return 0 == strcasecmp( h.c_str(), t.c_str());
-                                                            });
-                                     }) )
-                                return make_tuple(T.first, 0); // always custom, because it's a compound (EEG) channel like Fpz-Oz
-                return make_tuple(TType::other, 0);
-
-        } else if ( tt.size() == 1 ) {
-                for ( auto& T : _CT_ )
-                        for ( size_t i = 0; i < T.second.size(); ++i )
-                                if ( strcasecmp( T.second[i], h_.c_str()) == 0 ) {
-                                        return make_tuple(T.first, (int)i);
-                                }
-        }
-
-        return make_tuple(TType::other, 0);
+        const auto TT = agh::str::tokens( h_, " ");
+        auto& T0 = *TT.begin();
+        const char* canonical_name;
+        definitions::types derived_type;
+
+        if ( TT.size() > 2 )
+                ; // APPLOG_WARN ("Discarding all but the first two tokens to define channel type and name: %s", h_.c_str());
+
+        if ( TT.size() >= 2 ) {
+                auto& T1 = *next(TT.begin());
+                tie(canonical_name, derived_type) = classify_channel(T1);
+                if ( derived_type == definitions::types::invalid ) {
+                        // APPLOG_ERROR ("Unknown signal type \"%s\"", TT[0].c_str());
+                        // no central log facility for edfhed
+                        return make_tuple(derived_type, get<0>(invalid_name), T1);
+                }
+                // the referenced channel name only need to match the
+                // supplied name at the beginning, ignoring case;
+                // whatever it is, is returned verbatim (to be stored
+                // in _custom_name field)
+                auto derived_type_s = type_s(derived_type);
+                if ( 0 != strncasecmp(T0.c_str(), derived_type_s, strlen(derived_type_s)) ) {
+                        // APPLOG_ERROR ("Indicated signal type \"%s\" does not match inferred type of channel \"%s\"", TT[1].c_str(), _SignalTypes.at(t));
+                        return make_tuple(derived_type, canonical_name, T1);
+                }
+                return make_tuple(derived_type, canonical_name, T1);
+
+        } else if ( TT.size() == 1 ) {
+                tie(canonical_name, derived_type) = classify_channel(T0);
+                return make_tuple(derived_type, canonical_name, T0);
+        } else
+                return make_tuple(definitions::types::invalid, get<0>(invalid_name), "");
 }
 
-
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
+bool
+SChannel::
+operator<( const SChannel& rv) const
+{
+        return  find(NAMES.begin(), NAMES.end(), make_tuple(   _canonical_name,    _type)) <
+                find(NAMES.begin(), NAMES.end(), make_tuple(rv._canonical_name, rv._type));
+}
diff --git a/upstream/src/libsigfile/channel.hh b/upstream/src/libsigfile/channel.hh
index 19db946..2188991 100644
--- a/upstream/src/libsigfile/channel.hh
+++ b/upstream/src/libsigfile/channel.hh
@@ -26,169 +26,86 @@ using namespace std;
 
 namespace sigfile {
 
-
 // we want scoped enums with basic arith support, so:
-namespace EEG {
-enum E {
-        invalid = -1,
-        custom = 0,
-        first,
-
-        Nz = first,
-        Fp1, Fpz, Fp2,
-        AF7, AF3, AFz, AF4, AF8,
-        F9,  F7, F5, F3, F1, Fz, F2, F4, F6, F8, F10,
-        FT9, FT7, FC5, FC3, FC1, FCz, FC2, FC4, FC6, FCT8, FT10,
-        A1, T9, T7, C5, C3, C1, Cz, C2, C4, C6, T8, T10, A2,
-        TP9, TP7, CP5, CP3, CP1, CPz, CP2, CP4, CP6, TP8, TP10,
-        P9, P7, P5, P3, P1, Pz, P2, P4, P6, P8, P10,
-        PO7, PO3, POz, PO4, PO8,
-        O1, Oz, O2,
-        Iz,
-
-        last = Iz,
-        total
-};
-}
-
-namespace EOG {
-enum E {
-        invalid = -1,
-        custom = 0,
-        first,
-        left = first, right,
-        last = right,
-        total
-};
-}
-
-namespace EMG {
-enum E {
-        invalid = -1,
-        custom = 0,
-        first,
-        chin = first,
-        last = chin,
-        total
-};
-}
-
-namespace ECG {
-enum E {
-        invalid = -1,
-        custom = 0,
-        total
+namespace definitions {
+enum class types {
+        invalid,
+        edf_annotation,
+        eeg, eog, emg, ecg, erg,
+        nc, meg, mcg, ep, temp, resp, sao2, light, sound, event, freq,
 };
-}
 
-namespace ERG {
-enum E {
-        invalid = -1,
-        custom = 0,
-        total
-};
-}
-// moar types ...
+using TNameWithType = tuple<const char* const, types>;
 
-
-extern const char* edf_annotations_label;
+} // namespace SignalTypes
 
 
 struct SChannel {
 
-        enum class TType {
-                invalid,
-                embedded_annotation,
-                eeg, eog, emg, ecg, erg,
-                nc, meg, mcg, ep, temp, resp, sao2, light, sound, event, freq,
-                other
-        };
-
-        static const char* type_s( TType t);
+        static const char*
+        type_s(definitions::types);
 
-        template <TType T>
-        static const char* channel_s( int);
+        static const definitions::TNameWithType&
+        classify_channel( const string&);
 
-        static tuple<TType, int> figure_type_and_name( const string&);
+        static tuple<definitions::types, const char* const, string>
+        figure_type_and_name( const string&);
 
-        static bool is_fftable( TType type)
-                { return type == TType::eeg; }
+        static bool is_fftable( definitions::types t)
+        { return t == definitions::types::eeg; }
 
       // ctor
         SChannel (const string& h)
-                {
-                        tie(_type, _idx) = figure_type_and_name(h);
-                        if ( _idx == 0 )
-                                _custom_name = h;
-                }
-
-        SChannel (TType type_, int idx_)
-              : _type (type_),
-                _idx (idx_)
-                {}
-        SChannel (TType type_, const string& custom_name_)
-              : _type (type_),
-                _idx (0),
-                _custom_name (custom_name_)
-                {}
+        {
+                tie (_type, _canonical_name, _custom_name) = figure_type_and_name(h);
+        }
+        SChannel (const SChannel& rv) :
+                _type (rv._type),
+                _canonical_name (rv._canonical_name),
+                _custom_name (rv._custom_name)
+        {}
         SChannel () = default;
 
-        TType
+        definitions::types
         type() const
-                { return _type; }
+        { return _type; }
+
         const char*
         type_s() const
-                { return type_s(_type); }
+        { return type_s(_type); }
 
         const char*
-        name() const
-                {
-                        if ( _custom_name.empty() )
-                                switch ( _type ) {
-                                case TType::eeg: return channel_s<TType::eeg>( _idx);
-                                case TType::eog: return channel_s<TType::eog>( _idx);
-                                case TType::emg: return channel_s<TType::emg>( _idx);
-                                case TType::ecg: return channel_s<TType::ecg>( _idx);
-                                case TType::erg: return channel_s<TType::erg>( _idx);
-                                default: return "(unknown)";
-                                }
-                        else
-                                return _custom_name.c_str();
-                }
+        canonical_name() const
+        { return _canonical_name; }
+
         const char*
-        c_str() const
-                { return name(); }
-        int
-        idx() const
-                { return _idx; }
+        custom_name() const
+        { return _custom_name.c_str(); }
 
         bool
         is_fftable() const
-                { return is_fftable( _type); }
+        { return is_fftable( _type); }
+
     private:
-        TType   _type;
-        int     _idx;
-        string  _custom_name;
+        definitions::types
+                _type;
+        const char*
+                _canonical_name;  // points to one in NAMES
+        string  _custom_name;     // as given
 
     public:
         // compares by channel actual locations, antero-posteriorly
-        bool operator<( const SChannel& rv) const
-                {
-                        if ( _type == rv._type ) {
-                                if ( _idx > 0 && rv._idx > 0 )
-                                        return _idx < rv._idx;
-                                else if ( _idx > 0 )
-                                        return true;
-                                else
-                                        return _custom_name < rv._custom_name;
-                        } else
-                                return _type < rv._type;
-                }
+        bool operator<( const SChannel& rv) const;
 
         bool operator==( const SChannel& rv) const
-                { return _type == rv._type && _idx == rv._idx; }
-        bool operator==( const char* rv) const
-                { return 0 == strcasecmp( name(), rv); }
+        {
+                return  _canonical_name == rv._canonical_name &&  // yes we are comparing pointers
+                        _custom_name == rv._custom_name;
+        }
+        bool fuzzy_equal( const string& rv) const
+        {
+                return *this == SChannel (rv);
+        }
 };
 
 template <typename C>
@@ -200,8 +117,8 @@ join_channel_names( const C& l, const char* sep)
         ostringstream recv;
         auto I = l.begin();
         for ( ; next(I) != l.end(); ++I )
-                recv << I->name() << sep;
-        recv << I->name();
+                recv << I->custom_name() << sep;
+        recv << I->custom_name();
         return recv.str();
 }
 
@@ -209,10 +126,3 @@ join_channel_names( const C& l, const char* sep)
 } // namespace sigfile
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libsigfile/edf-io.cc b/upstream/src/libsigfile/edf-io.cc
index 1f2cf40..6fcc80a 100644
--- a/upstream/src/libsigfile/edf-io.cc
+++ b/upstream/src/libsigfile/edf-io.cc
@@ -27,7 +27,7 @@ get_region_original_smpl( const int h,
         if ( unlikely (sa >= sz || sz > samplerate(h) * recording_time()) )
                 throw range_error (agh::str::sasprintf(
                                            "CEDFFile::get_region_original(%s[%s]): bad region (req %zu:%zu, avail end %zu x %g sec = %g, or %zu x %zu = %zu)",
-                                           filename(), operator[](h).ucd.name(),
+                                           filename(), operator[](h).ucd.custom_name(),
                                            sa, sz, samplerate(h), recording_time(), samplerate(h) * recording_time(),
                                            n_data_records, operator[](h).samples_per_record, n_data_records * operator[](h).samples_per_record));
 
@@ -111,12 +111,3 @@ put_region_smpl( const int h,
 
         return 0;
 }
-
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libsigfile/edf.cc b/upstream/src/libsigfile/edf.cc
index 7b85209..48f3a57 100644
--- a/upstream/src/libsigfile/edf.cc
+++ b/upstream/src/libsigfile/edf.cc
@@ -246,7 +246,7 @@ CEDFFile (const string& fname_, const TSubtype subtype_, const int flags_,
 
                 H.ucd = h.first;
                 strncpy( H.header.label,
-                         pad( H.ucd.name(), 16).c_str(), 16);
+                         pad( H.ucd.custom_name(), 16).c_str(), 16);
 
                 strncpy( H.header.transducer_type,
                          pad( H.transducer_type = "no transducer info", 80).c_str(), 80);
@@ -525,28 +525,8 @@ _parse_header()
                       // determine & validate signal types
                         for ( auto &H : channels ) {
                                 _get_next_field( H.header.label, 16);
-                                string isolated_label = trim( string (H.header.label, 16));
-
-                                if ( isolated_label == sigfile::edf_annotations_label )
-                                        H.ucd = {sigfile::SChannel::TType::embedded_annotation, 0};
-                                else {
-                                        auto tt = agh::str::tokens( isolated_label, " ");
-                                        // parse legacy pre 0.9 specs ("EEG F3" etc)
-                                        if ( tt.size() > 1 ) {
-                                                string suggested_type = tt.front();
-                                                H.ucd = {(tt.pop_front(), agh::str::join( tt, " "))};
-                                                if ( suggested_type != H.ucd.type_s() )
-                                                        _status |= conflicting_channel_type;
-                                        } else {
-                                                H.ucd = sigfile::SChannel (isolated_label);
-
-                                                if ( H.ucd.type() == sigfile::SChannel::TType::eeg &&
-                                                     H.ucd.idx()  == sigfile::EEG::custom )
-                                                        _status |= non1020_channel;
-                                                if ( H.ucd.type() == SChannel::SChannel::TType::other )
-                                                        _status |= nonkemp_signaltype;
-                                        }
-                                }
+                                // let libsigfile::SChannel ctor figure
+                                H.ucd = {trim( string (H.header.label, 16))};
                         }
                         for ( auto &H : channels )
                                 H.transducer_type =
@@ -558,7 +538,7 @@ _parse_header()
 
                         for ( auto &H : channels ) {
                                 _get_next_field( H.header.physical_min, 8);
-                                if ( H.ucd.type() == sigfile::SChannel::TType::embedded_annotation )
+                                if ( H.ucd.type() == sigfile::definitions::types::edf_annotation )
                                         continue;
                                 if ( sscanf( H.header.physical_min, "%8lg",
                                              &H.physical_min) != 1 ) {
@@ -569,7 +549,7 @@ _parse_header()
                         }
                         for ( auto &H : channels ) {
                                 _get_next_field( H.header.physical_max, 8);
-                                if ( H.ucd.type() == sigfile::SChannel::TType::embedded_annotation )
+                                if ( H.ucd.type() == sigfile::definitions::types::edf_annotation )
                                         continue;
                                 if ( sscanf( H.header.physical_max, "%8lg",
                                              &H.physical_max) != 1 ) {
@@ -581,7 +561,7 @@ _parse_header()
 
                         for ( auto &H : channels ) {
                                 _get_next_field( H.header.digital_min, 8);
-                                if ( H.ucd.type() == sigfile::SChannel::TType::embedded_annotation )
+                                if ( H.ucd.type() == sigfile::definitions::types::edf_annotation )
                                         continue;
                                 if ( sscanf( H.header.digital_min, "%8d",
                                              &H.digital_min) != 1 ) {
@@ -592,7 +572,7 @@ _parse_header()
                         }
                         for ( auto &H : channels ) {
                                 _get_next_field( H.header.digital_max, 8);
-                                if ( H.ucd.type() == sigfile::SChannel::TType::embedded_annotation )
+                                if ( H.ucd.type() == sigfile::definitions::types::edf_annotation )
                                         continue;
                                 if ( sscanf( H.header.digital_max, "%8d",
                                              &H.digital_max) != 1 ) {
@@ -632,7 +612,7 @@ _parse_header()
 
       // calculate gain
         for ( auto &H : channels )
-                if ( H.ucd.type() != sigfile::SChannel::TType::embedded_annotation ) {
+                if ( H.ucd.type() != sigfile::definitions::types::edf_annotation ) {
                         if ( H.physical_max <= H.physical_min ||
                              H.digital_max  <= H.digital_min  )
                                 _status |= nogain;
@@ -673,7 +653,8 @@ int
 CEDFFile::
 _extract_embedded_annotations()
 {
-        auto S = find( channels.begin(), channels.end(), sigfile::edf_annotations_label);
+        auto S = find( channels.begin(), channels.end(),
+                       SChannel::type_s(sigfile::definitions::types::edf_annotation));
         if ( S == channels.end() )
                 return 0;
         auto& AH = *S;
@@ -880,11 +861,3 @@ parse_recording_id_edf_style( const string& s)
         }
         return status;
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libsigfile/edf.hh b/upstream/src/libsigfile/edf.hh
index 9b5e2a5..1a350d9 100644
--- a/upstream/src/libsigfile/edf.hh
+++ b/upstream/src/libsigfile/edf.hh
@@ -148,7 +148,7 @@ class CEDFFile
         channel_by_id( const int h) const
                 { return channels[h].ucd; }
 
-        SChannel::TType
+        sigfile::definitions::types
         signal_type( const int h) const
                 { return operator[](h).ucd.type(); }
 
@@ -304,7 +304,7 @@ class CEDFFile
                 bool operator==( const SChannel& h) const
                         { return ucd == h; }
                 bool operator==( const string& h) const
-                        { return ucd.name() == h; }
+                        { return ucd.fuzzy_equal( h); }
 
                 list<SAnnotation>
                         annotations;
@@ -340,14 +340,14 @@ class CEDFFile
                 {
                         auto S = find( channels.begin(), channels.end(), h);
                         if ( S == channels.end() )
-                                throw out_of_range (string ("Unknown channel ") + h.name());
+                                throw out_of_range (string ("Unknown channel ") + h.custom_name());
                         return *S;
                 }
         const SSignal& operator[]( const SChannel& h) const
                 {
                         auto S = find( channels.begin(), channels.end(), h);
                         if ( S == channels.end() )
-                                throw out_of_range (string ("Unknown channel ") + h.name());
+                                throw out_of_range (string ("Unknown channel ") + h.custom_name());
                         return *S;
                 }
 
@@ -407,10 +407,3 @@ class CEDFFile
 
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libsigfile/source-base.hh b/upstream/src/libsigfile/source-base.hh
index 48e2703..b3bcfa2 100644
--- a/upstream/src/libsigfile/source-base.hh
+++ b/upstream/src/libsigfile/source-base.hh
@@ -50,7 +50,7 @@ make_fname_artifacts( const string& filename, const SChannel& channel)
                 filename,
                 supported_sigfile_extensions,
                 agh::fs::TMakeFnameOption::hidden)
-                + "-" + channel.name() + ".artifacts";
+                + "-" + channel.custom_name() + ".artifacts";
 }
 
 inline string
@@ -60,7 +60,7 @@ make_fname_annotations( const string& filename, const SChannel& channel)
                 filename,
                 supported_sigfile_extensions,
                 agh::fs::TMakeFnameOption::hidden)
-                + "-" + channel.name() + ".annotations";
+                + "-" + channel.custom_name() + ".annotations";
 }
 
 inline string
@@ -333,7 +333,7 @@ class CSource
         virtual bool have_channel( const SChannel&)      const = 0;
         virtual int channel_id( const SChannel&)         const = 0;
         virtual const SChannel& channel_by_id( int)      const = 0;
-        virtual SChannel::TType
+        virtual sigfile::definitions::types
         signal_type( int)                                const = 0;
         virtual size_t samplerate( int)                  const = 0;
 
@@ -474,10 +474,3 @@ class CSource
 } // namespace sigfile
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libsigfile/tsv.cc b/upstream/src/libsigfile/tsv.cc
index bded285..235f183 100644
--- a/upstream/src/libsigfile/tsv.cc
+++ b/upstream/src/libsigfile/tsv.cc
@@ -408,7 +408,7 @@ details( const int which) const
                                 " Channel %zu:\n"
                                 "  Label\t: %s\n",
                                 ++i,
-                                H.ucd.name());
+                                H.ucd.custom_name());
         }
 
         return recv.str();
@@ -433,11 +433,3 @@ explain_status( const int status)
                 recv.emplace_back( "Offsets in an irregular-series data not increasing");
         return CSource::explain_status(status) + (recv.empty() ? "" : (join(recv, "\n") + '\n'));
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libsigfile/tsv.hh b/upstream/src/libsigfile/tsv.hh
index 85f8d65..f2fa860 100644
--- a/upstream/src/libsigfile/tsv.hh
+++ b/upstream/src/libsigfile/tsv.hh
@@ -167,7 +167,7 @@ class CTSVFile
         channel_by_id( const int h) const
                 { return channels[h].ucd; }
 
-        SChannel::TType
+        sigfile::definitions::types
         signal_type( const int h) const
                 { return operator[](h).ucd.type(); }
 
@@ -276,13 +276,9 @@ class CTSVFile
                         data;
 
                 bool operator==( const SChannel& h) const
-                        {
-                                return ucd == h;
-                        }
+                        { return ucd == h; }
                 bool operator==( const string& h) const
-                        {
-                                return ucd.name() == h;
-                        }
+                        { return ucd.fuzzy_equal( h); }
 
                 list<SAnnotation>
                         annotations;
@@ -315,14 +311,14 @@ class CTSVFile
                 {
                         auto S = find( channels.begin(), channels.end(), h);
                         if ( S == channels.end() )
-                                throw out_of_range (string ("Unknown channel ") + h.name());
+                                throw out_of_range (string ("Unknown channel ") + h.custom_name());
                         return *S;
                 }
         const SSignal& operator[]( const SChannel& h) const
                 {
                         auto S = find( channels.begin(), channels.end(), h);
                         if ( S == channels.end() )
-                                throw out_of_range (string ("Unknown channel ") + h.name());
+                                throw out_of_range (string ("Unknown channel ") + h.custom_name());
                         return *S;
                 }
 
@@ -365,10 +361,3 @@ class CTSVFile
 
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libsigfile/typed-source.cc b/upstream/src/libsigfile/typed-source.cc
index 9dd3b9f..dd35936 100644
--- a/upstream/src/libsigfile/typed-source.cc
+++ b/upstream/src/libsigfile/typed-source.cc
@@ -121,11 +121,3 @@ source_file_type( const string& fname)
 
         return TType::unrecognised;
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/libsigfile/typed-source.hh b/upstream/src/libsigfile/typed-source.hh
index 455bfc8..7ed6821 100644
--- a/upstream/src/libsigfile/typed-source.hh
+++ b/upstream/src/libsigfile/typed-source.hh
@@ -101,10 +101,3 @@ bool is_supported_source( sigfile::CTypedSource&);
 } // namespace sigfile
 
 #endif
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/tools/edfhed-gtk.cc b/upstream/src/tools/edfhed-gtk.cc
index 4deb9b5..5da30d7 100644
--- a/upstream/src/tools/edfhed-gtk.cc
+++ b/upstream/src/tools/edfhed-gtk.cc
@@ -432,11 +432,3 @@ ui_fini()
         // gtk_widget_destroy
         g_object_unref( builder);
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:
diff --git a/upstream/src/tools/edfhed.cc b/upstream/src/tools/edfhed.cc
index 357565e..8c73704 100644
--- a/upstream/src/tools/edfhed.cc
+++ b/upstream/src/tools/edfhed.cc
@@ -44,8 +44,8 @@ static char doc[] =
 #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
 #pragma GCC diagnostic push
 static struct argp_option options[] = {
-       {"no-channels",             'b', 0,        	    0, "Only dump general header fields (no channel details)"},
-       {"with-annotations",        'a', 0,        	    0, "List embedded annotations"},
+       {"no-channels",             'b', 0,                  0, "Only dump general header fields (no channel details)"},
+       {"with-annotations",        'a', 0,                  0, "List embedded annotations"},
        {"set",                     's', "[CH:]FIELD:VALUE", 0, "Set FIELD to VALUE (possibly in channel CH)" },
        {"id-from-tree",            'R', 0,                  0, "Set 'recording_id' field to Subject/Session/Episode given current file location"},
        {"from-mtime",              'T', 0,                  0, "Set 'recording_date' and 'recording_time' fields to file modification date/time"},
@@ -105,7 +105,7 @@ struct SSettable {
                                 channel = h - 1;  // base 0
                                 if ( strcmp( p, "label") == 0 ) {
                                         sigfile::SChannel X (p);
-                                        if ( X.type() != sigfile::SChannel::TType::eeg )
+                                        if ( X.type() != sigfile::definitions::types::eeg )
                                                 printf( "Note: Channel label \"%s\" does not follow System 10-20\n", v);
                                         which = ch_label;
                                 } else if ( strcmp( p, "transducer_type") == 0 ) {
@@ -425,11 +425,3 @@ main( int argc, char **argv)
 
         return 0;
 }
-
-
-// Local Variables:
-// Mode: c++
-// indent-tabs-mode: nil
-// tab-width: 8
-// c-basic-offset: 8
-// End:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git



More information about the debian-med-commit mailing list