CalibrationInterpolatorExtension.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2022 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Base/Extensions/Pulsar/CalibrationInterpolatorExtension.h
10 
11 #ifndef __CalibrationInterpolatorExtension_h
12 #define __CalibrationInterpolatorExtension_h
13 
14 #include "Pulsar/ArchiveExtension.h"
15 #include "Pulsar/CalibratorType.h"
16 #include "Pulsar/CalibratorStokes.h"
17 
18 namespace Pulsar {
19 
21 
24  class CalibrationInterpolatorExtension : public Archive::Extension
25  {
26  public:
27 
30  (const char* name = "CalibrationInterpolatorExtension");
31 
34 
38 
41 
44  { return new CalibrationInterpolatorExtension( *this ); }
45 
47  bool has_data () const;
48 
50  void set_type (const Calibrator::Type* t);// { type = t; }
52  const Calibrator::Type* get_type () const;// { return type; }
53 
56  { coupling_point = point; }
57 
60  { return coupling_point; }
61 
63  void set_nreceptor (unsigned n) { nreceptor = n; }
65  unsigned get_nreceptor () const { return nreceptor; }
66 
68  bool get_native_scale () const { return native_scale; }
69  void set_native_scale (bool flag) { native_scale = flag; }
70 
72  unsigned get_nsub_input () const { return nsub_input; }
73  void set_nsub_input (unsigned n) { nsub_input = n; }
74 
76  void set_reference_epoch (const MJD& epoch) { reference_epoch = epoch; }
79 
81  void set_minimum_epoch (const MJD& epoch) { minimum_epoch = epoch; }
83  MJD get_minimum_epoch () const { return minimum_epoch; }
84 
86  void set_maximum_epoch (const MJD& epoch) { maximum_epoch = epoch; }
88  MJD get_maximum_epoch () const { return maximum_epoch; }
89 
91  unsigned get_nchan_input () const { return nchan_input; }
92  void set_nchan_input (unsigned n) { nchan_input = n; }
93 
95  void set_reference_frequency (double freq) { reference_frequency = freq; }
97  double get_reference_frequency () const { return reference_frequency; }
98 
100  void set_minimum_frequency (double freq) { minimum_frequency = freq; }
102  double get_minimum_frequency () const { return minimum_frequency; }
103 
105  void set_maximum_frequency (double freq) { maximum_frequency = freq; }
107  double get_maximum_frequency () const { return maximum_frequency; }
108 
110  std::string get_short_name () const { return "pcmint"; }
111 
113  class Interface
114  : public TextInterface::To<CalibrationInterpolatorExtension>
115  {
116  public:
118  };
119 
122 
123  class Parameter : public Reference::Able
124  {
125  public:
126 
128  class Interface
129  : public TextInterface::To<Parameter>
130  {
131  public:
132  Interface (Parameter* = 0);
133  };
134 
136  enum Type
137  {
138  FrontendParameter = 1,
139  CalibratorStokesParameter = 2,
140  FluxCalibratorParameter = 3
141  };
142 
143  Type code;
144  Type get_code () const { return code; }
145 
146  unsigned iparam;
147  unsigned get_iparam () const { return iparam; }
148 
149  float log10_smoothing_factor;
150  float get_log10_smoothing_factor () const { return log10_smoothing_factor; }
151  float total_chi_squared;
152  float get_total_chi_squared () const { return total_chi_squared; }
153 
154  unsigned ndat_input;
155  unsigned get_ndat_input () const { return ndat_input; }
156 
157  unsigned ndat_flagged_before;
158  unsigned get_ndat_flagged_before () const { return ndat_flagged_before; }
159 
160  unsigned ndat_flagged_after;
161  unsigned get_ndat_flagged_after () const { return ndat_flagged_after; }
162 
163  std::string interpolator;
164  };
165 
166  void add_parameter (Parameter* p) { parameter.push_back(p); }
167  unsigned get_nparam () const { return parameter.size(); }
168 
169  Parameter* get_parameter (unsigned iparam)
170  { return parameter.at(iparam); }
171  const Parameter* get_parameter (unsigned iparam) const
172  { return parameter.at(iparam); }
173 
174  protected:
175 
178 
181 
183  unsigned nreceptor;
184 
186  bool native_scale;
187 
189  unsigned nsub_input;
190 
197 
199  unsigned nchan_input;
200 
207 
208  std::vector< Reference::To<Parameter> > parameter;
209  };
210 
211  std::ostream& operator << (std::ostream& ostr,
212  CalibrationInterpolatorExtension::Parameter::Type);
213 
214 }
215 
216 #endif
void add(T(P::*get)() const, const char *name, const char *description=0)
void set_minimum_frequency(double freq)
Set the minimum frequency of the interpolator.
Definition: CalibrationInterpolatorExtension.h:110
MJD minimum_epoch
The minimum epoch.
Definition: CalibrationInterpolatorExtension.h:204
double get_reference_frequency() const
Get the reference frequency of the interpolator.
Definition: CalibrationInterpolatorExtension.h:107
void set_type(const Calibrator::Type *t)
Set the type of the calibrator.
Definition: CalibrationInterpolatorExtension.C:69
CalibrationInterpolatorExtension * clone() const
Clone method.
Definition: CalibrationInterpolatorExtension.h:53
const CalibrationInterpolatorExtension & operator=(const CalibrationInterpolatorExtension &)
Operator =.
Definition: CalibrationInterpolatorExtension.C:33
MJD reference_epoch
The reference epoch.
Definition: CalibrationInterpolatorExtension.h:202
const Calibrator::Type * get_type() const
Get the type of the calibrator.
Definition: CalibrationInterpolatorExtension.C:74
bool native_scale
True if scale is native; false if scale is relative to reference.
Definition: CalibrationInterpolatorExtension.h:196
unsigned nchan_input
The number of frequency channels in the input data.
Definition: CalibrationInterpolatorExtension.h:209
std::string get_short_name() const
Return a short name.
Definition: CalibrationInterpolatorExtension.h:120
void set_reference_frequency(double freq)
Set the reference frequency of the interpolator.
Definition: CalibrationInterpolatorExtension.h:105
double maximum_frequency
The maximum frequency in MHz.
Definition: CalibrationInterpolatorExtension.h:216
unsigned get_nchan_input() const
Get the number of frequency channels in input data.
Definition: CalibrationInterpolatorExtension.h:101
double get_minimum_frequency() const
Get the minimum frequency of the interpolator.
Definition: CalibrationInterpolatorExtension.h:112
virtual void set_instance(C *c)
void set_maximum_frequency(double freq)
Set the maximum frequency of the interpolator.
Definition: CalibrationInterpolatorExtension.h:115
CalibratorStokes::CouplingPoint coupling_point
The point where the reference source signal is coupled.
Definition: CalibrationInterpolatorExtension.h:190
void set_reference_epoch(const MJD &epoch)
Set the reference epoch of the interpolator.
Definition: CalibrationInterpolatorExtension.h:86
CouplingPoint
The point where the reference source signal is coupled
Definition: CalibratorStokes.h:38
double minimum_frequency
The minimum frequency in MHz.
Definition: CalibrationInterpolatorExtension.h:214
void set_nreceptor(unsigned n)
Set the number of receptors in flux calibrator.
Definition: CalibrationInterpolatorExtension.h:73
TextInterface::Parser * get_interface()
Return a text interfaces that can be used to access this instance.
Definition: CalibrationInterpolatorExtension.C:163
Text interface to Calibrator::Type class.
Definition: CalibratorTypeInterface.h:25
MJD maximum_epoch
The maximum epoch.
Definition: CalibrationInterpolatorExtension.h:206
bool has_data() const
Returns true if the Extension contains useful data.
Definition: CalibrationInterpolatorExtension.C:64
double get_maximum_frequency() const
Get the maximum frequency of the interpolator.
Definition: CalibrationInterpolatorExtension.h:117
double reference_frequency
The reference frequency in MHz.
Definition: CalibrationInterpolatorExtension.h:212
CalibrationInterpolatorExtension(const char *name="CalibrationInterpolatorExtension")
Default constructor.
Definition: CalibrationInterpolatorExtension.C:16
CalibratorStokes::CouplingPoint get_coupling_point() const
The point where the reference source signal is coupled.
Definition: CalibrationInterpolatorExtension.h:69
Definition: CalibratorType.h:30
void set_minimum_epoch(const MJD &epoch)
Set the minimum epoch of the interpolator.
Definition: CalibrationInterpolatorExtension.h:91
Reference::To< const Calibrator::Type > type
Type of the calibrator.
Definition: CalibrationInterpolatorExtension.h:187
unsigned nreceptor
Number of receptors in flux calibrator.
Definition: CalibrationInterpolatorExtension.h:193
~CalibrationInterpolatorExtension()
Destructor.
Definition: CalibrationInterpolatorExtension.C:59
MJD get_minimum_epoch() const
Get the minimum epoch of the interpolator.
Definition: CalibrationInterpolatorExtension.h:93
void set_maximum_epoch(const MJD &epoch)
Set the maximum epoch of the interpolator.
Definition: CalibrationInterpolatorExtension.h:96
void set_coupling_point(CalibratorStokes::CouplingPoint point)
Set the point where the reference source signal is coupled.
Definition: CalibrationInterpolatorExtension.h:65
MJD get_maximum_epoch() const
Get the maximum epoch of the interpolator.
Definition: CalibrationInterpolatorExtension.h:98
Defines the PSRCHIVE library.
Definition: CalSource.h:17
Stores Polarization Calibration Model Interpolator information.
Definition: CalibrationInterpolatorExtension.h:29
unsigned get_nsub_input() const
Get the number of epochs in input data.
Definition: CalibrationInterpolatorExtension.h:82
unsigned nsub_input
The number of epochs in the input data.
Definition: CalibrationInterpolatorExtension.h:199
Text interface to CalibrationInterpolatorExtension extension.
Definition: CalibrationInterpolatorExtension.h:123
MJD get_reference_epoch() const
Get the reference epoch of the interpolator.
Definition: CalibrationInterpolatorExtension.h:88
unsigned get_nreceptor() const
Get the number of receptors in flux calibrator.
Definition: CalibrationInterpolatorExtension.h:75
bool get_native_scale() const
Returns true if scale is native, false if scale is relative.
Definition: CalibrationInterpolatorExtension.h:78

Generated using doxygen 1.8.17