T2Predictor.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2007 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Util/tempo2/T2Predictor.h
10 
11 #ifndef __Tempo2Predictor_h
12 #define __Tempo2Predictor_h
13 
14 #include "Pulsar/Predictor.h"
15 
16 // From the TEMPO2 distribution
17 #include <tempo2pred.h>
18 
19 namespace Tempo2 {
20 
21  class Generator;
22 
24 
26  class Predictor : public Pulsar::Predictor {
27 
28  public:
29 
32 
34  Predictor (const Predictor&);
35 
37  ~Predictor ();
38 
40  Pulsar::Predictor* clone () const;
41 
43  Pulsar::Generator* generator () const;
44 
46  unsigned get_time_ncoeff () const;
47 
49  unsigned get_frequency_ncoeff () const;
50 
52  long double get_segment_length () const;
53 
55  std::string get_psrname () const;
56 
58  std::string get_sitename () const;
59 
61  long double get_freq_start () const;
62 
64  long double get_freq_end () const;
65 
67  long double get_dispersion_constant () const;
68 
70  void insert (const Pulsar::Predictor*);
71 
73  void keep (const std::vector<MJD>& epochs);
74 
76  bool matches (const Pulsar::Predictor*) const;
77 
79  void set_observing_frequency (long double MHz);
80 
82  long double get_observing_frequency () const;
83 
85  Pulsar::Phase phase (const MJD& t) const;
86 
88  MJD iphase (const Pulsar::Phase& phase, const MJD* guess) const;
89 
91  long double frequency (const MJD& t) const;
92 
94  Pulsar::Phase dispersion (const MJD &t, long double MHz) const;
95 
97  void load (FILE*);
98 
100  void unload (FILE*) const;
101 
103  void sanity_check (const char* context) const;
104 
105  private:
106 
107  friend class Generator;
108 
110  T2Predictor predictor;
111 
113  long double observing_frequency;
114 
115  };
116 
117 }
118 
120 long double from_MJD (const MJD& t);
121 
123 MJD to_MJD (long double t);
124 
125 #endif
Pulsar::Predictor * clone() const
Return a new, copy constructed instance of self.
Definition: T2Predictor.C:42
long double get_dispersion_constant() const
Get the disersion constant.
Definition: T2Predictor.C:178
void sanity_check(const char *context) const
Perform a sanity check on the T2Predictor.
Definition: T2Predictor.C:102
Pulsar::Generator * generator() const
Return a new Generator set up to produce a new Predictor like self.
Definition: T2Predictor.C:49
A convenient exception handling class.
Definition: Error.h:54
unsigned get_frequency_ncoeff() const
Get the number of frequency coefficients.
Definition: T2Predictor.C:69
Predictor()
Default constructor.
Definition: T2Predictor.C:22
long double get_freq_start() const
Get the start frequency in MHz.
Definition: T2Predictor.C:164
void keep(const std::vector< MJD > &epochs)
Keep only the components required to span the given epochs.
Definition: T2Predictor.C:130
void set_time_ncoeff(unsigned ncoeff)
Set the number of time coefficients.
Definition: T2Generator.C:147
void unload(FILE *) const
Unload to an open stream.
Definition: T2Predictor.C:351
long double frequency(const MJD &t) const
Return the spin frequency, given the epoch.
Definition: T2Predictor.C:316
std::string get_psrname() const
Get the name of the pulsar.
Definition: T2Predictor.C:150
Generator of functions that predict pulse phase.
Definition: Generator.h:31
long double get_segment_length() const
Get the length of each polynomial segment in days.
Definition: T2Predictor.C:77
void set_frequency_ncoeff(unsigned ncoeff)
Set the number of frequency coefficients.
Definition: T2Generator.C:153
long double get_observing_frequency() const
Get the observing frequency at which phase and epoch are related.
Definition: T2Predictor.C:248
MJD iphase(const Pulsar::Phase &phase, const MJD *guess) const
Return the epoch, given the phase.
Definition: T2Predictor.C:444
Functions that predict pulse phase.
Definition: T2Predictor.h:31
unsigned get_time_ncoeff() const
Get the number of time coefficients.
Definition: T2Predictor.C:61
Pulsar::Phase phase(const MJD &t) const
Return the phase, given the epoch.
Definition: T2Predictor.C:286
Functions that predict pulse phase.
Definition: Predictor.h:33
void set_segment_length(long double days)
Set the length of each polynomial segment in days.
Definition: T2Generator.C:159
std::string get_sitename() const
Get the name of the observatory.
Definition: T2Predictor.C:157
bool matches(const Pulsar::Predictor *) const
Return true if the Predictor configuration matches this.
Definition: T2Predictor.C:185
long double get_freq_end() const
Get the end frequency in MHz.
Definition: T2Predictor.C:171
Pulsar::Phase dispersion(const MJD &t, long double MHz) const
Return the phase correction for dispersion delay.
Definition: T2Predictor.C:330
void insert(const Pulsar::Predictor *)
Add the information from the supplied predictor to self.
Definition: T2Predictor.C:115
Generates a Tempo2::Predictor.
Definition: T2Generator.h:26
Class for representing modified Julian dates with high precision.
Definition: MJD.h:27
~Predictor()
Destructor.
Definition: T2Predictor.C:35
void set_observing_frequency(long double MHz)
Set the observing frequency at which predictions will be made.
Definition: T2Predictor.C:242
void load(FILE *)
Load from an open stream.
Definition: T2Predictor.C:335

Generated using doxygen 1.8.17