ReceptionModelSolver.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2004 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/Polarimetry/Pulsar/ReceptionModelSolver.h
10 
11 #ifndef __ReceptionModelSolver_H
12 #define __ReceptionModelSolver_H
13 
14 #include "Pulsar/ReceptionModel.h"
15 #include "MEAL/LeastSquares.h"
16 #include <fstream>
17 
18 namespace Calibration
19 {
22  {
23 
24  public:
25 
26  Solver () { verbose = 0; }
27 
29  static bool report_chisq;
30 
32  virtual Solver* clone () const = 0;
33 
36 
39 
42 
44  virtual void solve ();
45 
47  void set_verbosity (unsigned level) { verbose = level; }
48  unsigned get_verbosity () const { return verbose; }
49 
50  protected:
51 
53  virtual void fit () = 0;
54 
56  std::vector< Functor< bool(ReceptionModel*) > > convergence_condition;
57 
59  std::vector< Functor< bool(ReceptionModel*) > > acceptance_condition;
60 
62  std::string prefit_report_filename;
63 
65  void count_infit ();
66 
68  void count_constraint ();
69 
70  void check_constraints ();
71  void set_variances ();
72  void check_solution ();
73 
76 
78  std::vector<CoherencyMeasurementSet>& get_data ();
79 
81  unsigned verbose;
82 
83  private:
84 
86  std::vector<bool> state_observed;
87 
89  std::vector<bool> path_observed;
90  };
91 
92 }
93 
94 #endif
95 
void add_acceptance_condition(Functor< bool(ReceptionModel *) >)
Add an acceptance condition.
Definition: ReceptionModelSolver.C:264
void covariance(Scalar *function, unsigned index, std::vector< unsigned > &imap, std::vector< std::vector< double > > &covar)
std::string prefit_report_filename
Filename to which a pre-fit report will be written.
Definition: ReceptionModelSolver.h:72
std::vector< CoherencyMeasurementSet > & get_data()
The observations used to constrain the measurement equations.
Definition: ReceptionModelSolver.C:250
void set_equation(ReceptionModel *)
Set the measurement equation to be solved.
Definition: ReceptionModelSolver.C:269
void count_infit()
Count the number of parameters to be fit.
Definition: ReceptionModelSolver.C:21
virtual Solver * clone() const =0
Return a new, copy-constructed clone.
unsigned get_nparam() const
virtual void solve()
Solve the measurement equations by least squares minimization.
Definition: ReceptionModelSolver.C:143
static bool report_chisq
report the reduced chisq on completion
Definition: ReceptionModelSolver.h:39
std::vector< Functor< bool(ReceptionModel *) > > convergence_condition
Additional convergence conditions.
Definition: ReceptionModelSolver.h:66
Models a set of transformations and source polarizations.
Definition: ReceptionModel.h:32
Solve the measurement equation by non-linear least squares minimization.
Definition: ReceptionModelSolver.h:26
void count_constraint()
Count the total number of constraints (one-dimensional data)
Definition: ReceptionModelSolver.C:38
std::vector< Functor< bool(ReceptionModel *) > > acceptance_condition
Additional acceptance conditions.
Definition: ReceptionModelSolver.h:69
friend class Solver
Provide Solver class with acces to data.
Definition: ReceptionModel.h:128
bool get_infit(unsigned index) const
virtual void fit()=0
The fit is performed by derived classes.
unsigned verbose
Verbosity level.
Definition: ReceptionModelSolver.h:91
Reference::To< ReceptionModel, false > equation
The measurement equation to be solved.
Definition: ReceptionModelSolver.h:85
void set_verbosity(unsigned level)
Set the verbosity level (0 = quiet, 3 = most verbose)
Definition: ReceptionModelSolver.h:57
void add_convergence_condition(Functor< bool(ReceptionModel *) >)
Add a convergence condition.
Definition: ReceptionModelSolver.C:257

Generated using doxygen 1.8.17