ImageCorrection.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2018 by Paul Demorest
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/General/Pulsar/ImageCorrection.h
10 
11 #ifndef __Pulsar_ImageCorrection_h
12 #define __Pulsar_ImageCorrection_h
13 
14 #include "Pulsar/Transformation.h"
15 
16 #include "TextInterface.h"
17 
18 namespace Pulsar {
19 
20  class Archive;
21  class Integration;
22 
24  class ImageCorrection : public Transformation<Integration> {
25 
26  public:
27 
30 
32  void correct (Archive*);
33 
35  void transform (Integration*);
36 
39 
41  class Interface;
42 
44  void set_strict(bool flag=true) { strict = flag; }
45 
47  bool get_strict() const { return strict; }
48 
50  void set_coherent(bool flag=true) { coherent = flag; }
51 
53  bool get_coherent() const { return coherent; }
54 
56  void set_fadc(double f) { f_cent_adc = f; }
57 
59  double get_fadc() const { return f_cent_adc; }
60 
62  void set_fcenter(double f) { f_cent_sky = f; }
63 
65  double get_fcenter() const { return f_cent_sky; }
66 
68  void set_band_dir(int d) { dir = d; }
69 
71  int get_band_dir() const { return dir; }
72 
74  void set_dt(double dt0, double dt1) { dt[0]=dt0; dt[1]=dt1; }
75 
77  void set_gain(double a0, double a1) { alpha[0]=a0; alpha[1]=a1; }
78 
79  protected:
80 
82  double f_cent_adc;
83 
85  double f_cent_sky;
86 
88  int dir;
89 
90  // Note, all of the above imply that the conversion between
91  // sky freq (f_sky) and sampled freq (f_adc) are:
92  // f_adc = dir*(f_sky-f_cent_sky) + f_cent_adc
93  double f_adc(double f_sky) const
94  {
95  return (double)dir*(f_sky-f_cent_sky) + f_cent_adc;
96  }
97 
99  bool strict;
100 
102  bool coherent;
103 
105  double dt[2];
106 
108  double alpha[2];
109 
111  // into channel at 2*f_center - f
112  double ratio(double f, unsigned ipol) const;
113 
115  int match_channel(const Integration *subint, double f_sky) const;
116 
117  };
118 
119 }
120 
121 #endif
double get_fcenter() const
Get sky center freq.
Definition: ImageCorrection.h:70
bool strict
strict==true means uncorrectable channels will be zero-weighted
Definition: ImageCorrection.h:104
virtual unsigned get_npol() const =0
Get the number of polarization measurements.
void set_strict(bool flag=true)
Set strict mode.
Definition: ImageCorrection.h:49
bool get_strict() const
Get strict setting.
Definition: ImageCorrection.h:52
const float * get_amps() const
Return a pointer to the amplitudes array.
Definition: ProfileAmps.C:141
void transform(Integration *)
Perform correction on one integration.
Definition: ImageCorrection.C:62
void frc1d(size_t nfft, float *into, const float *from)
bool coherent
Set true if data have been coherently dedispersed.
Definition: ImageCorrection.h:107
double get_centre_frequency(unsigned ichan) const
Get the Profile centre frequency attribute of the given channel.
Definition: Integration.C:359
void bcr1d(size_t nfft, float *into, const float *from)
virtual unsigned get_nsubint() const =0
Get the number of sub-integrations stored in the file.
int get_band_dir() const
Get band direction.
Definition: ImageCorrection.h:76
void set_fadc(double f)
Set center freq at sampler.
Definition: ImageCorrection.h:61
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
The primary interface to pulsar observational data.
Definition: Archive.h:45
virtual unsigned get_nbin() const =0
Get the number of bins in each profile.
double f_cent_sky
The center sky frequency of the sampled band (MHz)
Definition: ImageCorrection.h:90
double get_fadc() const
Set center freq at sampler.
Definition: ImageCorrection.h:64
unsigned get_nbin() const
Return the number of bins.
Definition: ProfileAmps.h:50
Signal::State get_state() const
Get the polarimetric state of the profiles.
Definition: Integration.C:599
void set_band_dir(int d)
Set band direction at sampler.
Definition: ImageCorrection.h:73
virtual Integration * clone() const =0
Return a new copy of self.
float get_weight(unsigned ichan) const
Get the Profile weight attribute of the given channel.
Definition: Integration.C:388
double dt[2]
The time misalignment between samplers, per-poln (us)
Definition: ImageCorrection.h:110
Integration * get_Integration(unsigned subint)
Return pointer to the specified Integration.
Definition: IntegrationManager.C:41
double f_cent_adc
The center frequency of the band at the ADC (MHz)
Definition: ImageCorrection.h:87
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
double get_dispersion_measure() const
Get the dispersion measure (in )
Definition: Integration.C:456
int dir
Band direction at the sampler.
Definition: ImageCorrection.h:93
void set_weight(unsigned ichan, float weight)
Set the Profile weight attributes of the given channel.
Definition: Integration.C:401
virtual TextInterface::Parser * get_interface()
Return a text interface that can be used to configure this instance.
Definition: ImageCorrection.C:213
double get_bandwidth() const
Get the bandwidth (in MHz)
Definition: Integration.C:445
Corrects band-reversed signal due to poor image rejection.
Definition: ImageCorrection.h:29
void set_fcenter(double f)
Set sky center freq.
Definition: ImageCorrection.h:67
double ratio(double f, unsigned ipol) const
The ratio of image power from input sampler freq f.
Definition: ImageCorrection.C:148
void set_coherent(bool flag=true)
Set coherent dedisp flag.
Definition: ImageCorrection.h:55
void correct(Archive *)
Perform correction on full archive.
Definition: ImageCorrection.C:32
virtual unsigned get_nchan() const =0
Get the number of chans.
bool get_dedispersed() const
Inter-channel dispersion delay has been removed.
Definition: Integration.C:467
Defines the PSRCHIVE library.
Definition: CalSource.h:17
void set_gain(double a0, double a1)
Set gain per poln.
Definition: ImageCorrection.h:82
virtual double get_folding_period() const =0
Get the folding or topocentric pulsar period (in seconds)
ImageCorrection()
Default constructor.
Definition: ImageCorrection.C:21
Profile * get_Profile(unsigned ipol, unsigned ichan)
Returns a pointer to the Profile given by the specified indeces.
Definition: Integration.C:306
bool get_coherent() const
Get coherent dedisp flag.
Definition: ImageCorrection.h:58
int match_channel(const Integration *subint, double f_sky) const
Find channel matching given sky freq, returns -1 for no match.
Definition: ImageCorrection.C:166
void set_dt(double dt0, double dt1)
Set dt per poln.
Definition: ImageCorrection.h:79
double alpha[2]
The gain mismatch between samplers, per-poln.
Definition: ImageCorrection.h:113

Generated using doxygen 1.8.17