PolnProfile.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/PolnProfile.h
10 
11 #ifndef __Pulsar_PolnProfile_h
12 #define __Pulsar_PolnProfile_h
13 
14 #include "Pulsar/Profile.h"
15 
16 #include "Stokes.h"
17 #include "Jones.h"
18 #include "Matrix.h"
19 #include "Quaternion.h"
20 
21 namespace Pulsar {
22 
23  class StokesCovariance;
24  class BaselineEstimator;
25 
27 
29  class PolnProfile : public Container {
30 
31  public:
32 
35 
37  PolnProfile ();
38 
40  PolnProfile (unsigned nbin);
41 
44  Profile* p0, Profile* p1, Profile* p2, Profile* p3);
45 
47  virtual ~PolnProfile();
48 
50  virtual PolnProfile* clone () const;
51 
53  void resize (unsigned nbin);
54 
56  unsigned get_nbin () const;
57 
59  const Profile* get_Profile (unsigned ipol) const;
60 
62  Profile* get_Profile (unsigned ipol);
63 
65  const float* get_amps (unsigned ipol) const;
66 
68  float* get_amps (unsigned ipol);
69 
71  void set_amps (unsigned ipol, float* amps);
72 
74  void set_baseline (PhaseWeight*);
75 
77  PhaseWeight* get_baseline () const;
78 
80  void sum (const PolnProfile* that);
81 
83  void diff (const PolnProfile* that);
84 
86  Signal::Basis get_basis () const { return basis; }
87 
89  Signal::State get_state () const { return state; }
90 
92  Stokes<float> get_Stokes (unsigned ibin) const;
93 
95  void set_Stokes (unsigned ibin, const Stokes<float>&);
96 
98  Jones<double> get_coherence (unsigned ibin) const;
99 
101  void set_coherence (unsigned ibin, const Jones<double>&);
102 
104  Quaternion<float,Hermitian> get_pseudoStokes (unsigned ibin) const;
105 
107  void set_pseudoStokes (unsigned ibin, const Quaternion<float,Hermitian>&);
108 
110  double sum (int bin_start=0, int bin_end=0) const;
111 
113  double sumsq (int bin_start=0, int bin_end=0) const;
114 
116  void scale (double scale);
117 
119  void rotate_phase (double turns);
120 
122  void transform (const Jones<double>& response);
123 
125  void transform (const Matrix<4,4,double>& response);
126 
129 
132 
134  void invint (Profile* invint, bool second = true) const;
135 
137  void invconv (Profile* invconv) const;
138 
140  void get_linear (Profile* linear) const;
141 
143  double get_linear_variance () const;
144 
146  double get_linear_variance (std::pair<double,double>& qu_var) const;
147 
149  void get_circular (Profile* circular) const;
150 
152  void get_polarized (Profile* polarized) const;
153 
155  void get_orientation (std::vector< Estimate<double> >&, float sigma) const;
156 
158  void get_ellipticity (std::vector< Estimate<double> >&, float sigma) const;
159 
160  void get_linear (std::vector< std::complex< Estimate<double> > >& L,
161  float sigma) const;
162 
163  const StokesCovariance* get_covariance () const;
164  StokesCovariance* get_covariance ();
165 
166  protected:
167 
170 
173 
176 
179 
182 
185 
187  void check (const char* method,
188  Signal::State want_state,
189  unsigned want_ibin) const;
190 
192  void sum_difference (Profile* sum, Profile* difference);
193 
195  void init ();
196 
198  void get_rss( Profile* rss, unsigned jpol, unsigned kpol,
199  BaselineEstimator* baseline_estimator = 0 ) const;
200 
201  };
202 
203 }
204 
205 
206 #endif
207 
208 
209 
void set_coherence(unsigned ibin, const Jones< double > &)
Set the coherency matrix for the specified bin.
Definition: PolnProfile.C:316
void set_baseline(PhaseWeight *)
Set the baseline used by some methods.
Definition: PolnProfile.C:329
Profile * complex_fourier_transform(const Profile *, FTransform::Plan *=0)
Return the forward Fourier transform of the input Profile.
Definition: Fourier.C:61
Stokes< float > get_Stokes(unsigned ibin) const
Get the Stokes 4-vector for the specified bin.
Definition: PolnProfile.C:246
Signal::State get_state() const
Get the State of the poln profile.
Definition: PolnProfile.h:94
void sum(const PolnProfile *that)
Add that to this.
Definition: PolnProfile.C:117
Reference::To< Profile > profile[4]
References to the polarimetric profiles.
Definition: PolnProfile.h:180
void set_Stokes(unsigned ibin, const Stokes< float > &)
Set the Stokes 4-vector for the specified bin.
Definition: PolnProfile.C:259
void get_orientation(std::vector< Estimate< double > > &, float sigma) const
Return the orientation and its estimated error for each pulse phase.
Definition: PolnProfile.C:889
virtual PolnProfile * clone() const
Clone operator.
Definition: PolnProfile.C:42
void set_amps(unsigned ipol, float *amps)
Set the amplitudes of the specified polarization.
Definition: PolnProfile.C:195
Reference::To< PhaseWeight > baseline
The baseline set in set_baseline.
Definition: PolnProfile.h:183
void offset(double offset)
offsets each bin of the profile by offset
Definition: Profile.C:301
const float * get_amps(unsigned ipol) const
Returns a const pointer to the start of the array of amplitudes.
Definition: PolnProfile.C:171
const PolnProfile * get_Stokes(const Archive *data, Index subint, Index chan)
Return a new PolnProfile with state == Signal::Stokes.
Definition: Index.C:158
virtual ~PolnProfile()
Destructor.
Definition: PolnProfile.C:92
void get_polarized(Profile *polarized) const
Return the total polarization profile.
Definition: PolnProfile.C:725
const float * get_amps() const
Return a pointer to the amplitudes array.
Definition: ProfileAmps.C:141
void invconv(Profile *invconv) const
Return the invariant autoconvolution.
Definition: PolnProfile.C:609
void get_rss(Profile *rss, unsigned jpol, unsigned kpol, BaselineEstimator *baseline_estimator=0) const
Does the work for get_polarized and get_linear.
Definition: PolnProfile.C:690
unsigned get_nparam() const
Reference::To< PhaseWeight > my_baseline
The baseline derived from the data.
Definition: PolnProfile.h:186
virtual void set_centre_frequency(double cfreq)
set the centre frequency (in MHz)
Definition: Profile.h:204
Stores a weight for each Profile phase bin.
Definition: PhaseWeight.h:29
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
Signal::Basis basis
The basis in which the radiation is measured.
Definition: PolnProfile.h:174
Quaternion< float, Hermitian > get_pseudoStokes(unsigned ibin) const
Get the pseudo-Stokes 4-vector for the specified bin.
Definition: PolnProfile.C:274
unsigned get_nbin() const
Return the number of bins.
Definition: ProfileAmps.h:50
PolnProfile()
Default constructor.
Definition: PolnProfile.C:36
void get_circular(Profile *circular) const
Return the absolute circular polarization profile.
Definition: PolnProfile.C:744
Jones< double > get_coherence(unsigned ibin) const
Get the coherency matrix for the specified bin.
Definition: PolnProfile.C:302
static bool normalize_weight_by_absolute_gain
When set, PolnProfile::transform will normalize the Profile::weight.
Definition: PolnProfile.h:39
unsigned get_nbin() const
Get the number of bins.
Definition: PolnProfile.C:139
double sumsq(int bin_start=0, int bin_end=0) const
Returns the sum of all amplitudes squared.
Definition: PolnProfile.C:444
void check(const char *method, Signal::State want_state, unsigned want_ibin) const
Throw an exception if want_state != state or want_ibin >= nbin.
Definition: PolnProfile.C:229
void resize(unsigned nbin)
Set the number of bins.
Definition: PolnProfile.C:101
Signal::State state
The state of the polarimetric profiles.
Definition: PolnProfile.h:177
Signal::Basis get_basis() const
Get the Basis of the poln profile.
Definition: PolnProfile.h:91
Reference::To< StokesCovariance > covariance
The phase-resolved four-dimensional Stokes covariance matrix.
Definition: PolnProfile.h:189
void get_ellipticity(std::vector< Estimate< double > > &, float sigma) const
Return the ellipticity and its estimated error for each pulse phase.
Definition: PolnProfile.C:759
Polarimetric pulse profile transformations and derivations.
Definition: PolnProfile.h:34
PhaseWeight * baseline(const Profile *)
Returns a new PhaseWeight instance.
Definition: BaselineEstimator.C:73
void diff(const PolnProfile *that)
Subtract that from this.
Definition: PolnProfile.C:127
void set_pseudoStokes(unsigned ibin, const Quaternion< float, Hermitian > &)
Set the pseudo-Stokes 4-vector for the specified bin.
Definition: PolnProfile.C:288
Polarimetric calibrators.
Definition: PolnCalibrator.h:41
Finds a baseline that contains gaussian white noise.
Definition: ExponentialBaseline.h:24
void zero()
set all amplitudes to zero
Definition: Profile.C:365
void transform(const Jones< double > &response)
Perform the congruence transformation on each bin of the profile.
Definition: PolnProfile.C:362
PhaseWeight * baseline() const
Return a new PhaseWeight instance with the baseline phase bins masked.
Definition: Profile_baseline.C:15
void bcc1d(size_t nfft, float *into, const float *from)
void scale(double scale)
multiplies each bin of each profile by scale
Definition: PolnProfile.C:334
double get_linear_variance() const
Return the variance of L estimated from off-pulse Q and U.
Definition: PolnProfile.C:824
Defines the PSRCHIVE library.
Definition: CalSource.h:17
void convert_state(Signal::State state)
Convert to the specified state.
Definition: PolnProfile.C:455
const Profile * get_Profile(const Archive *data, Index subint, Index pol, Index chan)
Return the requested profile, cloning and integrating when needed.
Definition: Index.C:24
void init()
Set everthing to null values.
void get_linear(Profile *linear) const
Return the linear polarization profile.
Definition: PolnProfile.C:733
void sum_difference(Profile *sum, Profile *difference)
Efficiently forms the inplace sum and difference of two profiles.
Definition: PolnProfile.C:525
Phase-resolved four-dimensional covariance matrix of Stokes parameters.
Definition: StokesCovariance.h:31
virtual void set_weight(float)
set the weight of the profile
Definition: Profile.C:185
void rotate_phase(double turns)
Rotate the phase of each profile.
Definition: PolnProfile.C:343
void convert_basis(Signal::Basis basis)
Convert the Stokes parameters to the specified basis.
Definition: PolnProfile.C:550
void square_root()
calculate the signed sqrt of the absolute value of each bin
Definition: Profile.C:381
void invint(Profile *invint, bool second=true) const
Return the invariant interval.
Definition: PolnProfile.C:576
ProfileWeight algorithms that compute profile baselines.
Definition: BaselineEstimator.h:24
virtual void resize(unsigned nbin)
resize the data area
Definition: Profile.C:134
Definition: FourthMoments.h:24
const Profile * get_Profile(unsigned ipol) const
Get the specifed constant profile.
Definition: PolnProfile.C:147
PhaseWeight * get_baseline() const
Get the baseline (if not the one set above, then the default)
Definition: PolnProfile.C:207
virtual unsigned get_size() const
get the size of the profile vector
Definition: MoreProfiles.C:44

Generated using doxygen 1.8.17