From 8aaba3f90bab9da878e9c0fc8490ed77c9d85736 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (laptop)" <j.wuttke@fz-juelich.de> Date: Fri, 7 May 2010 21:22:55 +0200 Subject: [PATCH] preparing for weighing with rec. var. --- pub/src/curve.cpp | 14 ++++++++------ pub/src/frida2.cpp | 11 +++++------ pub/src/olf.h | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/pub/src/curve.cpp b/pub/src/curve.cpp index f88f8294..03974560 100644 --- a/pub/src/curve.cpp +++ b/pub/src/curve.cpp @@ -365,15 +365,17 @@ void NCurveFile::SetConvTuningPars( string which ) //! Set auxiliary parameters (weighing, ..). -void NCurveFile::SetProperties(string which) +void NCurveFile::SetProperties( string which ) { NOlm::IterateC fiter; POlc fc; - while((fc=fiter())) { - if (which=="yli") - fc->weight_y_log = false; - else if (which=="ylg") - fc->weight_y_log = true; + while ( (fc=fiter()) ) { + if (which=="cwc") + fc->weighing = COlc::_LIN; + else if (which=="cwl") + fc->weighing = COlc::_LOG; + else if (which=="cwv") + fc->weighing = COlc::_ERR; else { printf("! unknown property"); return; diff --git a/pub/src/frida2.cpp b/pub/src/frida2.cpp index 681e414b..198fab83 100644 --- a/pub/src/frida2.cpp +++ b/pub/src/frida2.cpp @@ -151,8 +151,9 @@ int main() " cf fit\n" " cfs fit, allow slow convolution\n" " cx toggle fixed (also: cx+ cx-)\n" - " cyli weight y lin\n" - " cylg weight y log\n" + " cwc weighing: constant\n" + " cwl weighing: logarithmic\n" + " cwv weighing: reciprocal variance (default)\n" "Fit tuning parameters:\n" " cs? show parameters\n" " csf set gradient step factor\n" @@ -195,10 +196,8 @@ int main() NCurveFile::Fit( true ); } else if (cmd == "cx") { NCurveFile::SetFixed(); - } else if (cmd == "cyli") { - NCurveFile::SetProperties("yli"); - } else if (cmd == "cylg") { - NCurveFile::SetProperties("ylg"); + } else if (cmd.substr(0,2) == "cw") { + NCurveFile::SetProperties( cmd.substr(1) ); } else if (cmd == "c_cd") { NCurveFile::CumulativeDistribution(); diff --git a/pub/src/olf.h b/pub/src/olf.h index 638668cd..7256b7e3 100644 --- a/pub/src/olf.h +++ b/pub/src/olf.h @@ -81,14 +81,14 @@ class COlc : public COlo { // online state records: boost::shared_ptr<class CTree> T; vector<CList> Fixed; - bool weight_y_log; + enum TWgt { _LIN, _LOG, _ERR } weighing; uint kd; // internal number of data file to be fitted uint kconv; uint cv_intmod; double cv_epsabs; double cv_epsrel; - COlc() : weight_y_log(false), kconv(-1) { ; }; + COlc() : weighing( _ERR ), kconv(-1) { ; }; // trivially duplicated functions: PCurve VC( uint j ) const; -- GitLab