[med-svn] [SCM] aghermann branch, master, updated. c0bd21ca8eb529ade7e0c7aad22951a308a8dc8f
Andrei Zavada
johnhommer at gmail.com
Wed May 1 00:09:30 UTC 2013
The following commit has been merged in the master branch:
commit 78da140c73c1612ea1adb5a8824e62326c99d368
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Wed Apr 24 19:11:44 2013 +0300
rename some vars, reindent some
diff --git a/src/expdesign/primaries.cc b/src/expdesign/primaries.cc
index bebb923..c5e478f 100644
--- a/src/expdesign/primaries.cc
+++ b/src/expdesign/primaries.cc
@@ -369,11 +369,11 @@ enumerate_all_channels() const
}
-list<size_t>
+vector<size_t>
agh::CExpDesign::
used_samplerates( sigfile::SChannel::TType type) const
{
- list<size_t> recp;
+ vector<size_t> recp;
for ( auto &G : groups )
for ( auto &J : G.second )
for ( auto &D : J.measurements )
@@ -384,8 +384,8 @@ used_samplerates( sigfile::SChannel::TType type) const
type == F().signal_type(h) ) {
recp.push_back( F().samplerate(h));
}
- recp.sort();
- recp.unique();
+ sort(recp.begin(), recp.end());
+ unique(recp.begin(), recp.end());
return recp;
}
diff --git a/src/expdesign/primaries.hh b/src/expdesign/primaries.hh
index d90798a..6ab0dcd 100644
--- a/src/expdesign/primaries.hh
+++ b/src/expdesign/primaries.hh
@@ -381,7 +381,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::other) const;
+ vector<size_t> used_samplerates( sigfile::SChannel::TType type = sigfile::SChannel::other) const;
// omp-enabled lists:foreach
typedef function<void(CSubject&)>
diff --git a/src/ui/mw/measurements.cc b/src/ui/mw/measurements.cc
index 9a77170..566cd3a 100644
--- a/src/ui/mw/measurements.cc
+++ b/src/ui/mw/measurements.cc
@@ -46,9 +46,10 @@ aghui::SExpDesignUI::SSubjectPresentation::
draw_timeline( const char *fname) const
{
cairo_surface_t *cs =
- cairo_svg_surface_create( fname,
- timeline_width() + tl_left_margin() + tl_right_margin(),
- timeline_height());
+ cairo_svg_surface_create(
+ fname,
+ tl_width() + tl_left_margin() + tl_right_margin(),
+ tl_height());
cairo_t *cr = cairo_create( cs);
draw_timeline( cr);
cairo_destroy( cr);
@@ -62,16 +63,17 @@ draw_timeline( cairo_t *cr) const
{
bool have_episodes = cprofile && not cprofile->mm_list().empty();
- if ( not have_episodes ) {
- aghui::cairo_put_banner( cr, 400, timeline_height(), "(no episodes)", 24);
- }
+ if ( not have_episodes )
+ aghui::cairo_put_banner(
+ cr, 400, tl_height(), "(no episodes)", 24);
if ( have_episodes ) {
// day and night
{
cairo_pattern_t *cp =
- cairo_pattern_create_linear( tl_left_margin(), 0.,
- timeline_width() - tl_right_margin(), 0.);
+ cairo_pattern_create_linear(
+ tl_left_margin(), 0.,
+ tl_width() - tl_right_margin(), 0.);
struct tm clock_time;
memcpy( &clock_time, localtime( &_p._p.timeline_start), sizeof(clock_time));
clock_time.tm_hour = 4;
@@ -82,9 +84,11 @@ draw_timeline( cairo_t *cr) const
for ( t = dawn; t < timeline_end(); t += 3600 * 12, day = !day )
if ( t > timeline_start() )
_p._p.CwB[day ? TColour::mw_day : TColour::mw_night].
- pattern_add_color_stop_rgba( cp, (double)_p._p.T2P(t) / timeline_width());
+ pattern_add_color_stop_rgba(
+ cp, (double)_p._p.T2P(t) / tl_width());
cairo_set_source( cr, cp);
- cairo_rectangle( cr, tl_left_margin(), 0., tl_left_margin() + timeline_width(), timeline_height());
+ cairo_rectangle( cr, tl_left_margin(), 0.,
+ tl_left_margin() + tl_width(), tl_height());
cairo_fill( cr);
cairo_stroke( cr);
cairo_pattern_destroy( cp);
@@ -116,7 +120,7 @@ draw_timeline( cairo_t *cr) const
_p._p.CwB[TColour::mw_profile].set_source_rgba( cr);
cairo_set_line_width( cr, .3);
- cairo_move_to( cr, tl_left_margin() + j_tl_pixel_start, timeline_height()-12);
+ cairo_move_to( cr, tl_left_margin() + j_tl_pixel_start, tl_height()-12);
{
valarray<TFloat>
tmp (cprofile->timeline().size());
@@ -125,11 +129,12 @@ draw_timeline( cairo_t *cr) const
sigproc::smooth( tmp, _p._p.smooth_profile);
for ( size_t i = 0; i < tmp.size(); ++i )
if ( isfinite(tmp[i]) )
- cairo_line_to( cr,
- tl_left_margin() + j_tl_pixel_start + ((float)i)/tmp.size() * j_tl_pixels,
- -tmp[i] * scale + timeline_height()-12);
+ cairo_line_to(
+ cr,
+ tl_left_margin() + j_tl_pixel_start + ((float)i)/tmp.size() * j_tl_pixels,
+ -tmp[i] * scale + tl_height()-12);
}
- cairo_line_to( cr, j_tl_pixel_start + tl_left_margin() + j_tl_pixels, timeline_height()-12);
+ cairo_line_to( cr, j_tl_pixel_start + tl_left_margin() + j_tl_pixels, tl_height()-12);
cairo_fill( cr);
cairo_stroke( cr);
@@ -174,7 +179,7 @@ draw_timeline( cairo_t *cr) const
cairo_set_source( cr, cp);
cairo_rectangle( cr,
tl_left_margin() + e_pixel_start - fuzz, 0,
- e_pixels + fuzz*2, timeline_height());
+ e_pixels + fuzz*2, tl_height());
cairo_fill( cr);
cairo_stroke( cr);
cairo_pattern_destroy( cp);
@@ -191,23 +196,23 @@ draw_timeline( cairo_t *cr) const
cairo_set_line_width( cr, 4);
cairo_set_source_rgb( cr, 0., .1, .9);
- cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, timeline_height()-5);
+ cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height()-5);
cairo_rel_line_to( cr, pc_nrem, 0);
cairo_stroke( cr);
cairo_set_source_rgb( cr, .9, .0, .5);
- cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2 + pc_nrem, timeline_height()-5);
+ cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2 + pc_nrem, tl_height()-5);
cairo_rel_line_to( cr, pc_rem, 0);
cairo_stroke( cr);
cairo_set_source_rgb( cr, 0., .9, .1);
- cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2 + pc_nrem + pc_rem, timeline_height()-5);
+ cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2 + pc_nrem + pc_rem, tl_height()-5);
cairo_rel_line_to( cr, pc_wake, 0);
cairo_stroke( cr);
cairo_set_line_width( cr, 10);
cairo_set_source_rgba( cr, 1., 1., 1., .5);
- cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, timeline_height()-5);
+ cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height()-5);
cairo_rel_line_to( cr, pc_scored, 0);
cairo_stroke( cr);
@@ -218,7 +223,7 @@ draw_timeline( cairo_t *cr) const
agh::beersma::FUltradianCycle F (*M.uc_params);
snprintf_buf( "T: %g r: %g", F.T, F.r);
_p._p.CwB[TColour::mw_profile].set_source_rgba_contrasting( cr);
- cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, timeline_height() - 22);
+ cairo_move_to( cr, tl_left_margin() + e_pixel_start + 2, tl_height() - 22);
cairo_show_text( cr, __buf__);
cairo_stroke( cr);
@@ -226,13 +231,13 @@ draw_timeline( cairo_t *cr) const
cairo_set_line_width( cr, .5);
auto dxe = tl_left_margin() + e_pixel_start,
- dye = timeline_height() - 12;
- cairo_move_to( cr, dxe, dye - F(0.) * timeline_height()/2);
+ dye = tl_height() - 12;
+ cairo_move_to( cr, dxe, dye - F(0.) * tl_height()/2);
for ( size_t i = 0; i < M.total_pages(); ++i ) {
float t = i * M.pagesize() / 60.;
cairo_line_to( cr,
dxe + (t*60/M.F().recording_time()) * e_pixels,
- dye + -F(t) * timeline_height()/2);
+ dye + -F(t) * tl_height()/2);
}
cairo_stroke( cr);
}
@@ -252,18 +257,18 @@ draw_timeline( cairo_t *cr) const
clock_d = localtime(&t)->tm_mday;
if ( clock_h % 6 == 0 ) {
cairo_set_font_size( cr, (clock_h % 24 == 0) ? 10 : 8);
- cairo_move_to( cr, tl_left_margin() + x, ( clock_h % 24 == 0 ) ? 0 : (timeline_height() - 16));
- cairo_line_to( cr, tl_left_margin() + x, timeline_height() - 10);
+ cairo_move_to( cr, tl_left_margin() + x, (clock_h % 24 == 0) ? 0 : tl_height() - 16);
+ cairo_line_to( cr, tl_left_margin() + x, tl_height() - 10);
snprintf_buf_ts_h( (clock_d - clock_d0 + 1) * 24 + clock_h);
cairo_text_extents_t extents;
cairo_text_extents( cr, __buf__, &extents);
- cairo_move_to( cr, tl_left_margin() + x - extents.width/2, timeline_height()-1);
+ cairo_move_to( cr, tl_left_margin() + x - extents.width/2, tl_height()-1);
cairo_show_text( cr, __buf__);
} else {
- cairo_move_to( cr, tl_left_margin() + x, timeline_height() - 14);
- cairo_line_to( cr, tl_left_margin() + x, timeline_height() - 7);
+ cairo_move_to( cr, tl_left_margin() + x, tl_height() - 14);
+ cairo_line_to( cr, tl_left_margin() + x, tl_height() - 7);
}
}
cairo_stroke( cr);
diff --git a/src/ui/mw/mw.cc b/src/ui/mw/mw.cc
index ceb7ab5..39c441d 100644
--- a/src/ui/mw/mw.cc
+++ b/src/ui/mw/mw.cc
@@ -139,13 +139,14 @@ SExpDesignUI (aghui::SSessionChooser *parent,
finalize_ui (false),
suppress_redraw (false),
dl_pid (-1),
- only_plain_global_annotations (true),
close_this_SF_now (nullptr),
display_profile_type (metrics::TType::psd),
active_profile_psd_freq_from (2.),
active_profile_psd_freq_upto (3.),
active_profile_swu_f0 (.5),
active_profile_mc_f0 (.5),
+ only_plain_global_annotations (true),
+ strict_subject_id_checks (false),
uc_accuracy_factor (1.),
pagesize_item (2),
binsize_item (1),
@@ -164,8 +165,8 @@ SExpDesignUI (aghui::SSessionChooser *parent,
profile_scale_mc (0.),
autoscale (false),
smooth_profile (1),
- timeline_height (80),
- timeline_pph (30),
+ tl_height (80),
+ tl_pph (30),
sort_by (TSubjectSortBy::name),
sort_ascending (true),
sort_segregate (false),
@@ -183,8 +184,8 @@ SExpDesignUI (aghui::SSessionChooser *parent,
SValidator<int>("Common.Sort.Segregate", (int*)&sort_segregate, SValidator<int>::SVFRangeIn ( 0, 1)),
SValidator<int>("Measurements.DisplayProfileType", (int*)&display_profile_type, SValidator<int>::SVFRangeIn ( 0, 3)),
SValidator<int>("Measurements.SmoothSide", (int*)&smooth_profile, SValidator<int>::SVFRangeIn ( 1, 20)),
- SValidator<int>("Measurements.TimelineHeight", (int*)&timeline_height, SValidator<int>::SVFRangeIn (10, 600)),
- SValidator<int>("Measurements.TimelinePPH", (int*)&timeline_pph, SValidator<int>::SVFRangeIn (10, 600)),
+ SValidator<int>("Measurements.TimelineHeight", (int*)&tl_height, SValidator<int>::SVFRangeIn (10, 600)),
+ SValidator<int>("Measurements.TimelinePPH", (int*)&tl_pph, SValidator<int>::SVFRangeIn (10, 600)),
SValidator<int>("ScoringFacility.IntersignalSpace", (int*)&SScoringFacility::IntersignalSpace, SValidator<int>::SVFRangeIn (10, 800)),
SValidator<int>("ScoringFacility.HypnogramHeight", (int*)&SScoringFacility::HypnogramHeight, SValidator<int>::SVFRangeIn (10, 300)),
SValidator<int>("ModelRun.SWASmoothOver", (int*)&SModelrunFacility::swa_smoothover, SValidator<int>::SVFRangeIn ( 1, 5)),
@@ -253,8 +254,8 @@ SExpDesignUI (aghui::SSessionChooser *parent,
W_V1.reg( eBand[i][0], &freq_bands[i][0]);
W_V1.reg( eBand[i][1], &freq_bands[i][1]);
}
- W_V1.reg( eDAMsmtPPH, (int*)&timeline_pph);
- W_V1.reg( eDAMsmtTLHeight, (int*)&timeline_height);
+ W_V1.reg( eDAMsmtPPH, (int*)&tl_pph);
+ W_V1.reg( eDAMsmtTLHeight, (int*)&tl_height);
W_V1.reg( eDAPageHeight, (int*)&SScoringFacility::IntersignalSpace);
W_V1.reg( eDAHypnogramHeight, (int*)&SScoringFacility::HypnogramHeight);
W_V1.reg( eDAEMGHeight, (int*)&SScoringFacility::EMGProfileHeight);
@@ -526,7 +527,7 @@ calculate_profile_scale()
double value =
unlikely (valid_episodes == 0)
? 1.
- : timeline_height / valid_episodes / avg_profile_height * .3;
+ : tl_height / valid_episodes / avg_profile_height * .3;
switch ( display_profile_type ) {
case metrics::TType::psd:
diff --git a/src/ui/mw/mw.hh b/src/ui/mw/mw.hh
index 3aaa244..5e951b0 100644
--- a/src/ui/mw/mw.hh
+++ b/src/ui/mw/mw.hh
@@ -82,12 +82,12 @@ class SExpDesignUI
time_t tl_start,
admission_date;
- time_t timeline_start() const { return _p._p.timeline_start; }
- time_t timeline_end() const { return _p._p.timeline_end; }
- size_t timeline_width() const { return _p._p.timeline_width; }
- size_t timeline_height() const { return _p._p.timeline_height; }
- size_t tl_left_margin() const { return _p._p.tl_left_margin; }
- size_t tl_right_margin() const { return _p._p.tl_right_margin; }
+ time_t timeline_start() const { return _p._p.timeline_start; }
+ time_t timeline_end() const { return _p._p.timeline_end; }
+ size_t tl_width() const { return _p._p.tl_width; }
+ size_t tl_height() const { return _p._p.tl_height; }
+ size_t tl_left_margin() const { return _p._p.tl_left_margin; }
+ size_t tl_right_margin() const { return _p._p.tl_right_margin; }
void draw_timeline( cairo_t*) const;
void draw_timeline( const char *fname) const;
@@ -168,7 +168,7 @@ class SExpDesignUI
int try_download();
GPid dl_pid;
- // collected ED info
+ // collected emumerated inventory items, purely informational
// ED strings (channels, sessions, etc)
list<string>
AghDD, AghGG, AghEE;
@@ -186,7 +186,13 @@ class SExpDesignUI
int AghTi() const;
int AghDi() const;
- // collected full-path annotations
+ // samplerates
+ vector<size_t>
+ used_samplerates,
+ used_eeg_samplerates;
+
+ // inventory
+ // full-path annotations
struct SAnnotation
: public agh::CSubject::SEpisode::SAnnotation {
agh::CSubject& csubject;
@@ -200,17 +206,6 @@ class SExpDesignUI
};
forward_list<SAnnotation>
global_annotations;
- bool only_plain_global_annotations;
-
- // samplerates
- list<size_t>
- used_samplerates,
- used_eeg_samplerates;
-
- list<aghui::SScoringFacility*>
- open_scoring_facilities;
- aghui::SScoringFacility
- *close_this_SF_now;
// common artifact detection profiles
map<string, metrics::mc::SArtifactDetectionPP>
@@ -218,6 +213,12 @@ class SExpDesignUI
void load_artifact_detection_profiles();
void save_artifact_detection_profiles() const;
+ // currently open SF instances
+ list<aghui::SScoringFacility*>
+ open_scoring_facilities;
+ aghui::SScoringFacility
+ *close_this_SF_now;
+
// displayed profile selector
metrics::TType
display_profile_type;
@@ -233,13 +234,10 @@ class SExpDesignUI
agh::SProfileParamSet make_active_profile_paramset() const;
// own variables aka saved settings
- bool strict_subject_id_checks;
+ bool only_plain_global_annotations,
+ strict_subject_id_checks;
double uc_accuracy_factor;
- static const array<unsigned, 4>
- FFTPageSizeValues;
- static const array<double, 3>
- FFTBinSizeValues;
int pagesize_item,
binsize_item;
size_t figure_pagesize_item(); // from corresponding ED->fft_params.* fields
@@ -256,10 +254,9 @@ class SExpDesignUI
sigfile::CHypnogram::TCustomScoreCodes
ext_score_codes;
- static const char
- *const FreqBandNames[metrics::psd::TBand::TBand_total];
double freq_bands[metrics::psd::TBand::TBand_total][2];
+ // scales
double profile_scale_psd,
profile_scale_swu,
profile_scale_mc;
@@ -270,29 +267,30 @@ class SExpDesignUI
bool autoscale;
size_t smooth_profile;
- size_t timeline_height;
- size_t timeline_pph;
-
+ // timeline
time_t timeline_start,
timeline_end;
size_t T2P( time_t t) const
{
- return difftime( t, timeline_start) / 3600. * timeline_pph;
+ return difftime( t, timeline_start) / 3600. * tl_pph;
}
time_t P2T( int p) const
{
- return p * 3600. / timeline_pph + timeline_start;
+ return p * 3600. / tl_pph + timeline_start;
}
- size_t tl_left_margin,
+ size_t tl_height,
+ tl_width,
+ tl_left_margin,
tl_right_margin,
- timeline_width,
- timeline_pages;
+ tl_pages,
+ tl_pph;
- // config
+ // geometry
string _geometry_placeholder,
_aghdd_placeholder,
_aghtt_placeholder;
+ // sort
enum TSubjectSortBy {
name, age, admission_date,
avg_profile_power
@@ -302,8 +300,9 @@ class SExpDesignUI
sort_segregate;
void sort_subjects();
- size_t timeline_pph_saved,
- timeline_height_saved;
+ // _saved items
+ size_t tl_pph_saved,
+ tl_height_saved;
int pagesize_item_saved,
binsize_item_saved;
sigproc::TWinType
@@ -317,6 +316,8 @@ class SExpDesignUI
// fft_params_saved; // members not represented in widgets as is
metrics::mc::SPPack
mc_params_saved;
+
+ // bind fields to widgets
SUIVarCollection
W_V1,
W_V2, W_Vtunables;
@@ -359,6 +360,14 @@ class SExpDesignUI
void adjust_op_freq_spinbuttons();
void __reconnect_channels_combo();
void __reconnect_sessions_combo();
+
+ // static const bits
+ static const array<unsigned, 4>
+ FFTPageSizeValues;
+ static const array<double, 3>
+ FFTBinSizeValues;
+ static const char
+ *const FreqBandNames[metrics::psd::TBand::TBand_total];
};
diff --git a/src/ui/mw/populate.cc b/src/ui/mw/populate.cc
index aebd8c6..e61de85 100644
--- a/src/ui/mw/populate.cc
+++ b/src/ui/mw/populate.cc
@@ -418,8 +418,8 @@ populate_1()
timeline_start = earliest_start;
timeline_end = latest_end;
- timeline_width = (timeline_end - timeline_start) / 3600 * timeline_pph;
- timeline_pages = (timeline_end - timeline_start) / ED->fft_params.pagesize;
+ tl_width = (timeline_end - timeline_start) / 3600 * tl_pph;
+ tl_pages = (timeline_end - timeline_start) / ED->fft_params.pagesize;
printf( "SExpDesignUI::populate_1(): common timeline:\n");
fputs( asctime( localtime(&earliest_start)), stdout);
@@ -536,8 +536,8 @@ populate_1()
g_object_set( (GObject*)J.da,
"can-focus", TRUE,
"app-paintable", TRUE,
- "height-request", timeline_height,
- "width-request", timeline_width + tl_left_margin + tl_right_margin,
+ "height-request", tl_height,
+ "width-request", tl_width + tl_left_margin + tl_right_margin,
NULL);
snprintf_buf( "<small>%zusec/%gHz/%s</small>",
diff --git a/src/ui/mw/settings_cb.cc b/src/ui/mw/settings_cb.cc
index 4099b53..404f75b 100644
--- a/src/ui/mw/settings_cb.cc
+++ b/src/ui/mw/settings_cb.cc
@@ -77,14 +77,14 @@ tDesign_switch_page_cb(
!ED.ED->mc_params.same_as( ED.mc_params_saved) ) {
// rescan tree
ED.do_rescan_tree(); // with populate
- } else if ( ED.timeline_height_saved != ED.timeline_height ||
+ } else if ( ED.tl_height_saved != ED.tl_height ||
// recalculte mesurements layout as necessary
- ED.timeline_pph_saved != ED.timeline_pph )
+ ED.tl_pph_saved != ED.tl_pph )
ED.populate_1();
} else {
- ED.timeline_pph_saved = ED.timeline_pph;
- ED.timeline_height_saved = ED.timeline_height;
+ ED.tl_pph_saved = ED.tl_pph;
+ ED.tl_height_saved = ED.tl_height;
ED.pagesize_item_saved = ED.pagesize_item;
ED.binsize_item_saved = ED.binsize_item;
ED.fft_params_welch_window_type_saved = ED.ED->fft_params.welch_window_type;
diff --git a/src/ui/sf/d/patterns_cb.cc b/src/ui/sf/d/patterns_cb.cc
index c2821e2..723dec0 100644
--- a/src/ui/sf/d/patterns_cb.cc
+++ b/src/ui/sf/d/patterns_cb.cc
@@ -252,7 +252,7 @@ bSFFDSearch_clicked_cb(
FD.search();
FD.save_annotations();
- FD.set_field_da_width( SF.total_pages() * SF.pagesize() / 3600 * SF._p.timeline_pph);
+ FD.set_field_da_width( SF.total_pages() * SF.pagesize() / 3600 * SF._p.tl_pph);
FD.field_display_scale =
agh::alg::calibrate_display_scale(
--
Sleep experiment manager
More information about the debian-med-commit
mailing list