Skip to content
Snippets Groups Projects
Commit fa2476ed authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

cv-auxiliary-parameters are per-file

parent 844fbe63
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,24 @@ using namespace std;
#include "../../code/lmfit/lmmin.h"
#include "xax.h"
//! local functions (wouldn't suffice "static" ??)
namespace NCurveFile
{
void IntegrateFile(
const COlc *fin, const int k, const string& mode,
const int ip, const string& name, const CCoord& ico );
double NumericIntegral(
const COlc *fc, const CCurve *c, const int k, const int j,
const double low, const double hig );
// parameters for numeric integration:
double numint_bound_low=-INFINITY, numint_bound_hig=INFINITY;
// tuning parameters:
int numint_mode=4;
int numint_cvmode=-1;
double numint_epsabs=1e-10, numint_epsrel=1e-10;
};
//***************************************************************************//
//* generic operations on curves *//
......@@ -63,7 +81,7 @@ int CCurve::Load(FILE *fd, uint nz)
//! Create curve files.
void NCurveFile::Create( bool refers_to_data, bool with_convolution )
void NCurveFile::Create( bool refers_to_data )
{
static int default_no=0;
......@@ -87,6 +105,9 @@ void NCurveFile::Create( bool refers_to_data, bool with_convolution )
f.weight_y_log = false;
f.expr = expr;
f.T = T;
f.cv_intmod = NCurveFile::numint_cvmode;
f.cv_epsabs = NCurveFile::numint_epsabs;
f.cv_epsrel = NCurveFile::numint_epsrel;
vector<double> P( np, 1.0 );
// use f to create output file(s)
......@@ -249,7 +270,7 @@ void NCurveFile::SetFixed(string how)
}
//! Set convolution
//! Set convolution.
void NCurveFile::SetConvolution( bool onoff )
{
......@@ -266,6 +287,21 @@ void NCurveFile::SetConvolution( bool onoff )
fc->kconv = k;
}
//! Set auxiliary parameters for numeric convolution.
void NCurveFile::SetConvEps()
{
static double epsabs = 1e-10, epsrel = 1e-10;
epsrel = dask( "Eps rel for convolution", epsrel );
epsabs = dask( "Eps abs for convolution", epsabs );
COlc *fc;
NOlm::IterateC fiter;
while ( (fc=fiter()) ) {
fc->cv_epsabs = epsabs;
fc->cv_epsrel = epsrel;
}
}
//! Set auxiliary parameters (weighing, ..).
void NCurveFile::SetProperties(string which)
......@@ -524,25 +560,6 @@ double myeval( double x, void* data )
}
//! local functions (wouldn't suffice "static" ??)
namespace NCurveFile
{
void IntegrateFile(
const COlc *fin, const int k, const string& mode,
const int ip, const string& name, const CCoord& ico );
double NumericIntegral(
const COlc *fc, const CCurve *c, const int k, const int j,
const double low, const double hig );
// parameters for numeric integration:
double numint_bound_low=-INFINITY, numint_bound_hig=INFINITY;
// tuning parameters:
int numint_mode=4;
int numint_cvmode=-1;
double numint_epsabs=1e-10, numint_epsrel=1e-10;
};
//! display or change tuning parameters for numeric integration
void NCurveFile::SetIntTuningPars( string which )
......
......@@ -19,7 +19,7 @@ class CCurve {
//! NCurFil holds operations on curve files
namespace NCurveFile {
void Create( bool refers_to_data, bool with_convolution );
void Create( bool refers_to_data );
void SetConvolution( bool onoff );
......
......@@ -98,7 +98,6 @@ int main()
} else if (cmd == "c") {
cout << "Curves:\n"
" cc create\n"
" ccv create (with convolution)\n"
" cca create artificial curve (no data reference)\n"
"Basic operations:\n"
" cv set file to convolute with (cv-: no convolution)\n"
......@@ -112,24 +111,26 @@ int main()
"Special operations:\n"
" c_cd calculate cumulative probability distribution\n"
"Fit tuning parameters:\n"
" cs show parameters\n"
" cs? show parameters\n"
" csf set gradient step factor\n"
" cse set sqrt of differentiation step\n"
" csc set number of calls\n"
" csp set print frequency\n"
" csm set fit metric\n"
"Numeric integration tuning parameters:\n"
" cn show parameters\n"
"Tuning parameters for integration:\n"
" cn? show parameters\n"
" cnm set integration mode\n"
" cnv set convolution mode\n"
" cna set eps abs\n"
" cnr set eps rel\n";
" cnr set eps rel\n"
"Tuning parameters for convolution:\n"
" cv? show parameters\n"
" cvm set integration mode\n"
" cva set eps abs\n"
" cvr set eps rel\n";
} else if (cmd == "cc") {
NCurveFile::Create( true, false );
} else if (cmd == "ccv") {
NCurveFile::Create( true, true );
NCurveFile::Create( true );
} else if (cmd == "cca") {
NCurveFile::Create( false, false );
NCurveFile::Create( false );
} else if (cmd == "cv") {
NCurveFile::SetConvolution( true );
......@@ -153,16 +154,14 @@ int main()
} else if (cmd == "c_cd") {
NCurveFile::CumulativeDistribution();
} else if (cmd == "cs") {
NCurveFile::SetFitTuningPars("?");
} else if (cmd.substr(0,2) == "cs") {
NCurveFile::SetFitTuningPars(cmd.substr(2));
} else if (cmd == "cn") {
NCurveFile::SetIntTuningPars("?");
} else if (cmd.substr(0,2) == "cn") {
NCurveFile::SetIntTuningPars(cmd.substr(2));
} else if (cmd.substr(0,2) == "cv") {
NCurveFile::SetConvTuningPars(cmd.substr(2));
} else if ( cmd == "d" ) {
cout << "Show directory:\n"
......
......@@ -49,6 +49,9 @@ class COlc : public COlo { // on-line curves
vector<CCurve> VC;
bool weight_y_log;
uint kconv;
uint cv_intmod;
double cv_epsabs;
double cv_epsrel;
inline COlc() : weight_y_log(false), kconv(-1) { ; };
inline uint nScan(void) const { return VC.size(); };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment