PulsarCalibrator.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/PulsarCalibrator.h
10
11#ifndef __Pulsar_PulsarCalibrator_H
12#define __Pulsar_PulsarCalibrator_H
13
14#include "Pulsar/SystemCalibrator.h"
15#include "Pulsar/PhaseWeight.h"
16
17#include "MEAL/Mean.h"
18
19#include "toa.h"
20
21#include <stdio.h>
22
23namespace Pulsar {
24
25 class Archive;
26 class Integration;
27 class PolnProfileFit;
29
31
39
40 public:
41
44
47
49 bool calibrator_match (const Archive*, std::string& reason_for_not_matching);
50
52 void set_fixed_phase (bool flag = true);
53
55 void share_phase ();
56
58 unsigned get_nchan () const;
59
61 unsigned get_nstate_pulsar () const;
62
64 void set_maximum_harmonic (unsigned max);
65
67 void set_choose_maximum_harmonic (bool flag = true);
68
70 unsigned get_nharmonic () const;
71
73 void set_standard (const Archive* data);
74
76 void set_solve_each (bool = true);
77
80
82 void wait ();
83
85 void update_solution ();
86
88 MEAL::Complex2* get_transformation (const Archive* data, unsigned isub, unsigned ichan);
89
91 const PolnProfileFit* get_mtm (unsigned ichan) const;
92
95
97 double get_invariant (Integration* subint, unsigned ichan) override;
98
99 protected:
100
101 friend class MatrixTemplateMatching;
102
105
108
110 typedef std::map< unsigned, Reference::Vector<MEAL::Complex2> > Storage;
111 Storage store_each;
112
115
117 MEAL::Complex2* new_transformation (unsigned ichan);
118
121
123 std::vector<float> reduced_chisq;
124
125 typedef MEAL::Mean< MEAL::Complex2 > MeanXform;
126
129
132
135
138
141
144
147
150
152 void init_model (unsigned ichan);
153
155 void solve1 (const Calibration::CoherencyMeasurementSet& measurements);
156
158 void setup (const Integration* data, unsigned ichan);
159
161 virtual void export_prepare () const;
162
164 virtual bool match (const Archive*, bool throw_exception = true);
165
167 virtual void add_pulsar (const Archive* data, unsigned isub);
168
171 const Integration*, unsigned ichan);
172
174 virtual void add_calibrator (const ReferenceCalibrator*);
175
176 private:
177
178 // used to communicate between solve and add_observation
179 unsigned big_difference;
180
182 void build (unsigned nchan);
183
184 };
185
186}
187
188#endif
A CoherencyMeasurement set and their coordinates.
Definition CoherencyMeasurementSet.h:22
The primary interface to pulsar observational data.
Definition Archive.h:46
Definition CalibratorType.h:26
Array of Profiles integrated over the same time interval.
Definition Integration.h:37
Stores a weight for each Profile phase bin.
Definition PhaseWeight.h:24
Index subint
The sub-integration from which to construct a solution.
Definition PolnCalibrator.h:202
The matrix template matching algorithm.
Definition PolnProfileFit.h:51
PhaseWeight baseline
The baseline region.
Definition PulsarCalibrator.h:149
PhaseWeight onpulse
The on-pulse region.
Definition PulsarCalibrator.h:146
unsigned get_nchan() const
Get the number of frequency channels.
Definition PulsarCalibrator.C:277
void set_standard(const Archive *data)
Set the standard to which pulsar profiles will be fit.
Definition PulsarCalibrator.C:98
PulsarCalibrator(Calibrator::Type *=0)
Constructor.
Definition PulsarCalibrator.C:46
bool monitor_gimbal_lock
Set true to detect gimbal lock when rotations are not quaternion.
Definition PulsarCalibrator.h:94
unsigned maximum_harmonic
The maximum number of harmonics to include in the fit.
Definition PulsarCalibrator.h:137
double get_invariant(Integration *subint, unsigned ichan) override
Return the invariant for the specified integration and frequency channel.
Definition PulsarCalibrator.C:391
bool calibrator_match(const Archive *, std::string &reason_for_not_matching)
Return true if this calibrator can be applied to the data.
Definition PulsarCalibrator.C:311
void set_unload_each(Unloader *)
Unload the solution from each sub-integration.
Definition PulsarCalibrator.C:838
Reference::To< Pulsar::Archive > standard
The template/standard.
Definition PulsarCalibrator.h:104
void set_choose_maximum_harmonic(bool flag=true)
Allow software to choose the maximum harmonic.
Definition PulsarCalibrator.C:83
void share_phase()
Share a single phase estimate between all observations.
Definition PulsarCalibrator.C:93
Reference::Vector< MeanXform > solution
The array of transformation Model instances.
Definition PulsarCalibrator.h:128
unsigned get_nstate_pulsar() const
Get the number of pulsar harmonics (input polarization states)
Definition PulsarCalibrator.C:181
std::vector< float > reduced_chisq
The reduced chi-squared as a function of frequency.
Definition PulsarCalibrator.h:123
void setup(const Integration *data, unsigned ichan)
Set things up for the model in the given channel.
Definition PulsarCalibrator.C:595
void init_model(unsigned ichan)
Initialize the SignalPath of the specified channel.
Definition PulsarCalibrator.C:288
void set_solve_each(bool=true)
Solve each sub-integration (instead of global fit)
Definition PulsarCalibrator.C:833
MEAL::Complex2 * new_transformation(unsigned ichan)
Return a pointer to a newly constructed/initialized transformation.
Definition PulsarCalibrator.C:569
virtual void add_pulsar(const Archive *data, unsigned isub)
Add data from the specified sub-integration.
Definition PulsarCalibrator.C:477
unsigned chosen_maximum_harmonic
The maximum harmonic chosen.
Definition PulsarCalibrator.h:143
Reference::Vector< PolnProfileFit > mtm
The calibration model as a function of frequency.
Definition PulsarCalibrator.h:120
bool solve_each
Solve the measurement equation for each sub-integration.
Definition PulsarCalibrator.h:107
void solve1(const Calibration::CoherencyMeasurementSet &measurements)
Solve the measurement equation for the given measurements.
Definition PulsarCalibrator.C:643
virtual void add_calibrator(const ReferenceCalibrator *)
Add the ReferenceCalibrator observation to the set of constraints.
Definition PulsarCalibrator.C:515
std::map< unsigned, Reference::Vector< MEAL::Complex2 > > Storage
Store the solution derived from each sub-integration.
Definition PulsarCalibrator.h:110
MEAL::Complex2 * get_transformation(const Archive *data, unsigned isub, unsigned ichan)
Return the transformation to be used for precalibration.
Definition PulsarCalibrator.C:539
bool fixed_phase
Flag set when phase should be held fixed.
Definition PulsarCalibrator.h:131
void update_solution()
Set the solution to the mean.
Definition PulsarCalibrator.C:802
const PolnProfileFit * get_mtm(unsigned ichan) const
The matrix template matching engine used to fit the specified channel.
Definition PulsarCalibrator.C:824
bool choose_maximum_harmonic
When set, the software will choose the maximum harmonic.
Definition PulsarCalibrator.h:140
void set_fixed_phase(bool flag=true)
When set, pulse phase is removed from the model.
Definition PulsarCalibrator.C:88
void wait()
Ensure that all queued jobs have finished.
Definition PulsarCalibrator.C:471
unsigned get_nharmonic() const
Get the number of harmonics in use.
Definition PulsarCalibrator.C:170
virtual bool match(const Archive *, bool throw_exception=true)
Ensure that the pulsar observation can be added to the data set.
Definition PulsarCalibrator.C:344
virtual void export_prepare() const
Prepare to export the solution in current state; e.g. for plotting.
Definition PulsarCalibrator.C:69
void set_maximum_harmonic(unsigned max)
Set the maximum number of harmonics to include in fit.
Definition PulsarCalibrator.C:78
~PulsarCalibrator()
Destructor.
Definition PulsarCalibrator.C:65
bool shared_phase
Share a single phase estimate between multiple observations.
Definition PulsarCalibrator.h:134
Reference::To< Unloader > unload_each
Unload the solution derived from each sub-integration.
Definition PulsarCalibrator.h:114
Calibrators derived from reference source observations.
Definition ReferenceCalibrator.h:27
Unloads Pulsar::SystemCalibrator solution to file.
Definition SystemCalibratorUnloader.h:20
SystemCalibrator(Archive *archive=0)
Construct with optional processed calibrator Archive.
Definition SystemCalibrator.C:61
Defines the PSRCHIVE library.
Definition CalSource.h:17

Generated using doxygen 1.14.0