PolnCalibratorExtension.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2003-2009 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Base/Extensions/Pulsar/PolnCalibratorExtension.h
10 
11 #ifndef __PolnCalibratorExtension_h
12 #define __PolnCalibratorExtension_h
13 
14 #include "Pulsar/CalibratorExtension.h"
15 
16 namespace Pulsar {
17 
18  class PolnCalibrator;
19 
21 
23  class PolnCalibratorExtension : public CalibratorExtension {
24 
25  public:
26 
29 
32 
35 
38 
41  { return new PolnCalibratorExtension( *this ); }
42 
45 
46  // Text interface to a PolnCalibratorExtension instance
47  class Interface : public TextInterface::To<PolnCalibratorExtension>
48  {
49  public:
50  Interface( PolnCalibratorExtension *s_instance = NULL );
51  };
52 
55 
57  std::string get_short_name () const { return "pcal"; }
58 
60  void set_type (const Calibrator::Type* type);
61 
63  void set_nchan (unsigned nchan);
64 
66  void remove_chan (unsigned first, unsigned last);
67 
69  void set_weight (unsigned ichan, float weight);
71  float get_weight (unsigned ichan) const;
72 
74  unsigned get_nparam () const;
75 
77  bool get_has_covariance () const;
79  void set_has_covariance (bool);
80 
82  bool get_has_solver () const;
84  void set_has_solver (bool);
85 
87  bool get_valid (unsigned ichan) const;
88  void set_valid (unsigned ichan, bool valid);
89 
90  class Transformation;
91 
93  Transformation* get_transformation (unsigned c);
95  const Transformation* get_transformation (unsigned c) const;
96 
98  void frequency_append (Archive* to, const Archive* from);
99 
100  void fscrunch (unsigned factor = 0);
101  void fscrunch_to_nchan (unsigned new_nchan);
102 
103  Estimate<float> get_Estimate ( unsigned iparam, unsigned ichan ) const;
104  void set_Estimate (unsigned iparam, unsigned ichan, const Estimate<float>&);
105 
106  protected:
107 
109  std::vector<Transformation> response;
110 
112  unsigned nparam;
113 
115  bool has_covariance;
116 
118  bool has_solver;
119 
121  void construct ();
122 
123  private:
124 
125  void init ();
126 
127  };
128 
131  {
132  public:
133 
136 
138  unsigned get_nparam() const;
140  void set_nparam (unsigned);
141 
143  std::string get_param_name (unsigned) const;
145  void set_param_name (unsigned, const std::string&);
146 
148  std::string get_param_description (unsigned) const;
150  void set_param_description (unsigned, const std::string&);
151 
153  double get_param (unsigned) const;
155  void set_param (unsigned, double);
156 
158  double get_variance (unsigned) const;
160  void set_variance (unsigned, double);
161 
163  std::vector< std::vector<double> > get_covariance () const;
165  void set_covariance (const std::vector< std::vector<double> >&);
166 
168  void get_covariance (std::vector<double>&) const;
170  void set_covariance (const std::vector<double>&);
171 
173  Estimate<double> get_Estimate (unsigned) const;
175  void set_Estimate (unsigned, const Estimate<double>&);
176 
178  bool get_valid () const;
180  void set_valid (bool);
181 
183  double get_chisq () const;
185  void set_chisq (double);
186 
188  unsigned get_nfree() const;
190  void set_nfree (unsigned);
191 
193  unsigned get_nfit() const;
195  void set_nfit (unsigned);
196 
198  double get_reduced_chisq () const;
199 
200  // Text interface to a PolnCalibratorExtension instance
201  class Interface : public TextInterface::To<Transformation>
202  {
203  public:
204  Interface();
205  };
206 
207  protected:
208 
209  std::vector< Estimate<double> > params;
210  std::vector< std::string > names;
211  std::vector< std::string > descriptions;
212 
213  std::vector<double> covariance;
214  double chisq;
215  unsigned nfree;
216  unsigned nfit;
217  bool valid;
218 
219  };
220 
221 }
222 
223 #endif
double get_param(unsigned) const
Get the value of the specified model parameter.
Definition: PolnCalibratorExtension.C:285
std::string get_param_description(unsigned) const
Get the description of the specified model parameter.
Definition: PolnCalibratorExtension.C:263
void frequency_append(Archive *to, const Archive *from)
Append PolnCalibrator Extension data from another Archive.
Definition: PolnCalibratorExtension.C:201
bool get_has_solver() const
Get if the covariances of the transformation parameters.
Definition: PolnCalibratorExtension.C:144
unsigned get_nparam() const
Get the number of parameters describing each transformation.
Definition: PolnCalibratorExtension.C:128
void range_check(unsigned ichan, const char *method) const
Ensure that ichan < get_nchan.
Definition: CalibratorExtension.C:113
Transformation * get_transformation(unsigned c)
Get the transformation for the specified frequency channel.
Definition: PolnCalibratorExtension.C:157
unsigned get_nparam() const
void fscrunch(unsigned factor=0)
Definition: PolnCalExtFreqIntegrate.C:133
void remove_chan(unsigned first, unsigned last)
Remove the inclusive range of channels.
Definition: PolnCalibratorExtension.C:87
unsigned get_nparam() const
Get the number of model parameters.
Definition: PolnCalibratorExtension.C:241
virtual const Calibrator::Type * get_type() const
Get the type of the calibrator.
Definition: CalibratorExtension.C:53
virtual void set_nchan(unsigned nchan)
Set the number of frequency channels.
Definition: CalibratorExtension.C:70
void set_type(const Calibrator::Type *type)
Set the type of the instrumental response parameterization.
Definition: PolnCalibratorExtension.C:72
float get_weight(unsigned ichan) const
Get the weight of the specified channel.
Definition: PolnCalibratorExtension.C:100
The primary interface to pulsar observational data.
Definition: Archive.h:45
~PolnCalibratorExtension()
Destructor.
Definition: PolnCalibratorExtension.C:67
double get_variance(unsigned) const
Get the variance of the specified model parameter.
Definition: PolnCalibratorExtension.C:297
bool has_covariance
The covariances of the transformation parameters are available.
Definition: PolnCalibratorExtension.h:120
TextInterface::Parser * get_interface()
get the text ineterface
Definition: PolnCalibratorExtension.C:472
double get_reduced_chisq() const
Get the best fit value of the reduced chi squared = chisq/nfree.
Definition: PolnCalibratorExtension.C:361
void construct()
Construct the response array according to the current attributes.
Definition: PolnCalibratorExtension.C:188
void set_weight(unsigned ichan, float weight)
Set the weight of the specified channel.
Definition: PolnCalibratorExtension.C:94
const ExtensionType * get() const
Template method searches for an Extension of the specified type.
void set_nparam(unsigned)
Set the number of model parameters.
Definition: PolnCalibratorExtension.C:277
void set_param_name(unsigned, const std::string &)
Set the name of the specified model parameter.
Definition: PolnCalibratorExtension.C:255
void set_param_description(unsigned, const std::string &)
Set the description of the specified model parameter.
Definition: PolnCalibratorExtension.C:272
unsigned get_nparam_infit() const
void set_nchan(unsigned nchan)
Set the number of frequency channels.
Definition: PolnCalibratorExtension.C:80
void set_has_solver(bool)
Set if the covariances of the transformation parameters.
Definition: PolnCalibratorExtension.C:150
virtual void remove_chan(unsigned first, unsigned last)
Remove the inclusive range of channels.
Definition: CalibratorExtension.C:76
std::vector< Transformation > response
The instrumental response as a function of frequency.
Definition: PolnCalibratorExtension.h:114
PolnCalibratorExtension * clone() const
Clone method.
Definition: PolnCalibratorExtension.h:45
void set_param(unsigned, double)
Set the value of the specified model parameter.
Definition: PolnCalibratorExtension.C:291
Estimate< double > get_Estimate(unsigned) const
Get the value and variance of the specified model parameter.
Definition: PolnCalibratorExtension.C:310
void set_nfree(unsigned)
Set the number of degress of freedom.
Definition: PolnCalibratorExtension.C:346
Reference::To< const Calibrator::Type > type
Type of the calibrator.
Definition: CalibratorExtension.h:97
Stores PolnCalibrator parameters in an Archive instance.
Definition: PolnCalibratorExtension.h:28
std::string get_param_name(unsigned) const
Get the name of the specified model parameter.
Definition: PolnCalibratorExtension.C:248
void set_nfit(unsigned)
Set the number of model parameters varied to find best fit.
Definition: PolnCalibratorExtension.C:356
bool get_has_covariance() const
Get if the covariances of the transformation parameters.
Definition: PolnCalibratorExtension.C:133
unsigned get_nfit() const
Get the number of model parameters varied to find best fit.
Definition: PolnCalibratorExtension.C:351
std::string get_param_description(unsigned index) const
Definition: CalibratorType.h:30
unsigned get_nfree() const
Get the number of degrees of freedom.
Definition: PolnCalibratorExtension.C:341
virtual std::string get_name() const=0
virtual std::string get_name() const
Return the name of the calibrator type.
Definition: CalibratorType.h:46
unsigned nparam
The number of parameters that describe the transformation.
Definition: PolnCalibratorExtension.h:117
std::string get_param_name(unsigned index) const
void set_covariance(const std::vector< std::vector< double > > &)
Set the covariance matrix of the model paramters.
Definition: PolnCalibratorExtension.C:399
bool get_valid() const
Get the model validity flag.
Definition: PolnCalibratorExtension.C:321
bool get_valid(unsigned ichan) const
Return true if the transformation for the specified channel is valid.
Definition: PolnCalibratorExtension.C:110
MEAL::Complex2 * new_transformation(const PolnCalibratorExtension *, unsigned ichan)
Create a new transformation instance described by the extension.
Definition: PolnCalibratorExt.C:126
void frequency_append(Archive *to, const Archive *from)
Append Calibrator Extension data from another Archive.
Definition: CalibratorExtension.C:121
Stores Calibrator parameters in an Archive.
Definition: CalibratorExtension.h:27
Polarimetric calibrators.
Definition: PolnCalibrator.h:41
double get_chisq() const
Get the best fit value of chi squared.
Definition: PolnCalibratorExtension.C:331
bool in_frequency_order(const Archive *A, const Archive *B)
Return true if A precedes B in frequency order of channels.
Definition: Archive.C:364
static unsigned verbose
A verbosity flag that can be set for debugging purposes.
Definition: IntegrationManager.h:38
void set_Estimate(unsigned, const Estimate< double > &)
Set the value and variance of the specified model parameter.
Definition: PolnCalibratorExtension.C:316
std::vector< std::vector< double > > get_covariance() const
Get the covariance matrix of the model paramters.
Definition: PolnCalibratorExtension.C:371
std::string get_short_name() const
Return a short name.
Definition: PolnCalibratorExtension.h:62
bool has_solver
The solver statistics are available.
Definition: PolnCalibratorExtension.h:123
float get_chisq() const
Defines the PSRCHIVE library.
Definition: CalSource.h:17
void set_variance(unsigned, double)
Set the variance of the specified model parameter.
Definition: PolnCalibratorExtension.C:304
std::vector< float > weight
The weight of each channel.
Definition: CalibratorExtension.h:103
PolnCalibratorExtension()
Default constructor.
Definition: PolnCalibratorExtension.C:19
void set_chisq(double)
Set the best fit value of chi squared.
Definition: PolnCalibratorExtension.C:336
Transformation()
Default constructor.
Definition: PolnCalibratorExtension.C:232
unsigned get_nfree() const
void set_has_covariance(bool)
Set if the covariances of the transformation parameters.
Definition: PolnCalibratorExtension.C:138
void set_valid(bool)
Set the model validity flag.
Definition: PolnCalibratorExtension.C:326
void set_infit(unsigned index, bool flag)
const PolnCalibratorExtension & operator=(const PolnCalibratorExtension &)
Operator =.
Definition: PolnCalibratorExtension.C:43
Intermediate storage of MEAL::Complex parameters.
Definition: PolnCalibratorExtension.h:135

Generated using doxygen 1.8.17