VariableBackendEstimate.h
1//-*-C++-*-
2
3/***************************************************************************
4 *
5 * Copyright (C) 2021 by Willem van Straten
6 * Licensed under the Academic Free License version 2.1
7 *
8 ***************************************************************************/
9
10// psrchive/More/Polarimetry/Pulsar/VariableBackendEstimate.h
11
12#ifndef __Pulsar_VariableBackendEstimate_H
13#define __Pulsar_VariableBackendEstimate_H
14
15#include "Pulsar/BackendEstimate.h"
16#include "Pulsar/VariableBackend.h"
17#include "Pulsar/VariableGain.h"
18#include "Pulsar/ConvertMJD.h"
19
20#include "MEAL/Scalar.h"
21#include "MEAL/Univariate.h"
22
23#include <map>
24
25namespace Calibration
26{
27 class IndexedProduct : public MEAL::ProductRule<MEAL::Complex2>
28 {
29 int index;
30
31 public:
32 IndexedProduct () { index = -1; }
33
34 bool has_index () const { return index >= 0; }
35 void set_index (unsigned _index) { index = _index; }
36 unsigned get_index () const { return index; }
37 };
38
40 class VariableBackendEstimate : public BackendEstimate
41 {
44
47
49 Reference::To<VariableBackend> variable_backend;
50
52 bool cal_backend_only = false;
53
55
60
62 Reference::To< MEAL::Scalar > gain_variation;
63 Reference::To< MEAL::Scalar > diff_gain_variation;
64 Reference::To< MEAL::Scalar > diff_phase_variation;
65
68 std::vector< unsigned > gain_imap;
69 std::vector< unsigned > diff_gain_imap;
70 std::vector< unsigned > diff_phase_imap;
71 std::vector< unsigned > backend_imap;
72
73 public:
74
77
79 void set_response (MEAL::Complex2* xform);
80
82 void add_model (MEAL::Complex2* xform);
83
85 IndexedProduct* get_psr_response () { return psr_response; }
86
88 IndexedProduct* get_cal_response () { return cal_response; }
89
91 SingleAxis* get_backend () { return variable_backend->get_backend(); }
92
94 void set_psr_constant_gain (bool = true);
95
97 void set_cal_backend_only (bool = true);
98
99 void set_gain_variation (MEAL::Univariate<MEAL::Scalar>*);
100 void set_diff_gain_variation (MEAL::Univariate<MEAL::Scalar>*);
101 void set_diff_phase_variation (MEAL::Univariate<MEAL::Scalar>*);
102
105
107 void update ();
108
110 void update (MEAL::Scalar* function, double value);
111
113
114 bool reduce_nfree ();
115
118
120 void engage_time_variations ();
121 void disengage_time_variations ();
122
123 void unmap_variations (std::vector<unsigned>& imap,
124 MEAL::Complex2* composite);
125
126 void compute_covariance (std::vector<unsigned>& imap,
127 std::vector< std::vector<double> >& Ctotal);
128
129
130 };
131}
132
133#endif
134
Converts Argument type from MJD to double.
Definition ConvertMJD.h:20
Instrumental gain, differential gain, and differential phase.
Definition SingleAxis.h:38
bool reduce_nfree()
Attempt to reduced the number of degrees of freedom.
Definition VariableBackendEstimate.C:209
void add_model(MEAL::Complex2 *xform)
Multiply psr_response by xform and cal_response by backend.
Definition VariableBackendEstimate.C:94
VariableBackendEstimate(MEAL::Complex2 *response=0)
Construct using the supplied response.
Definition VariableBackendEstimate.C:22
Calibration::ConvertMJD convert
Used to convert MJD to double.
Definition VariableBackendEstimate.h:104
IndexedProduct * get_cal_response()
Get the response for calibrator observations.
Definition VariableBackendEstimate.h:88
void update()
Update the transformation with the current estimate, if possible.
Definition VariableBackendEstimate.C:105
IndexedProduct * get_psr_response()
Get the response for pulsar observations.
Definition VariableBackendEstimate.h:85
void update_reference_epoch()
Update the reference epoch.
Definition VariableBackendEstimate.C:186
void set_response(MEAL::Complex2 *xform)
Set the response that contains the backend.
Definition VariableBackendEstimate.C:43
void set_cal_backend_only(bool=true)
Set true when the cal signal is coupled after the feed.
Definition VariableBackendEstimate.C:259
SingleAxis * get_backend()
Get the backend component.
Definition VariableBackendEstimate.h:91
void set_psr_constant_gain(bool=true)
Set true when the pulsar Stokes parameters have been normalized.
Definition VariableBackendEstimate.C:225

Generated using doxygen 1.14.0