ReferenceCalibrator.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/ReferenceCalibrator.h
10 
11 #ifndef __Pulsar_ReferenceCalibrator_H
12 #define __Pulsar_ReferenceCalibrator_H
13 
14 #include "Pulsar/PolnCalibrator.h"
15 #include "Pulsar/Config.h"
16 
17 #include "Estimate.h"
18 #include "Stokes.h"
19 #include "Types.h"
20 
21 namespace Pulsar {
22 
23  class Integration;
24 
26  class ReferenceCalibrator : public PolnCalibrator
27  {
28 
29  void init ();
30 
31  public:
32 
35 
38  const Archive*);
39 
41  ReferenceCalibrator (const Archive* archive);
42 
45 
47  virtual ReferenceCalibrator* clone () const = 0;
48 
51 
53  void set_reference_source (const Stokes< Estimate<double> >& stokes);
54 
56  Stokes< Estimate<double> > get_reference_source () const;
57 
59  void set_outlier_threshold (float f) { outlier_threshold = f; }
60 
62  float get_outlier_threshold () const { return outlier_threshold; }
63 
65  void get_levels (unsigned nchan,
66  std::vector<std::vector<Estimate<double> > >& hi,
67  std::vector<std::vector<Estimate<double> > >& lo) const;
68 
70  static void get_levels (const Archive* archive,
71  Index subint, unsigned nchan,
72  std::vector<std::vector<Estimate<double> > >& hi,
73  std::vector<std::vector<Estimate<double> > >& lo,
74  double outlier_threshold);
75 
77  static void get_levels (const Integration* integration, unsigned nchan,
78  std::vector<std::vector<Estimate<double> > >& hi,
79  std::vector<std::vector<Estimate<double> > >& lo,
80  double outlier_threshold);
81 
82  // ///////////////////////////////////////////////////////////////////
83  //
84  // Pulsar::PolnCalibrator over-ride
85  //
86  // ///////////////////////////////////////////////////////////////////
87 
89  virtual void set_nchan (unsigned nchan);
90 
91  protected:
92 
94  std::vector< Estimate<double> > baseline;
95 
97  Stokes< Estimate<double> > reference_source;
98 
100  void set_calibrator (const Archive* archive);
101 
103  bool source_set;
104 
106  unsigned requested_nchan;
107 
109  double outlier_threshold;
110 
111  // ///////////////////////////////////////////////////////////////////
112  //
113  // Pulsar::Calibrator implementation
114  //
115  // ///////////////////////////////////////////////////////////////////
116 
118  void calculate_transformation ();
119 
121  void calculate (std::vector<std::vector<Estimate<double> > >& hi,
122  std::vector<std::vector<Estimate<double> > >& lo);
123 
125  virtual MEAL::Complex2*
126  solve (const std::vector<Estimate<double> >& hi,
127  const std::vector<Estimate<double> >& lo) = 0;
128 
130  virtual void extra (unsigned ichan,
131  const std::vector< Estimate<double> >& source,
132  const std::vector< Estimate<double> >& sky) { }
133 
134  };
135 
136 }
137 
138 #endif
Off-pulse Calibrator (P236)
Definition: CalibratorTypes.h:198
std::vector< Estimate< double > > baseline
Intensity of off-pulse (system + sky), in CAL flux units.
Definition: ReferenceCalibrator.h:99
virtual unsigned get_npol() const =0
Get the number of polarizations.
Index subint
The sub-integration from which to construct a solution.
Definition: PolnCalibrator.h:208
unsigned requested_nchan
Requested number of frequency channels.
Definition: ReferenceCalibrator.h:111
Stokes< Estimate< double > > get_reference_source() const
Get the Stokes parameters of the reference source.
Definition: ReferenceCalibrator.C:138
virtual unsigned get_npol() const =0
Get the number of polarization measurements.
Degree of Polarization Calibrator (P236)
Definition: DoPCalibrator.h:33
void set_Stokes(const Stokes< Estimate< float > > &)
static ReferenceCalibrator * factory(const Calibrator::Type *, const Archive *)
Factory creates instances of derived types.
Definition: ReferenceCalibrator.C:496
Combines an index value and integrate flag.
Definition: Index.h:24
static Option< bool > smooth_bandpass
If true, then a median filter is run on the calibrator bandpass.
Definition: ReferenceCalibrator.h:39
~ReferenceCalibrator()
Destructor.
Definition: ReferenceCalibrator.C:34
void calculate_transformation()
Solve using the observation of the reference source.
Definition: ReferenceCalibrator.C:369
virtual bool is_a(const Type *that) const
Return true if that is a this.
Definition: CalibratorType.C:29
Estimate< double > get_invariant() const
double get_bias() const
void get_levels(unsigned nchan, std::vector< std::vector< Estimate< double > > > &hi, std::vector< std::vector< Estimate< double > > > &lo) const
Return the mean levels of the calibrator hi and lo states.
Definition: ReferenceCalibrator.C:358
virtual ReferenceCalibrator * clone() const =0
Clone operator.
The primary interface to pulsar observational data.
Definition: Archive.h:45
static Pulsar::Option< float > det_threshold
Tolerance to non-physical values of the coherency matrix.
Definition: Calibrator.h:52
Mixes a SingleAxis and Phenomenological parameterization.
Definition: CalibratorTypes.h:163
virtual void extra(unsigned ichan, const std::vector< Estimate< double > > &source, const std::vector< Estimate< double > > &sky)
Derived classes may also compute other things.
Definition: ReferenceCalibrator.h:135
Gain, differential gain and differential phase.
Definition: CalibratorTypes.h:55
U get_error() const
void set_transformation(unsigned ichan, MEAL::Complex2 *)
Set the transformation for the secified channel.
Definition: PolnCalibrator.C:343
void set_calibrator(const Archive *archive)
Filter access to the calibrator.
Definition: ReferenceCalibrator.C:39
Reference::To< Type > type
The type of the Calibrator.
Definition: Calibrator.h:115
static unsigned verbose
Verbosity level.
Definition: Calibrator.h:40
virtual Integration * clone() const =0
Return a new copy of self.
void set_reference_source(const Stokes< Estimate< double > > &stokes)
Set the Stokes parameters of the reference source.
Definition: ReferenceCalibrator.C:130
Stokes< double > get_reference_source() const
Return the Stokes parameters of the reference source.
Definition: Receiver.C:220
float get_weight(unsigned ichan) const
Get the Profile weight attribute of the given channel.
Definition: Integration.C:388
bool required(const Archive *) const
Return true if the operation is required.
Definition: BackendCorrection.C:47
virtual void set_nchan(unsigned nchan)
Set the number of frequency channels in the response array.
Definition: ReferenceCalibrator.C:147
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
Represents the system as a polar decomposition.
Definition: PolarCalibrator.h:25
void set_outlier_threshold(float f)
Set the threshold used to reject outliers when computing levels.
Definition: SquareWave.h:81
void calculate(std::vector< std::vector< Estimate< double > > > &hi, std::vector< std::vector< Estimate< double > > > &lo)
Does the calculation of the above.
void set_outlier_threshold(float f)
Set the threshold used to reject outliers when computing levels.
Definition: ReferenceCalibrator.h:64
bool has_Receiver() const
Return true if the Receiver is set.
Definition: PolnCalibrator.C:195
Calibrators derived from reference source observations.
Definition: ReferenceCalibrator.h:31
const Receiver * get_Receiver() const
Return the Receiver.
Definition: PolnCalibrator.C:201
T get_value() const
ReferenceCalibrator(const Archive *archive)
Construct from an single PolnCal Pulsar::Archive.
Definition: ReferenceCalibrator.C:86
Definition: CalibratorType.h:30
virtual std::string get_name() const
Return the name of the calibrator type.
Definition: CalibratorType.h:46
Polarimetric calibrators.
Definition: PolnCalibrator.h:41
const Archive * get_calibrator() const
Provide derived classes with access to the calibrator.
Definition: Calibrator.C:92
virtual void set_response_nchan(unsigned nchan)
Set the number of frequency channels in the response array.
Definition: PolnCalibrator.C:164
void set_transformation_invalid(unsigned ch, const std::string &reason)
Set the transformation invalid flag for the specified channel.
Definition: PolnCalibrator.C:276
Correct the backend convention.
Definition: BackendCorrection.h:28
double outlier_threshold
Threshold used to reject outliers when computing levels.
Definition: ReferenceCalibrator.h:114
Degree of Polarization Calibrator (P236)
Definition: CalibratorTypes.h:191
virtual MEAL::Complex2 * solve(const std::vector< Estimate< double > > &hi, const std::vector< Estimate< double > > &lo)=0
Derived classes must perform the actual solution.
Uses the off-pulse noise statistics to scale the polarization.
Definition: OffPulseCalibrator.h:33
virtual unsigned get_nchan() const =0
Get the number of chans.
const std::string get_message() const
Defines the PSRCHIVE library.
Definition: CalSource.h:17
Represents the system as a Calibration::SingleAxis.
Definition: SingleAxisCalibrator.h:26
float get_outlier_threshold() const
Get the threshold used to reject outliers when computing levels.
Definition: ReferenceCalibrator.h:67
Stokes< Estimate< double > > reference_source
The Stokes parameters of the reference source.
Definition: ReferenceCalibrator.h:102
Calculates the signal-to-noise ratio using (on-off)/rms.
Definition: SquareWave.h:31
van Straten (2002; ApJ 568:436), equation A1
Definition: CalibratorTypes.h:68
bool source_set
Flag raised when the reference_source attribute is set.
Definition: ReferenceCalibrator.h:108

Generated using doxygen 1.8.17