ComplexRVM.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2009 - 2021 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/MEAL/MEAL/ComplexRVM.h
10 
11 #ifndef __ComplexRVM_H
12 #define __ComplexRVM_H
13 
14 #include "MEAL/Complex.h"
15 #include "MEAL/ProductRule.h"
16 
17 namespace MEAL {
18 
19  template<typename> class VectorRule;
20 
21  class RVM;
22  class Scalar;
23 
25  class ComplexRVM : public ProductRule<Complex>
26  {
27 
28  public:
29 
31  ComplexRVM ();
32 
34  ComplexRVM (const ComplexRVM& copy);
35 
38 
40  ~ComplexRVM ();
41 
43  RVM* get_rvm ();
44  void set_rvm (RVM*);
45 
47  void add_state (double phase, std::complex< Estimate<double> >& L);
49  void set_state (unsigned i);
50 
52  unsigned get_nstate () const;
53 
55  void set_phase (unsigned i, double phase);
57  double get_phase (unsigned i) const;
58 
60  void set_linear (unsigned i, const Estimate<double>& L);
62  Estimate<double> get_linear (unsigned i) const;
63 
64 #if 0
65  void renormalize (double renorm);
67 #endif
68 
70  void set_gains_infit (bool flag=true);
71 
73  void set_gains_maximum_likelihood (bool flag=true);
74  bool get_gains_maximum_likelihood () const { return gains_maximum_likelihood; }
75 
76  // ///////////////////////////////////////////////////////////////////
77  //
78  // Function implementation
79  //
80  // ///////////////////////////////////////////////////////////////////
81 
83  std::string get_name () const;
84 
85  private:
86 
88 
89  Reference::To<Scalar> modelQ;
90  Reference::To<Scalar> modelU;
91 
94 
96  bool gains_maximum_likelihood;
97 
98  class State;
99  std::vector<State> state;
100 
101  class MaximumLikelihoodGain;
102 
103  void check (unsigned i, const char* method) const;
104  void init ();
105  };
106 
107 }
108 
109 #endif
unsigned get_nstate() const
Get the number of states.
Definition: ComplexRVM.C:183
void set_state(unsigned i)
Set the current state for which the model will be evaluated.
Definition: ComplexRVM.C:189
Rotating Vector Model of Stokes Q and U as a function of pulse phase.
Definition: ComplexRVM.h:30
void set_gains_maximum_likelihood(bool flag=true)
Replace gains with maximum likelihood estimators.
Definition: ComplexRVM.C:252
const ScalarMath abs(const ScalarMath &x)
Return a ScalarMath instance representing |x|.
Definition: ScalarMath.C:208
void add_state(double phase, std::complex< Estimate< double > > &L)
Add a state: phase in radians, L is measured linear polarization.
Definition: ComplexRVM.C:159
ComplexRVM & operator=(const ComplexRVM &copy)
Assignment operator.
Definition: ComplexRVM.C:136
Namespace in which all modeling and calibration related code is declared.
Definition: ExampleComplex2.h:16
void set_phase(unsigned i, double phase)
Set the phase of the ith state.
Definition: ComplexRVM.C:197
void set_linear(unsigned i, const Estimate< double > &L)
Set the linear polarization of the ith state.
Definition: ComplexRVM.C:211
void set_gains_infit(bool flag=true)
Set the fit flag of every gain parameter.
Definition: ComplexRVM.C:243
~ComplexRVM()
Destructor.
Definition: ComplexRVM.C:142
Estimate< double > get_linear(unsigned i) const
Get the linear polarization of the ith state.
Definition: ComplexRVM.C:227
Base class of different Rotating Vector Model parameterizations.
Definition: RVM.h:28
ComplexRVM()
Default constructor.
Definition: ComplexRVM.C:121
virtual void copy(const Function *model)
Does the work for operator =.
Definition: Function.C:58
std::string get_name() const
Return the name of the class.
Definition: ComplexRVM.C:147
double get_phase(unsigned i) const
Get the phase of the ith state.
Definition: ComplexRVM.C:204
RVM * get_rvm()
Return the rotating vector model.
Definition: ComplexRVM.C:153
A gain transformation.
Definition: Gain.h:27

Generated using doxygen 1.8.17