ReceptionCalibrator.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2003 - 2012 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/Polarimetry/Pulsar/ReceptionCalibrator.h
10 
11 #ifndef __Pulsar_ReceptionCalibrator_H
12 #define __Pulsar_ReceptionCalibrator_H
13 
14 #include "Pulsar/SystemCalibrator.h"
15 #include "Pulsar/ReflectStokes.h"
16 
17 #include "Pulsar/FluxCalManager.h"
18 #include "Pulsar/StandardData.h"
19 
20 #include "MEAL/VectorRule.h"
21 
22 namespace Pulsar
23 {
24 
25  class Archive;
26  class Integration;
27  class ReferenceCalibrator;
28  class FluxCalibrator;
29 
31 
37  class ReceptionCalibrator : public SystemCalibrator
38  {
39 
40  public:
41 
43  friend class SourceInfo;
44 
47 
50 
52  bool degenerate_V_boost;
53 
55  bool measure_cal_V;
56 
59 
61  bool measure_cal_Q;
62 
65 
67  bool physical_coherency;
68 
70  bool independent_gains;
71 
73  bool check_pointing;
74 
76  bool output_report;
77 
80 
83 
85  ReflectStokes reflections;
86 
88  void add_state (unsigned pulse_phase_bin);
89 
91  unsigned get_nstate_pulsar () const;
92 
94  Calibrator::Info* new_info_pulsar (unsigned istate) const;
95 
97  void set_standard_data (const Archive* data);
98 
100  const PhaseWeight* get_baseline () const;
101 
103  const PhaseWeight* get_onpulse () const;
104 
106  void add_calibrator (const Archive* data);
107 
109  void add_calibrator (const ReferenceCalibrator* polncal);
110 
112  bool has_fluxcal () const;
113 
115  const Calibration::FluxCalManager* get_fluxcal (unsigned ichan) const;
116 
118  void set_previous (const Archive* data);
119 
121  void set_normalize_by_invariant (bool set = true);
122 
124  void solve ();
125 
126  protected:
127 
130 
133 
136 
137  std::vector< Reference::To<Calibration::FluxCalManager> > fluxcal;
138 
140  std::vector< std::vector<Calibration::SourceEstimate> > pulsar;
141  std::vector< unsigned > phase_bins;
142 
144  std::vector<MJD> calibrator_epochs;
145 
146  // counts the number of times that add_data failed
147  unsigned add_data_fail;
148 
149  // counts the number of times that add_data is called
150  unsigned add_data_call;
151 
153  unsigned nthread;
154 
156  void initialize ();
157 
159  void init_model (unsigned ichan);
160 
162  void check_ready (const char* method, bool init = true);
163 
165  void initial_observation (const Archive* data);
166 
167  void valid_mask (const std::vector<Calibration::SourceEstimate>&);
168 
170 
175  void add_data (std::vector<Calibration::CoherencyMeasurement>& bins,
176  Calibration::SourceEstimate& estimate,
177  const MJD& epoch, unsigned ichan);
178 
181  std::vector<bool> fluxcal_observation_added;
182 
184  const Calibration::SourceObservation&);
185 
186  void integrate_calibrator_data (const Calibration::SourceObservation&);
187 
188  void integrate_calibrator_solution (const Calibration::SourceObservation&);
189 
191  void submit_calibrator_data ();
192 
194  void match (const Archive*);
195 
197  const Integration*, unsigned ichan);
198 
199  Calibration::SourceEstimate& get_estimate (unsigned index,
200  unsigned ichan);
201 
203 
206  const MJD& epoch, unsigned ichan);
207 
209  void solve_prepare ();
210 
212  void export_prepare () const;
213 
215  void setup_calibrators ();
216  void setup_poln_calibrator (Calibration::SourceEstimate&);
217  void setup_flux_calibrator (Calibration::FluxCalManager*);
218 
221  };
222 
223 }
224 
225 #endif
Calibrator
Definition: Integration.h:429
unsigned add_data_attempts
Count attempts to add data for this state.
Definition: SourceEstimate.h:64
MEAL::Axis< unsigned > unique_axis
The unique transformation "axis".
Definition: ReceptionCalibrator.h:140
const Calibration::FluxCalManager * get_fluxcal(unsigned ichan) const
Return the flux calibration manager for the specified frequency channel.
Definition: ReceptionCalibrator.C:575
virtual Signal::Source get_type() const =0
Get the observation type (psr, cal)
bool required(const Archive *)
Return true if the archive needs to be corrected.
Definition: FrontendCorrection.C:18
void integrate(const MEAL::Complex2 *model)
Add the Model parameters to the running mean.
Definition: MeanCoherency.C:20
const PhaseWeight * get_onpulse() const
Get the on-pulse mask.
Definition: ReceptionCalibrator.C:118
void add_state(unsigned pulse_phase_bin)
Add the specified pulse phase bin to the set of state constraints.
Definition: ReceptionCalibrator.C:267
Report on the goodness-of-fit for each source.
Definition: FitGoodnessReport.h:24
void add_calibrator(const Archive *data)
Add the calibrator observation to the set of constraints.
Definition: ReceptionCalibrator.C:299
virtual MJD get_epoch() const =0
Get the epoch of the rising edge of bin zero.
unsigned add_data_failures
Count failures to add data for this state.
Definition: SourceEstimate.h:67
void initialize()
Set the initial guesses and update the reference epoch.
Definition: ReceptionCalibrator.C:684
void set_coordinates() const
Apply the independent variables.
Definition: CoherencyMeasurement.C:193
ReflectStokes reflections
Reflections performed on the calibrator data immediately after loading.
Definition: ReceptionCalibrator.h:90
Stores a weight for each Profile phase bin.
Definition: PhaseWeight.h:29
Definition: Archive.h:26
void match(const Archive *)
Ensure that the pulsar observation can be added to the data set.
Definition: ReceptionCalibrator.C:324
virtual const Calibrator::Type * get_type() const
Get the type of the calibrator.
Definition: CalibratorExtension.C:53
Stokes< Estimate< double > > get_stokes() const
Get the measured Stokes parameters.
Definition: CoherencyMeasurement.C:61
The primary interface to pulsar observational data.
Definition: Archive.h:45
MEAL::VectorRule< MEAL::Complex2 > * unique
The unique transformation for each observation.
Definition: ReceptionCalibrator.h:137
void init_model(unsigned ichan)
Initialize the SignalPath of the specified channel.
Definition: ReceptionCalibrator.C:213
Plots the various components of a ReceptionCalibrator.
Definition: ReceptionCalibratorPlotter.h:26
std::vector< MJD > calibrator_epochs
The epochs of all loaded calibrators.
Definition: ReceptionCalibrator.h:149
Communicates Calibrator Stokes parameters.
Definition: SourceInfo.h:25
void solve()
Solve equation for each frequency.
Definition: ReceptionCalibrator.C:670
void integrate_pulsar_data(const Calibration::CoherencyMeasurementSet &)
add pulsar data to mean estimate used as initial guess
Definition: ReceptionCalibrator.C:395
Stores the Stokes parameters of the reference source.
Definition: CalibratorStokes.h:28
bool measure_cal_V
Allow the CAL Stokes V to vary (applies only if FluxCal observed)
Definition: ReceptionCalibrator.h:60
const ExtensionType * get() const
Template method searches for an Extension of the specified type.
bool measure_cal_Q
Allow the CAL Stokes Q to vary.
Definition: ReceptionCalibrator.h:66
ReceptionCalibrator(Calibrator::Type *)
Construct with optional first pulsar archive.
Definition: ReceptionCalibrator.C:49
Computes the normalized Stokes parameters in each phase bin.
Definition: StandardData.h:55
virtual Signal::State get_state() const =0
Get the state of the profile data.
void prepare_calibrator_estimate(Signal::Source)
Prepare the calibrator estimate.
Definition: ReceptionCalibrator.C:447
bool model_fluxcal_on_minus_off
Model the difference between FluxCalOn and FluxCalOff observations.
Definition: ReceptionCalibrator.h:87
bool check_pointing
Print an error message if Pointing parameters are not as expected.
Definition: ReceptionCalibrator.h:78
void set_title(const std::string &)
Set the title.
Definition: SourceInfo.C:32
int phase_bin
Phase bin from which pulsar polarization is derived.
Definition: SourceEstimate.h:58
Implements Measurement Equation Modeling (van Straten 2004)
Definition: ReceptionCalibrator.h:42
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
Definition: Calibrator.h:152
A CoherencyMeasurement set and their coordinates.
Definition: CoherencyMeasurementSet.h:26
void set_onpulse(unsigned ibin, bool)
Set if the specified phase bin is in the on pulse window.
Definition: ProfileStats.C:316
bool equal_ellipticities
Assume that the receptor ellipticities are equal.
Definition: ReceptionCalibrator.h:69
void add_data(std::vector< Calibration::CoherencyMeasurement > &bins, Calibration::SourceEstimate &estimate, const MJD &epoch, unsigned ichan)
Add Integration data to the CoherencyMeasurement vector.
Definition: ReceptionCalibrator.C:351
Stores PolnCalibrator parameters in an Archive instance.
Definition: PolnCalibratorExtension.h:28
Corrects the recorded properties of the frontend.
Definition: FrontendCorrection.h:31
unsigned nthread
The number of channels that may be simultaneously solved.
Definition: ReceptionCalibrator.h:158
void setup_calibrators()
Set fit flags and initial values of the calibrator Stokes parameters.
Definition: ReceptionCalibrator.C:495
Calibrators derived from reference source observations.
Definition: ReferenceCalibrator.h:31
void export_prepare() const
Prepare to export the solution.
Definition: ReceptionCalibrator.C:679
virtual bool get_dedispersed() const =0
Inter-channel dispersion delay has been removed.
bool multiple_flux_calibrators
Each flux calibrator observation may have unique values of I, Q & U.
Definition: ReceptionCalibrator.h:84
unsigned input_index
The index of the source in the model.
Definition: SourceEstimate.h:61
void set_coordinates() const
Apply the independent variables.
Definition: CoherencyMeasurementSet.C:41
MJD start_time() const
Return the MJD at the start of the first sub-integration.
Definition: Archive.C:299
Definition: CalibratorType.h:30
bool independent_gains
Allow the gain to vary independently from observation to observation.
Definition: ReceptionCalibrator.h:75
void set_normalize_by_invariant(bool set=true)
Normalize each Stokes vector by the mean on-pulse invariant.
Definition: ReceptionCalibrator.C:123
void valid_mask(const std::vector< Calibration::SourceEstimate > &)
Definition: ReceptionCalibrator.C:788
bool degenerate_V_rotation
The rotation about Stokes V is instrinsically degenerate.
Definition: ReceptionCalibrator.h:63
bool output_report
Produce reports of reduced chisq for each state in each channel.
Definition: ReceptionCalibrator.h:81
bool degenerate_V_boost
The boost along Stokes V is intrinsically degenerate.
Definition: ReceptionCalibrator.h:57
const MJD & get_epoch() const
Get the epoch.
Definition: CoherencyMeasurementSet.h:76
Polarimetric calibrators.
Definition: PolnCalibrator.h:41
Calibrator::Info * new_info_pulsar(unsigned istate) const
Retern a new plot information interface for the specified state.
Definition: ReceptionCalibrator.C:813
std::string get_filename() const
Get the name of the file to which the archive will be unloaded.
Definition: Archive.h:108
void solve_prepare()
Prepare the measurement equations for fitting.
Definition: ReceptionCalibrator.C:800
void initial_observation(const Archive *data)
Initialization performed using the first observation added.
Definition: ReceptionCalibrator.C:135
A coherency matrix measurement and its estimated error.
Definition: CoherencyMeasurement.h:32
virtual Archive * clone() const =0
Return a new copy constructed instance equal to this.
const std::string get_message() const
Defines the PSRCHIVE library.
Definition: CalSource.h:17
unsigned get_ichan() const
Get the channel index.
Definition: CoherencyMeasurementSet.h:82
void submit_calibrator_data()
Handle any integrated flux calibrator data.
Definition: ReceptionCalibrator.C:230
bool physical_coherency
Enforce that Stokes I > |p|, where p=(Q,U,V)
Definition: ReceptionCalibrator.h:72
void set_previous(const Archive *data)
Set the first guess to a previous solution.
Definition: ReceptionCalibrator.C:310
std::vector< std::vector< Calibration::SourceEstimate > > pulsar
Uncalibrated estimate of pulsar polarization as a function of phase.
Definition: ReceptionCalibrator.h:145
Computes pulse profile statistics.
Definition: ProfileStats.h:35
Reference::To< Calibration::StandardData > standard_data
Standard data interface.
Definition: ReceptionCalibrator.h:134
void ensure_consistent_onpulse()
Ensure that selected phase bins are represented in on-pulse mask.
Definition: ReceptionCalibrator.C:101
Manages a single source and its current best estimate (first guess)
Definition: SourceEstimate.h:30
void set_standard_data(const Archive *data)
Set the observation that defines the baseline and on-pulse phase bins.
Definition: ReceptionCalibrator.C:80
PolnProfile * new_PolnProfile(unsigned ichan)
Returns a pointer to a new PolnProfile instance.
Definition: Integration_new_PolnProfile.C:16
const PhaseWeight * get_baseline() const
Get the baseline mask.
Definition: ReceptionCalibrator.C:112
bool has_fluxcal() const
Return true if any flux calibrator observations are available.
Definition: ReceptionCalibrator.C:569
MeanCoherency estimate
Best estimate (first guess) of Stokes parameters.
Definition: SourceEstimate.h:52
~ReceptionCalibrator()
Descructor.
Definition: ReceptionCalibrator.C:76
unsigned get_nstate_pulsar() const
Get the number of pulsar phase bin input polarization states.
Definition: ReceptionCalibrator.C:293
Manages multiple flux calibrator observations.
Definition: FluxCalManager.h:57
Reference::To< MEAL::Coherency > source
Model of Stokes parameters.
Definition: SourceEstimate.h:49
void add_pulsar(Calibration::CoherencyMeasurementSet &, const Integration *, unsigned ichan)
Add pulsar data constraints to coherency measurement set.
Definition: ReceptionCalibrator.C:339
void check_ready(const char *method, bool init=true)
Check that the model is ready to receive additional constraints.
Definition: ReceptionCalibrator.C:771

Generated using doxygen 1.8.17