FluxCalibrator.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2003 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/Polarimetry/Pulsar/FluxCalibrator.h
10 
11 #ifndef __Pulsar_FluxCalibrator_H
12 #define __Pulsar_FluxCalibrator_H
13 
14 #include "Pulsar/Calibrator.h"
15 
16 namespace Pulsar {
17 
18  class Integration;
19  class StandardCandles;
20  class CalibratorStokes;
21  class FluxCalibratorExtension;
22 
24  class FluxCalibrator : public Calibrator {
25 
26  public:
27 
29  FluxCalibrator (const Archive* archive = 0);
30 
32  ~FluxCalibrator ();
33 
35  class Policy;
36 
38  class VariableGain;
39 
41  class ConstantGain;
42 
44  void set_policy (Policy*);
45 
47  class Info;
48 
50  Calibrator::Info* get_Info () const;
51 
54 
56  std::string get_standard_candle_info () const;
57 
59  double meanTsys () const;
60 
62  double Tsys (unsigned ichan) const;
63 
65  const CalibratorStokes* get_CalibratorStokes () const;
66 
68  void add_observation (const Archive* archive);
69 
71  void set_database (const StandardCandles* database);
72 
74  void set_outlier_threshold (float f) { outlier_threshold = f; }
75 
77  float get_outlier_threshold () const { return outlier_threshold; }
78 
80  void calibrate (Archive* archive);
81 
83  unsigned get_nchan () const;
84 
86  unsigned get_nreceptor () const;
87 
89  bool get_valid (unsigned ch) const;
90 
92  float get_weight (unsigned ichan) const;
93 
95  void set_invalid (unsigned ch);
96 
98  void print(std::ostream& os=std::cout) const;
99 
101  bool complete () const { return (have_on && have_off); }
102 
104  void calibration_setup (const Archive* archive);
105 
106  protected:
107 
108  friend class FluxCalibratorExtension;
109  friend class ConstantGainInfo;
110  friend class Info;
111 
114 
117 
119  void create (unsigned nchan = 0);
120 
122  void calibrate (Integration* subint);
123 
125  std::vector< Reference::To<Policy> > data;
126 
128  void data_range_check (unsigned ichan, const char* method) const;
129 
131  void resize (unsigned nchan, unsigned nreceptor);
132 
134  std::vector< float > gain;
135 
137  void resize (unsigned required_nchan);
138 
141 
142  private:
143 
145  mutable Reference::To<CalibratorStokes> calibrator_stokes;
146 
148  bool calculated = false;
149 
151  bool have_on = false;
152 
154  bool have_off = false;
155 
157  std::string standard_candle_info;
158 
160  double outlier_threshold = 0.0;
161 
163  bool constant_scale = false;
164 
166  void init ();
167 
169  void setup ();
170 
171  };
172 
173 }
174 
175 #endif
Calibrator
Definition: Integration.h:429
void resize(unsigned nchan, unsigned nreceptor)
Resize the data vector.
Definition: FluxCalibrator.C:624
Flux calibrator.
Definition: CalibratorTypes.h:34
Corrects the Signal::Source type and name attributes of the Archive.
Definition: FixFluxCal.h:29
std::vector< Reference::To< Policy > > data
Flux calibrator data for each frequency channel.
Definition: FluxCalibrator.h:130
void data_range_check(unsigned ichan, const char *method) const
Check on data range and validity.
Definition: FluxCalibrator.C:139
Estimate< double > get_gain(unsigned ireceptor) const
Get the gain for the specified receptor.
Definition: FluxCalibratorConstantGain.C:172
void create(unsigned nchan=0)
Create the cal_flux spectrum at the requested resolution.
Definition: FluxCalibrator.C:524
void set_invalid(unsigned ch)
Set the flux scale invalid flag for the specified channel.
Definition: FluxCalibrator.C:329
void calibration_setup(const Archive *archive)
Setup to calibrate the flux in the given archive.
Definition: FluxCalibrator.C:474
double Tsys(unsigned ichan) const
Return the system temperature of a specific channel.
Definition: FluxCalibrator.C:150
FluxCalibrator parameter communication.
Definition: ConstantGainInfo.h:24
void set_policy(Policy *)
Set the policy used to perform flux calibration.
Definition: FluxCalibrator.C:104
StateType * get() const
Definition: Receiver.C:22
virtual unsigned get_nsubint() const =0
Get the number of sub-integrations stored in the file.
virtual Signal::Scale get_scale() const =0
Get the scale in which flux density is measured.
Reference::To< Policy > policy
The policy used to peform flux calibration.
Definition: FluxCalibrator.h:145
bool complete() const
Check whether both on and off are present.
Definition: FluxCalibrator.h:106
float get_outlier_threshold() const
Get the threshold used to reject outliers when computing levels.
Definition: FluxCalibrator.h:82
The primary interface to pulsar observational data.
Definition: Archive.h:45
static Archive * load(const std::string &name)
Factory returns a new instance loaded from filename.
Definition: Archive_load.C:28
Contains information about the receiver and receiver platform.
Definition: Receiver.h:28
static void set_verbosity(unsigned level)
Set the verbosity level (0 to 3)
Definition: Archive_verbose.C:19
Archive * new_solution(const std::string &archive_class) const
Return a new processed calibrator Archive with a CalibratorExtension.
Definition: Calibrator.C:142
float get_weight(unsigned ichan) const
Return the weight (0 or 1) associated with the specified channel.
Definition: FluxCalibrator.C:303
void all_matching(const Criteria &, std::vector< const Entry * > &matches) const
Fills a vector with Entry instances that match the given Criteria.
Definition: Database.C:1035
Stores the Stokes parameters of the reference source.
Definition: CalibratorStokes.h:28
Type * get() const
Used when gain varies between FluxCal-On and Off observations.
Definition: FluxCalibratorPolicy.h:113
void set_database(const StandardCandles *database)
Set the database containing flux calibrator information.
Definition: FluxCalibrator.C:468
Reference::To< const StandardCandles > database
Flux calibrator database.
Definition: FluxCalibrator.h:118
ReferenceFluxDensity
void print(std::ostream &os=std::cout) const
Print all the fluxcal info.
Definition: FluxCalibrator.C:161
Correct the backend convention.
Definition: BasisCorrection.h:28
virtual unsigned get_nchan() const =0
Get the number of frequency channels used.
float get_weight(unsigned ichan) const
Get the Profile weight attribute of the given channel.
Definition: Integration.C:388
void unload(const std::string &dbase_filename)
Write a text file representing the database to disk for storage.
Definition: Database.C:943
Integration * get_Integration(unsigned subint)
Return pointer to the specified Integration.
Definition: IntegrationManager.C:41
std::string get_standard_candle_info() const
Return information about the standard candle used.
Definition: FluxCalibrator.C:109
std::vector< float > gain
The absolute gain used to calibrate the archive data.
Definition: FluxCalibrator.h:139
CalibratorExtension * new_Extension() const
Return a new FluxCalibratorExtension.
Definition: FluxCalibrator.C:784
unsigned get_nreceptor() const
Get the number of receptors in the calibrator.
Definition: FluxCalibrator.C:765
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
void set_outlier_threshold(float f)
Set the threshold used to reject outliers when computing levels.
Definition: SquareWave.h:81
Definition: Calibrator.h:152
const CalibratorStokes * get_CalibratorStokes() const
Return an estimate of the artificial cal Stokes parameters.
Definition: FluxCalibrator.C:198
unsigned get_nchan() const
Get the number of frequency channels in the calibrator.
Definition: FluxCalibrator.C:756
void set_scale(unsigned ireceptor, const Estimate< double > &)
Set the scale for the specified receptor.
A calibration solution that spans a finite bandwidth and time.
Definition: CalibrationInterpolator.h:32
T get_value() const
bool verbose
Definition: timer++.C:25
Flux Calibrator Extension.
Definition: FluxCalibratorExtension.h:28
virtual std::string get_filenames() const
Return a string containing the file information.
Definition: Calibrator.C:110
bool get_valid(unsigned ch) const
Return true if the flux scale for the specified channel is valid.
Definition: FluxCalibrator.C:309
void set_gain_ratio(unsigned ireceptor, const Estimate< double > &)
Set the gain ratio for the specified receptor.
double meanTsys() const
Return the system temperature in Kelvin.
Definition: FluxCalibrator.C:114
Stores Calibrator parameters in an Archive.
Definition: CalibratorExtension.h:27
Reference::To< const FluxCalibratorExtension > flux_extension
Flux calibrator extension.
Definition: FluxCalibrator.h:121
std::string get_filename() const
Get the name of the file to which the archive will be unloaded.
Definition: Archive.h:108
~FluxCalibrator()
Destructor.
Definition: FluxCalibrator.C:93
static Option< float > transition_phase
If set, use the specified pulse phase for lo->hi transition.
Definition: SquareWave.h:36
Calibrates flux using standard candles and artificial sources.
Definition: FluxCalibrator.h:29
Calibrator::Info * get_Info() const
Return the FluxCalibrator information.
Definition: FluxCalibrator.C:777
Pulsar Observation Database.
Definition: Database.h:40
Uses the off-pulse noise statistics to scale the polarization.
Definition: OffPulseCalibrator.h:33
const std::string get_message() const
Pulsar Database Entry.
Definition: Database.h:130
void set_outlier_threshold(float f)
Set the threshold used to reject outliers when computing levels.
Definition: FluxCalibrator.h:79
void add_observation(const Archive *archive)
Add a FluxCal Pulsar::Archive to the set of constraints.
Definition: FluxCalibrator.C:345
Corrects the Signal::Source type attribute of the Archive.
Definition: CalSource.h:28
Defines the PSRCHIVE library.
Definition: CalSource.h:17
Stores Polarization Calibration Model Interpolator information.
Definition: CalibrationInterpolatorExtension.h:29
void set(const std::vector< Estimate< double > > &S_sys, const std::vector< Estimate< double > > &S_cal)
Set the flux densities for each receptor.
Definition: FluxCalibratorPolicy.C:22
Angle get_reference_source_phase() const
Get the phase of the reference source.
Definition: Receiver.h:122
static const Pulsar::Archive * any
Pass this to the criteria methods to retrieve any or all matches.
Definition: Database.h:66
Criteria criteria(const Pulsar::Archive *arch, Signal::Source obsType) const
Return the Criteria for the specified Pulsar::Archive.
Definition: Database.C:1180
Represents the system as a Calibration::SingleAxis.
Definition: SingleAxisCalibrator.h:26
Used when gain remains constant between FluxCal-On and Off observations.
Definition: FluxCalibratorPolicy.h:161
std::string get_filename(const Entry *) const
Returns the full pathname of the Entry filename.
Definition: Database.C:1633
Flux calibration data for each receptor.
Definition: FluxCalibratorPolicy.h:28
Describes Database matching criteria.
Definition: Database.h:215
void calibrate(Archive *archive)
Calibrate the flux in the given archive.
Definition: FluxCalibrator.C:513
Calculates the signal-to-noise ratio using (on-off)/rms.
Definition: SquareWave.h:31
FluxCalibrator parameter communication.
Definition: FluxCalibratorInfo.h:24
void add(const Pulsar::Archive *archive)
Add the given Archive to the database.
Definition: Database.C:968
virtual void set_scale(Signal::Scale scale)=0
Set the scale in which flux density is measured.
Signal::Hand get_hand() const
Get the hand of the basis.
Definition: Receiver.h:117
FluxCalibrator(const Archive *archive=0)
Default constructor.
Definition: FluxCalibrator.C:49

Generated using doxygen 1.8.17