[med-svn] [aghermann] 03/13: split aghermann/expdesign/primaries.hh, streamline #includes
andrei zavada
hmmr-guest at alioth.debian.org
Wed Aug 28 22:10:21 UTC 2013
This is an automated email from the git hooks/post-receive script.
hmmr-guest pushed a commit to branch master
in repository aghermann.
commit c2bf856ce8547501c185e1778eae756ddc82cf5b
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Mon Aug 19 00:00:10 2013 +0300
split aghermann/expdesign/primaries.hh, streamline #includes
---
upstream/src/aghermann/expdesign/Makefile.am | 5 +-
upstream/src/aghermann/expdesign/expdesign.cc | 52 ++++-
.../expdesign/{primaries.hh => expdesign.hh} | 185 +---------------
upstream/src/aghermann/expdesign/forward-decls.hh | 2 +
upstream/src/aghermann/expdesign/loadsave.cc | 3 +-
upstream/src/aghermann/expdesign/recording.cc | 6 +-
upstream/src/aghermann/expdesign/subject.cc | 23 +-
upstream/src/aghermann/expdesign/subject.hh | 223 ++++++++++++++++++++
upstream/src/aghermann/expdesign/tree-scanner.cc | 8 +-
upstream/src/aghermann/main.cc | 2 +-
upstream/src/aghermann/model/achermann.cc | 45 ----
upstream/src/aghermann/rk1968/rk1968.cc | 7 +-
upstream/src/aghermann/rk1968/rk1968.hh | 13 +-
upstream/src/aghermann/ui/mw/mainmenu_cb.cc | 8 +-
upstream/src/aghermann/ui/mw/measurements_cb.cc | 2 +-
upstream/src/aghermann/ui/mw/mw.cc | 2 +-
upstream/src/aghermann/ui/mw/mw.hh | 16 +-
upstream/src/aghermann/ui/mw/populate.cc | 2 +-
upstream/src/aghermann/ui/sf/sf.hh | 8 +-
19 files changed, 338 insertions(+), 274 deletions(-)
diff --git a/upstream/src/aghermann/expdesign/Makefile.am b/upstream/src/aghermann/expdesign/Makefile.am
index 355905d..cde7b3d 100644
--- a/upstream/src/aghermann/expdesign/Makefile.am
+++ b/upstream/src/aghermann/expdesign/Makefile.am
@@ -7,7 +7,7 @@ noinst_LIBRARIES := liba.a
liba_a_SOURCES := \
forward-decls.hh \
- primaries.hh \
+ expdesign.hh \
profile.hh \
expdesign.cc \
loadsave.cc \
@@ -21,7 +21,8 @@ BUILT_SOURCES := \
forward-decls.hh.gch \
profile.hh.gch \
recording.hh.gch \
- primaries.hh.gch
+ subject.hh.gch \
+ expdesign.hh.gch
%.hh.gch: %.hh
$(CXXCOMPILE) -c $<
CLEANFILES = \
diff --git a/upstream/src/aghermann/expdesign/expdesign.cc b/upstream/src/aghermann/expdesign/expdesign.cc
index d807de3..c6e5f07 100644
--- a/upstream/src/aghermann/expdesign/expdesign.cc
+++ b/upstream/src/aghermann/expdesign/expdesign.cc
@@ -19,7 +19,7 @@
#include "aghermann/globals.hh"
#include "common/config-validate.hh"
-#include "primaries.hh"
+#include "expdesign.hh"
using namespace std;
@@ -209,7 +209,7 @@ for_all_episodes( const TEpisodeOpFun& F, const TEpisodeReportFun& report, const
vector<tuple<CJGroup*,
CSubject*,
const string*,
- CSubject::SEpisode*>> v;
+ SEpisode*>> v;
for ( auto& G : groups )
for ( auto& J : G.second )
for ( auto& M : J.measurements )
@@ -240,7 +240,7 @@ for_all_recordings( const TRecordingOpFun& F, const TRecordingReportFun& report,
vector<tuple<CJGroup*,
CSubject*,
const string*,
- CSubject::SEpisode*,
+ SEpisode*,
CRecording*>> v;
for ( auto& G : groups )
for ( auto& J : G.second )
@@ -428,6 +428,52 @@ used_samplerates( sigfile::SChannel::TType type) const
+
+
+
+int
+agh::CExpDesign::
+setup_modrun( const string& j, const string& d, const string& h,
+ const SProfileParamSet& profile_params0,
+ agh::ach::CModelRun** Rpp)
+{
+ try {
+ CSubject& J = subject_by_x(j);
+
+ if ( J.measurements[d].size() == 1 && ctl_params0.DBAmendment2 )
+ return CProfile::TFlags::eamendments_ineffective;
+
+ if ( J.measurements[d].size() == 1 && tstep[ach::TTunable::rs] > 0. )
+ return CProfile::TFlags::ers_nonsensical;
+
+ J.measurements[d].modrun_sets[profile_params0].insert(
+ pair<string, ach::CModelRun> (
+ h,
+ ach::CModelRun (
+ J, d, h,
+ profile_params0,
+ ctl_params0,
+ tunables0))
+ );
+ if ( Rpp )
+ *Rpp = &J.measurements[d]
+ . modrun_sets[profile_params0][h];
+
+ } catch (invalid_argument ex) { // thrown by CProfile ctor
+ fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
+ return -1;
+ } catch (out_of_range ex) {
+ fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
+ return -1;
+ } catch (int ex) { // thrown by CModelRun ctor
+ log_message( "CExpDesign::setup_modrun( %s, %s, %s): %s", j.c_str(), d.c_str(), h.c_str(), CProfile::explain_status(ex).c_str());
+ return ex;
+ }
+
+ return 0;
+}
+
+
void
agh::CExpDesign::
prune_untried_modruns()
diff --git a/upstream/src/aghermann/expdesign/primaries.hh b/upstream/src/aghermann/expdesign/expdesign.hh
similarity index 63%
rename from upstream/src/aghermann/expdesign/primaries.hh
rename to upstream/src/aghermann/expdesign/expdesign.hh
index 186082b..cf06a36 100644
--- a/upstream/src/aghermann/expdesign/primaries.hh
+++ b/upstream/src/aghermann/expdesign/expdesign.hh
@@ -1,10 +1,10 @@
/*
- * File name: aghermann/expdesign/primaries.hh
+ * File name: aghermann/expdesign/expdesign.hh
* Project: Aghermann
* Author: Andrei Zavada <johnhommer at gmail.com>
* Initial version: 2010-05-01
*
- * Purpose: experimental design primary classes: CSubject & CExpDesign
+ * Purpose: experimental design primary classes: CExpDesign
*
* License: GPL
*/
@@ -27,6 +27,7 @@
#include "aghermann/model/achermann.hh"
#include "forward-decls.hh"
+#include "subject.hh"
#if HAVE_CONFIG_H && !defined(VERSION)
# include "config.h"
@@ -38,178 +39,6 @@ namespace agh {
using namespace std;
-typedef size_t sid_t;
-
-
-class CSubject : public SSubjectId {
-
- void operator=( const CSubject&) = delete;
- CSubject () = delete;
-
- public:
- CSubject (const CSubject& rv)
- : agh::SSubjectId (rv),
- _status (rv._status),
- _id (rv._id),
- _dir (rv._dir)
- {}
-
- CSubject (const string& dir, sid_t id)
- : agh::SSubjectId (dir.substr( dir.rfind('/')+1)),
- _status (0),
- _id (id),
- _dir (dir)
- {}
-
- // identification
- const char*
- dir() const
- { return _dir.c_str(); }
-
- int try_update_subject_details( const agh::SSubjectId& j)
- { return SSubjectId::update_from( j); }
-
- float age( const string& d) const; // age when recordings in this session were made
- float age() const; // now
- float age_rel( time_t) const;
-
- bool operator==( const CSubject &o) const
- { return id == o.id; }
- bool operator==( const string& n) const
- { return SSubjectId::id == n; }
- bool operator==( sid_t id) const
- { return _id == id; }
-
- // contents
- struct SEpisodeSequence;
- struct SEpisode {
- SEpisode (sigfile::CTypedSource&&,
- const metrics::psd::SPPack&,
- const metrics::swu::SPPack&,
- const metrics::mc::SPPack&);
-
- time_t start_time() const { return sources.front()().start_time(); }
- time_t end_time() const { return sources.front()().end_time(); }
- time_t start_time() { return sources.front()().start_time(); }
- time_t end_time() { return sources.front()().end_time(); }
- time_t // relative to start_time
- start_rel,
- end_rel;
-
- typedef map<sigfile::SChannel, CRecording> TRecordingSet;
- TRecordingSet
- recordings; // one per channel, naturally
-
- const char*
- name() const
- { return sources.front()().episode(); }
- bool
- operator==( const string& e) const
- { return e == name(); }
- bool
- operator<( const SEpisode& rv) const
- {
- return sources.front()().end_time()
- < rv.sources.front()().start_time();
- }
-
- struct SAnnotation
- : public sigfile::SAnnotation {
- SAnnotation (const sigfile::CSource& _si, int _hi,
- const sigfile::SAnnotation& _a)
- : sigfile::SAnnotation (_a),
- _source (_si), _h (_hi)
- {}
- SAnnotation( const SAnnotation&) = default;
-
- const sigfile::CSource& _source;
- int _h;
-
- bool
- operator<( const SAnnotation& rv) const
- { return span < rv.span; }
-
- const char*
- channel() const
- { return (_h == -1) ? "(embedded)" : _source.channel_by_id(_h).name(); }
- agh::alg::SSpan<float>
- page_span( size_t pagesize) const
- { return span / (float)pagesize; }
- };
- list<SAnnotation>
- get_annotations() const;
-
- // private:
- // friend class agh::CSubject;
- // friend class agh::ui::SScoringFacility;
- // allow multiple sources (possibly supplying different channels)
- list<sigfile::CTypedSource>
- sources;
- };
-
- class SEpisodeSequence {
- friend class agh::CExpDesign;
- friend class agh::CProfile;
- public:
- list<SEpisode> episodes;
- size_t
- size() const
- { return episodes.size(); }
-
- list<SEpisode>::const_iterator
- episode_iter_by_name( const string& e) const
- { return find( episodes.begin(), episodes.end(), e); }
- bool
- have_episode( const string& e) const
- { return episode_iter_by_name(e) != episodes.cend(); }
-
- const SEpisode&
- operator[]( const string& e) const;
- SEpisode&
- operator[]( const string& e);
-
- // either construct a new episode from F, or update an
- // existing one (add F to its sources)
- int
- add_one( sigfile::CTypedSource&&,
- const metrics::psd::SPPack&,
- const metrics::swu::SPPack&,
- const metrics::mc::SPPack&,
- float max_hours_apart = 7*24.);
-
- // simulations rather belong here
- typedef map<SProfileParamSet,
- map<string, // channel
- ach::CModelRun>>
- TModrunSetMap;
- TModrunSetMap
- modrun_sets; // a bunch (from, to) per each fftable channel
- };
- // all episode sequences, all channels forming a session
- // using CMSessionSet = map<string, // session name
- // SEpisodeSequence>;
- typedef map<string, // session name
- SEpisodeSequence>
- CMSessionSet;
- CMSessionSet
- measurements;
-
- bool
- have_session( const string& d) const
- {
- return measurements.find(d) != measurements.end();
- }
-
- private:
- int _status;
- sid_t _id; // eventually to allow distinctly identifiable namesakes in different groups
-
- string _dir;
-};
-
-
-
-
class CJGroup
: public list<CSubject> {
@@ -337,15 +166,15 @@ class CExpDesign {
void
for_all_subjects( const TSubjectOpFun&, const TSubjectReportFun&, const TSubjectFilterFun&);
- typedef function<void(CSubject::SEpisode&)>
+ typedef function<void(SEpisode&)>
TEpisodeOpFun;
typedef function<void(const CJGroup&,
const CSubject&,
const string&,
- const CSubject::SEpisode&,
+ const SEpisode&,
size_t, size_t)>
TEpisodeReportFun;
- typedef function<bool(CSubject::SEpisode&)>
+ typedef function<bool(SEpisode&)>
TEpisodeFilterFun;
void
for_all_episodes( const TEpisodeOpFun&, const TEpisodeReportFun&, const TEpisodeFilterFun&);
@@ -355,7 +184,7 @@ class CExpDesign {
typedef function<void(const CJGroup&,
const CSubject&,
const string&,
- const CSubject::SEpisode&,
+ const SEpisode&,
const CRecording&,
size_t, size_t)>
TRecordingReportFun;
diff --git a/upstream/src/aghermann/expdesign/forward-decls.hh b/upstream/src/aghermann/expdesign/forward-decls.hh
index 4f50367..88af537 100644
--- a/upstream/src/aghermann/expdesign/forward-decls.hh
+++ b/upstream/src/aghermann/expdesign/forward-decls.hh
@@ -16,6 +16,8 @@
namespace agh {
class CSubject;
+struct SEpisode;
+struct SEpisodeSequence;
class CJGroup;
class CExpDesign;
diff --git a/upstream/src/aghermann/expdesign/loadsave.cc b/upstream/src/aghermann/expdesign/loadsave.cc
index 5a35b40..00227a4 100644
--- a/upstream/src/aghermann/expdesign/loadsave.cc
+++ b/upstream/src/aghermann/expdesign/loadsave.cc
@@ -9,9 +9,8 @@
* License: GPL
*/
-#include "common/config-validate.hh"
#include "aghermann/model/achermann.hh"
-#include "primaries.hh"
+#include "expdesign.hh"
using namespace std;
diff --git a/upstream/src/aghermann/expdesign/recording.cc b/upstream/src/aghermann/expdesign/recording.cc
index 6c578ed..13021db 100644
--- a/upstream/src/aghermann/expdesign/recording.cc
+++ b/upstream/src/aghermann/expdesign/recording.cc
@@ -15,7 +15,7 @@
#include "aghermann/model/beersma.hh"
#include "recording.hh"
-#include "primaries.hh"
+#include "subject.hh"
using namespace std;
@@ -138,7 +138,7 @@ CProfile (CSubject& J, const string& d, const sigfile::SChannel& h,
_status |= TFlags::enegoffset;
return;
}
- // this condition is checked against already in CSubject::SEpisodeSequence::add_one()
+ // this condition is checked against already in SEpisodeSequence::add_one()
// if ( _mm_bounds.size() > 0 && pa - _mm_bounds.back().second > 4 * 24 * 3600 ) {
// _status |= (int)TSimPrepError::efarapart;
// return;
@@ -193,7 +193,7 @@ CProfile (CRecording& M,
_status |= TFlags::enegoffset;
return;
}
- // this condition is checked against already in CSubject::SEpisodeSequence::add_one()
+ // this condition is checked against already in SEpisodeSequence::add_one()
// if ( _mm_bounds.size() > 0 && pa - _mm_bounds.back().second > 4 * 24 * 3600 ) {
// _status |= (int)TSimPrepError::efarapart;
// return;
diff --git a/upstream/src/aghermann/expdesign/subject.cc b/upstream/src/aghermann/expdesign/subject.cc
index 8577753..c142bdb 100644
--- a/upstream/src/aghermann/expdesign/subject.cc
+++ b/upstream/src/aghermann/expdesign/subject.cc
@@ -10,7 +10,10 @@
*/
-#include "primaries.hh"
+#include "common/containers.hh"
+#include "aghermann/model/achermann.hh"
+#include "recording.hh"
+#include "subject.hh"
using namespace std;
@@ -56,7 +59,7 @@ age_rel( time_t rel) const
-CSubject::SEpisode::
+SEpisode::
SEpisode (sigfile::CTypedSource&& F_,
const metrics::psd::SPPack& fft_params,
const metrics::swu::SPPack& swu_params,
@@ -66,7 +69,7 @@ SEpisode (sigfile::CTypedSource&& F_,
sources.emplace_back( move(F_));
auto& F = sources.back();
auto HH = F().channel_list();
- printf( "CSubject::SEpisode::SEpisode( \"%s\"): %s\n",
+ printf( "SEpisode::SEpisode( \"%s\"): %s\n",
F().filename(), sigfile::join_channel_names(HH, ", ").c_str());
int h = 0;
for ( auto& H : HH )
@@ -74,11 +77,11 @@ SEpisode (sigfile::CTypedSource&& F_,
}
-list<CSubject::SEpisode::SAnnotation>
-CSubject::SEpisode::
+list<SEpisode::SAnnotation>
+SEpisode::
get_annotations() const
{
- list<agh::CSubject::SEpisode::SAnnotation>
+ list<agh::SEpisode::SAnnotation>
ret;
for ( auto &F : sources ) {
auto HH = F().channel_list();
@@ -96,8 +99,8 @@ get_annotations() const
-const CSubject::SEpisode&
-CSubject::SEpisodeSequence::
+const SEpisode&
+SEpisodeSequence::
operator[]( const string& e) const
{
auto E = find( episodes.begin(), episodes.end(), e);
@@ -107,8 +110,8 @@ operator[]( const string& e) const
throw invalid_argument( string("no such episode: ") + e);
}
-CSubject::SEpisode&
-CSubject::SEpisodeSequence::
+SEpisode&
+SEpisodeSequence::
operator[]( const string& e)
{
auto E = find( episodes.begin(), episodes.end(), e);
diff --git a/upstream/src/aghermann/expdesign/subject.hh b/upstream/src/aghermann/expdesign/subject.hh
new file mode 100644
index 0000000..40e360f
--- /dev/null
+++ b/upstream/src/aghermann/expdesign/subject.hh
@@ -0,0 +1,223 @@
+/*
+ * File name: aghermann/expdesign/subject.hh
+ * Project: Aghermann
+ * Author: Andrei Zavada <johnhommer at gmail.com>
+ * Initial version: 2010-05-01
+ *
+ * Purpose: experimental design primary classes: CSubject
+ *
+ * License: GPL
+ */
+
+
+#ifndef AGH_AGHERMANN_EXPDESIGN_SUBJECT_H_
+#define AGH_AGHERMANN_EXPDESIGN_SUBJECT_H_
+
+
+#include <string>
+#include <list>
+#include <map>
+
+#include "common/subject_id.hh"
+#include "libsigfile/forward-decls.hh"
+#include "libsigfile/typed-source.hh"
+#include "libmetrics/forward-decls.hh"
+//#include "aghermann/model/forward-decls.hh" // map needs it full
+#include "aghermann/model/achermann.hh"
+
+#include "forward-decls.hh"
+
+#if HAVE_CONFIG_H && !defined(VERSION)
+# include "config.h"
+#endif
+
+
+namespace agh {
+
+using namespace std;
+
+
+struct SEpisode {
+
+ SEpisode (sigfile::CTypedSource&&,
+ const metrics::psd::SPPack&,
+ const metrics::swu::SPPack&,
+ const metrics::mc::SPPack&);
+
+ time_t start_time() const { return sources.front()().start_time(); }
+ time_t end_time() const { return sources.front()().end_time(); }
+ time_t start_time() { return sources.front()().start_time(); }
+ time_t end_time() { return sources.front()().end_time(); }
+ time_t // relative to start_time
+ start_rel,
+ end_rel;
+
+ typedef map<sigfile::SChannel, CRecording> TRecordingSet;
+ TRecordingSet
+ recordings; // one per channel, naturally
+
+ const char*
+ name() const
+ { return sources.front()().episode(); }
+ bool
+ operator==( const string& e) const
+ { return e == name(); }
+ bool
+ operator<( const SEpisode& rv) const
+ {
+ return sources.front()().end_time()
+ < rv.sources.front()().start_time();
+ }
+
+ struct SAnnotation
+ : public sigfile::SAnnotation {
+ SAnnotation (const sigfile::CSource& _si, int _hi,
+ const sigfile::SAnnotation& _a)
+ : sigfile::SAnnotation (_a),
+ _source (_si), _h (_hi)
+ {}
+ SAnnotation( const SAnnotation&) = default;
+
+ const sigfile::CSource& _source;
+ int _h;
+
+ bool
+ operator<( const SAnnotation& rv) const
+ { return span < rv.span; }
+
+ const char*
+ channel() const
+ { return (_h == -1) ? "(embedded)" : _source.channel_by_id(_h).name(); }
+ agh::alg::SSpan<float>
+ page_span( size_t pagesize) const
+ { return span / (float)pagesize; }
+ };
+ list<SAnnotation>
+ get_annotations() const;
+
+ // private:
+ // friend class agh::CSubject;
+ // friend class agh::ui::SScoringFacility;
+ // allow multiple sources (possibly supplying different channels)
+ list<sigfile::CTypedSource>
+ sources;
+};
+
+
+struct SEpisodeSequence {
+ friend class agh::CExpDesign;
+ friend class agh::CProfile;
+ public:
+ list<SEpisode> episodes;
+ size_t
+ size() const
+ { return episodes.size(); }
+
+ list<SEpisode>::const_iterator
+ episode_iter_by_name( const string& e) const
+ { return find( episodes.begin(), episodes.end(), e); }
+ bool
+ have_episode( const string& e) const
+ { return episode_iter_by_name(e) != episodes.cend(); }
+
+ const SEpisode&
+ operator[]( const string& e) const;
+ SEpisode&
+ operator[]( const string& e);
+
+ // either construct a new episode from F, or update an
+ // existing one (add F to its sources)
+ int
+ add_one( sigfile::CTypedSource&&,
+ const metrics::psd::SPPack&,
+ const metrics::swu::SPPack&,
+ const metrics::mc::SPPack&,
+ float max_hours_apart = 7*24.);
+
+ // simulations rather belong here
+ typedef map<SProfileParamSet,
+ map<string, // channel
+ ach::CModelRun>>
+ TModrunSetMap;
+ TModrunSetMap
+ modrun_sets; // a bunch (from, to) per each fftable channel
+};
+
+
+
+
+
+typedef size_t sid_t;
+
+
+class CSubject : public SSubjectId {
+
+ void operator=( const CSubject&) = delete;
+ CSubject () = delete;
+
+ public:
+ CSubject (const CSubject& rv)
+ : agh::SSubjectId (rv),
+ _status (rv._status),
+ _id (rv._id),
+ _dir (rv._dir)
+ {}
+
+ CSubject (const string& dir, sid_t id)
+ : agh::SSubjectId (dir.substr( dir.rfind('/')+1)),
+ _status (0),
+ _id (id),
+ _dir (dir)
+ {}
+
+ // identification
+ const char*
+ dir() const
+ { return _dir.c_str(); }
+
+ int try_update_subject_details( const agh::SSubjectId& j)
+ { return SSubjectId::update_from( j); }
+
+ float age( const string& d) const; // age when recordings in this session were made
+ float age() const; // now
+ float age_rel( time_t) const;
+
+ bool operator==( const CSubject &o) const
+ { return id == o.id; }
+ bool operator==( const string& n) const
+ { return SSubjectId::id == n; }
+ bool operator==( sid_t id) const
+ { return _id == id; }
+
+ // all episode sequences, all channels forming a session
+ // using CMSessionSet = map<string, // session name
+ // SEpisodeSequence>;
+ typedef map<string, // session name
+ SEpisodeSequence>
+ CMSessionSet;
+ CMSessionSet
+ measurements;
+
+ bool
+ have_session( const string& d) const
+ {
+ return measurements.find(d) != measurements.end();
+ }
+
+ private:
+ int _status;
+ sid_t _id; // eventually to allow distinctly identifiable namesakes in different groups
+
+ string _dir;
+};
+
+} // namespace agh
+
+#endif
+
+// Local Variables:
+// Mode: c++
+// indent-tabs-mode: 8
+// 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 6d9f99a..70eee13 100644
--- a/upstream/src/aghermann/expdesign/tree-scanner.cc
+++ b/upstream/src/aghermann/expdesign/tree-scanner.cc
@@ -16,7 +16,7 @@
#include "common/alg.hh"
#include "libsigfile/all.hh"
-#include "primaries.hh"
+#include "expdesign.hh"
using namespace std;
@@ -42,7 +42,7 @@ agh::CExpDesign::TMsmtCollectProgressIndicatorFun
// let them be
int
-agh::CSubject::SEpisodeSequence::
+agh::SEpisodeSequence::
add_one( sigfile::CTypedSource&& Fmc,
const metrics::psd::SPPack& fft_params,
const metrics::swu::SPPack& swu_params,
@@ -72,7 +72,7 @@ add_one( sigfile::CTypedSource&& Fmc,
} else { // same as SEpisode() but done on an existing one
// check that the edf source being added has exactly the same timestamp and duration
- printf( "CSubject::SEpisodeSequence::add_one( \"%s\") try in-place\n",
+ printf( "SEpisodeSequence::add_one( \"%s\") try in-place\n",
Fmc().filename());
if ( fabs( difftime( Ei->start_time(), Fmc().start_time())) > 1 )
return AGH_EPSEQADD_TOOFAR;
@@ -405,7 +405,7 @@ compute_profiles()
R.mc_profile.compute();
};
TRecordingReportFun G =
- [&]( const CJGroup&, const CSubject&, const string&, const CSubject::SEpisode&, const CRecording& R,
+ [&]( const CJGroup&, const CSubject&, const string&, const SEpisode&, const CRecording& R,
size_t i, size_t total)
{
only_progress_fun(
diff --git a/upstream/src/aghermann/main.cc b/upstream/src/aghermann/main.cc
index 2d410f6..ae6c419 100644
--- a/upstream/src/aghermann/main.cc
+++ b/upstream/src/aghermann/main.cc
@@ -19,7 +19,7 @@
#include <unique/unique.h>
#include "globals.hh"
-#include "expdesign/primaries.hh"
+#include "expdesign/expdesign.hh"
#include "ui/globals.hh"
#include "ui/ui.hh"
#include "ui/sm/sm.hh"
diff --git a/upstream/src/aghermann/model/achermann.cc b/upstream/src/aghermann/model/achermann.cc
index fa7489c..622c95f 100644
--- a/upstream/src/aghermann/model/achermann.cc
+++ b/upstream/src/aghermann/model/achermann.cc
@@ -11,8 +11,6 @@
#include <list>
-#include "aghermann/expdesign/profile.hh"
-#include "aghermann/expdesign/primaries.hh"
#include "achermann-tunable.hh"
#include "achermann.hh"
@@ -70,49 +68,6 @@ operator==( const SControlParamSet &rv) const
-int
-agh::CExpDesign::
-setup_modrun( const string& j, const string& d, const string& h,
- const SProfileParamSet& profile_params0,
- agh::ach::CModelRun** Rpp)
-{
- try {
- CSubject& J = subject_by_x(j);
-
- if ( J.measurements[d].size() == 1 && ctl_params0.DBAmendment2 )
- return CProfile::TFlags::eamendments_ineffective;
-
- if ( J.measurements[d].size() == 1 && tstep[ach::TTunable::rs] > 0. )
- return CProfile::TFlags::ers_nonsensical;
-
- J.measurements[d].modrun_sets[profile_params0].insert(
- pair<string, ach::CModelRun> (
- h,
- ach::CModelRun (
- J, d, h,
- profile_params0,
- ctl_params0,
- tunables0))
- );
- if ( Rpp )
- *Rpp = &J.measurements[d]
- . modrun_sets[profile_params0][h];
-
- } catch (invalid_argument ex) { // thrown by CProfile ctor
- fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
- return -1;
- } catch (out_of_range ex) {
- fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
- return -1;
- } catch (int ex) { // thrown by CModelRun ctor
- log_message( "CExpDesign::setup_modrun( %s, %s, %s): %s", j.c_str(), d.c_str(), h.c_str(), CProfile::explain_status(ex).c_str());
- return ex;
- }
-
- return 0;
-}
-
-
agh::ach::CModelRun::
diff --git a/upstream/src/aghermann/rk1968/rk1968.cc b/upstream/src/aghermann/rk1968/rk1968.cc
index 6a351de..70809e3 100644
--- a/upstream/src/aghermann/rk1968/rk1968.cc
+++ b/upstream/src/aghermann/rk1968/rk1968.cc
@@ -15,7 +15,8 @@
#include "libsigfile/page.hh"
#include "libsigfile/typed-source.hh"
#include "aghermann/expdesign/recording.hh"
-#include "aghermann/expdesign/primaries.hh"
+#include "aghermann/expdesign/subject.hh"
+#include "aghermann/expdesign/expdesign.hh"
#include "libmetrics/bands.hh"
#include "rk1968.hh"
@@ -26,7 +27,7 @@ using namespace agh::rk1968;
int
CScoreAssistant::
-score( agh::CSubject::SEpisode& E)
+score( agh::SEpisode& E)
{
forward_list<agh::CRecording*> HH;
for ( auto &R : E.recordings )
@@ -54,7 +55,7 @@ score( agh::CSubject::SEpisode& E)
int decision = 0;
for ( ; Di != courses_delta.end(); ++Di, ++Ti )
decision +=
- ( (*Di)[p] > (*Ti)[p] * 1.5 );
+ ( (*Di)[p] > (*Ti)[p] * nrem3_delta_theta_ratio );
if ( decision > 0 )
firstsource[p].mark( sigfile::SPage::TScore::nrem3);
}
diff --git a/upstream/src/aghermann/rk1968/rk1968.hh b/upstream/src/aghermann/rk1968/rk1968.hh
index 228602c..070c3af 100644
--- a/upstream/src/aghermann/rk1968/rk1968.hh
+++ b/upstream/src/aghermann/rk1968/rk1968.hh
@@ -12,19 +12,24 @@
#ifndef _AGH_RK1968_H
#define _AGH_RK1968_H
-#include "aghermann/expdesign/primaries.hh"
+#include "aghermann/expdesign/forward-decls.hh"
namespace agh {
namespace rk1968 {
struct SScoreAssistantPPack {
+ double nrem3_delta_theta_ratio;
+
+ SScoreAssistantPPack ()
+ : nrem3_delta_theta_ratio (1.5)
+ {}
};
-class CScoreAssistant {
+class CScoreAssistant
+ : public SScoreAssistantPPack {
public:
- int score( agh::CSubject::SEpisode&);
-
+ int score( agh::SEpisode&);
};
diff --git a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
index 4b0e6cb..27aec76 100644
--- a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
+++ b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
@@ -179,17 +179,17 @@ iExpBasicSADetectUltradianCycles_activate_cb(
using namespace agh;
CExpDesign::TEpisodeFilterFun filter =
- [&ED]( agh::CSubject::SEpisode& E) -> bool
+ [&ED]( agh::SEpisode& E) -> bool
{
return E.recordings.find( *ED._AghHi) != E.recordings.end();
};
CExpDesign::TEpisodeOpFun F =
- [&ED]( agh::CSubject::SEpisode& E)
+ [&ED]( agh::SEpisode& E)
{
ED.do_detect_ultradian_cycle( E.recordings.at( *ED._AghHi));
};
CExpDesign::TEpisodeReportFun reporter =
- [&ED]( const agh::CJGroup&, const agh::CSubject& J, const string&, const agh::CSubject::SEpisode& E,
+ [&ED]( const agh::CJGroup&, const agh::CSubject& J, const string&, const agh::SEpisode& E,
size_t i, size_t n)
{
ED.sb_main_progress_indicator(
@@ -249,7 +249,7 @@ iExpGloballyDetectArtifacts_activate_cb(
CExpDesign::TRecordingOpFun op;
CExpDesign::TRecordingFilterFun filter;
CExpDesign::TRecordingReportFun reporter =
- [&]( const CJGroup&, const CSubject& J, const string& D, const CSubject::SEpisode& E, const CRecording& R,
+ [&]( const CJGroup&, const CSubject& J, const string& D, const SEpisode& E, const CRecording& R,
size_t i, size_t total)
{
ED.sb_main_progress_indicator(
diff --git a/upstream/src/aghermann/ui/mw/measurements_cb.cc b/upstream/src/aghermann/ui/mw/measurements_cb.cc
index 0b95d03..f1a82ad 100644
--- a/upstream/src/aghermann/ui/mw/measurements_cb.cc
+++ b/upstream/src/aghermann/ui/mw/measurements_cb.cc
@@ -200,7 +200,7 @@ iSubjectTimelineDetectUltradianCycle_activate_cb(
const gpointer userdata)
{
auto& ED = *(SExpDesignUI*)userdata;
- agh::CSubject::SEpisode *Ep;
+ agh::SEpisode *Ep;
if ( ED.using_subject && (Ep = ED.using_subject->using_episode) ) {
auto& R = Ep->recordings.at(*ED._AghHi);
SBusyBlock bb (ED.wMainWindow);
diff --git a/upstream/src/aghermann/ui/mw/mw.cc b/upstream/src/aghermann/ui/mw/mw.cc
index d551253..e1a1f6e 100644
--- a/upstream/src/aghermann/ui/mw/mw.cc
+++ b/upstream/src/aghermann/ui/mw/mw.cc
@@ -18,7 +18,7 @@
#include "libmetrics/page-metrics-base.hh"
#include "libmetrics/mc-artifacts.hh"
#include "libmetrics/bands.hh"
-#include "aghermann/expdesign/primaries.hh"
+//#include "aghermann/expdesign/expdesign.hh"
#include "aghermann/model/beersma.hh"
#include "aghermann/ui/misc.hh"
#include "aghermann/ui/sf/sf.hh"
diff --git a/upstream/src/aghermann/ui/mw/mw.hh b/upstream/src/aghermann/ui/mw/mw.hh
index 6321a56..ee35837 100644
--- a/upstream/src/aghermann/ui/mw/mw.hh
+++ b/upstream/src/aghermann/ui/mw/mw.hh
@@ -24,7 +24,7 @@
#include "common/config-validate.hh"
#include "libmetrics/mc-artifacts.hh"
#include "aghermann/model/forward-decls.hh"
-#include "aghermann/expdesign/primaries.hh"
+#include "aghermann/expdesign/expdesign.hh"
#include "aghermann/ui/ui.hh"
#include "aghermann/ui/ui++.hh"
#include "aghermann/ui/forward-decls.hh"
@@ -67,11 +67,11 @@ class SExpDesignUI
*cprofile;
void create_cprofile();
- list<agh::CSubject::SEpisode>&
+ list<agh::SEpisode>&
sepisodesequence() const
{ return csubject.measurements[*_p._p._AghDi].episodes; }
- agh::CSubject::SEpisode
+ agh::SEpisode
*using_episode;
bool is_episode_focused() const
{ return using_episode != nullptr; }
@@ -186,13 +186,13 @@ class SExpDesignUI
// inventory
// full-path annotations
struct SAnnotation
- : public agh::CSubject::SEpisode::SAnnotation {
+ : public agh::SEpisode::SAnnotation {
agh::CSubject& csubject;
const string& session;
- agh::CSubject::SEpisode& sepisode;
- SAnnotation (agh::CSubject& j, const string& d, agh::CSubject::SEpisode& e,
- agh::CSubject::SEpisode::SAnnotation& a)
- : agh::CSubject::SEpisode::SAnnotation (a),
+ agh::SEpisode& sepisode;
+ SAnnotation (agh::CSubject& j, const string& d, agh::SEpisode& e,
+ agh::SEpisode::SAnnotation& a)
+ : agh::SEpisode::SAnnotation (a),
csubject (j), session (d), sepisode (e)
{}
};
diff --git a/upstream/src/aghermann/ui/mw/populate.cc b/upstream/src/aghermann/ui/mw/populate.cc
index 3045c13..9372f08 100644
--- a/upstream/src/aghermann/ui/mw/populate.cc
+++ b/upstream/src/aghermann/ui/mw/populate.cc
@@ -13,7 +13,7 @@
#include <cstring>
#include <sstream>
-#include "aghermann/expdesign/primaries.hh"
+#include "aghermann/expdesign/expdesign.hh"
#include "aghermann/model/beersma.hh"
#include "aghermann/ui/misc.hh"
#include "mw.hh"
diff --git a/upstream/src/aghermann/ui/sf/sf.hh b/upstream/src/aghermann/ui/sf/sf.hh
index 7620da7..6a908d6 100644
--- a/upstream/src/aghermann/ui/sf/sf.hh
+++ b/upstream/src/aghermann/ui/sf/sf.hh
@@ -22,9 +22,9 @@
#include "common/config-validate.hh"
#include "libsigproc/winfun.hh"
#include "libsigproc/sigproc.hh"
-#include "aghermann/patterns/patterns.hh"
#include "libmetrics/mc-artifacts.hh"
-#include "aghermann/expdesign/primaries.hh"
+#include "aghermann/patterns/patterns.hh"
+#include "aghermann/expdesign/forward-decls.hh"
#include "aghermann/ica/ica.hh"
#include "aghermann/ui/globals.hh"
#include "aghermann/ui/ui++.hh"
@@ -62,11 +62,11 @@ class SScoringFacility
agh::CSubject&
_csubject;
string _session;
- agh::CSubject::SEpisode&
+ agh::SEpisode&
_sepisode;
public:
agh::CSubject& csubject() const { return _csubject; }
- agh::CSubject::SEpisode& sepisode() const { return _sepisode; }
+ agh::SEpisode& sepisode() const { return _sepisode; }
const string& session() const { return _session; }
// channels
--
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git
More information about the debian-med-commit
mailing list