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

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


The following commit has been merged in the master branch:
commit 85d38b004dc74391fdf7b8b680848d3053c3e5f7
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sun Oct 14 21:58:15 2012 +0300

    additional safety checks in ICA setup

diff --git a/src/ica/ica.hh b/src/ica/ica.hh
index ab7dd8e..740bfc8 100644
--- a/src/ica/ica.hh
+++ b/src/ica/ica.hh
@@ -119,7 +119,7 @@ class CFastICA {
 				_source_mat (source.size(), cols);
 			for ( int r = 0; r < (int)source.size(); ++r ) {
 				auto tmp = source[r]();
-				for ( int c = 0; c < (int)tmp.size(); ++c )
+				for ( int c = 0; c < cols; ++c )
 					_source_mat( r, c) = tmp[c];
 			}
 			_obj = new itpp::Fast_ICA (_source_mat);
diff --git a/src/ui/scoring-facility-ica.cc b/src/ui/scoring-facility-ica.cc
index 25520a1..6927854 100644
--- a/src/ui/scoring-facility-ica.cc
+++ b/src/ui/scoring-facility-ica.cc
@@ -52,9 +52,11 @@ setup_ica()
 	}
 
 	vector<TICASetupFun> src;
-	size_t checking_sr = 0;
+	size_t	checking_sr = 0,
+		checking_total_samples = -1;
 	for ( auto &H : channels ) {
-		size_t this_sr = H.crecording.F().samplerate(H.h());
+		size_t	this_sr = H.crecording.F().samplerate(H.h()),
+			this_ts = H.crecording.total_samples();
 		if ( checking_sr and this_sr != checking_sr ) {
 			pop_ok_message( wScoringFacility,
 					"Variable sample rates not supported",
@@ -62,11 +64,18 @@ setup_ica()
 			return 1;
 		} else
 			checking_sr = this_sr;
+		if ( checking_total_samples != -1 and checking_total_samples != this_ts ) {
+			pop_ok_message( wScoringFacility,
+					"Unequal channel sizes",
+					"This is something that's never supposed to happen.");
+			return 1;
+		} else
+			checking_total_samples = this_ts;
 
 		src.emplace_back(
 			bind (&sigfile::CSource::get_signal_original<int>, &H.crecording.F(), H.h()));
 	}
-	ica = new ica::CFastICA (src, checking_sr * pagesize() * total_pages());
+	ica = new ica::CFastICA (src, channels.front().crecording.total_samples());
 
       // initialize
 	// has no independent default

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list