SimplePredictor.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/resources/Pulsar/SimplePredictor.h
10 
11 #ifndef __SimplePredictor_h
12 #define __SimplePredictor_h
13 
14 #include "Pulsar/Predictor.h"
15 #include "sky_coord.h"
16 
17 #include <string>
18 #include <vector>
19 
20 
21 namespace Pulsar {
22 
24  class SimplePredictor : public Predictor {
25 
26  public:
27 
29  static double precision;
30 
32  SimplePredictor (const char* filename = 0);
33 
36 
38  Predictor* clone () const;
39 
41  Generator* generator () const;
42 
44  void insert (const Pulsar::Predictor*);
45 
47  void keep (const std::vector<MJD>& epochs);
48 
50  bool matches (const Pulsar::Predictor*) const;
51 
53  void set_observing_frequency (long double MHz);
54 
56  long double get_observing_frequency () const;
57 
59  Pulsar::Phase phase (const MJD& t) const;
60 
62  MJD iphase (const Pulsar::Phase& phase, const MJD* guess) const;
63 
65  long double frequency (const MJD& t) const;
66 
68  Pulsar::Phase dispersion (const MJD &t, long double MHz) const;
69 
71  void load (FILE*);
72 
74  void unload (FILE*) const;
75 
77  std::string get_name () const { return name; }
78 
80  sky_coord get_coordinates () const { return coordinates; }
81 
83  double get_dispersion_measure () const { return dispersion_measure; }
84 
86  void set_reference_epoch (const MJD& epoch) { reference_epoch = epoch; }
87 
89  MJD get_reference_epoch () const { return reference_epoch; }
90 
92  MJD get_reftime () const { return reference_epoch; }
94  Pulsar::Phase get_refphase () const { return 0.0; }
96  double get_reffrequency () const { return coefs.at(0); }
97 
98  private:
99 
101  std::vector<long double> coefs;
102 
104  MJD reference_epoch;
105 
107  std::string name;
108 
110  sky_coord coordinates;
111 
113  double dispersion_measure;
114 
116  std::string telescope;
117 
118  void parse(std::string key, std::string value);
119 
120  };
121 
122 }
123 
124 #endif
@ Pulsar
A pulsar.
Definition: Types.h:63
Generator * generator() const
Set up Generator to produce a new Predictor like self.
Definition: SimplePredictor.C:327
void set_observing_frequency(long double MHz)
Set the observing frequency at which predictions will be made.
Definition: SimplePredictor.C:81
void insert(const Pulsar::Predictor *)
Add the information from the supplied predictor to self.
Definition: SimplePredictor.C:55
MJD get_reftime() const
alias for reference epoch used by Pulsar::inverse_phase
Definition: SimplePredictor.h:102
SimplePredictor(const char *filename=0)
Default constructor.
Definition: SimplePredictor.C:22
bool matches(const Pulsar::Predictor *) const
Return true if reference attributes are equal.
Definition: SimplePredictor.C:68
A convenient exception handling class.
Definition: Error.h:54
void unload(FILE *) const
Unload to an open stream.
Definition: SimplePredictor.C:286
void keep(const std::vector< MJD > &epochs)
Keep only the components required to span the given epochs.
Definition: SimplePredictor.C:61
void shift(unsigned npts, float *arr, double shift)
Use the Fourier transform to cyclically shift the elements in array.
Definition: shift.C:16
Pulsar::Phase get_refphase() const
reference phase is always zero; used by Pulsar::inverse_phase
Definition: SimplePredictor.h:104
MJD get_reference_epoch() const
Get the reference epoch.
Definition: SimplePredictor.h:99
std::string get_name() const
Source name.
Definition: SimplePredictor.h:87
MJD iphase(const Pulsar::Phase &phase, const MJD *guess) const
Return the epoch, given the phase.
Definition: SimplePredictor.C:319
Generator of functions that predict pulse phase.
Definition: Generator.h:31
Pulsar::Phase phase(const MJD &t) const
Return the phase, given the epoch.
Definition: SimplePredictor.C:92
~SimplePredictor()
Destructor.
Definition: SimplePredictor.C:43
sky_coord get_coordinates() const
Coordinates.
Definition: SimplePredictor.h:90
Predictor * clone() const
Return a new, copy constructed instance of self.
Definition: SimplePredictor.C:47
Pulsar::Phase dispersion(const MJD &t, long double MHz) const
Return the phase correction for dispersion delay.
Definition: SimplePredictor.C:138
void load(FILE *)
Load from an open stream.
Definition: SimplePredictor.C:145
Functions that predict pulse phase.
Definition: Predictor.h:33
Simple pulse phase model.
Definition: SimplePredictor.h:29
void bcc1d(size_t nfft, float *into, const float *from)
Backward complex-to-complex FFT.
Definition: FTransform.C:57
Class for sky coordinates.
Definition: sky_coord.h:19
double get_reffrequency() const
spin frequency at reference epoch; used by Pulsar::inverse phase
Definition: SimplePredictor.h:106
Class for representing modified Julian dates with high precision.
Definition: MJD.h:27
Site coordinates.
Definition: Site.h:25
double get_dispersion_measure() const
Dispersion measure.
Definition: SimplePredictor.h:93
static double precision
The precision of the prediction in seconds.
Definition: SimplePredictor.h:39
long double get_observing_frequency() const
Get the observing frequency at which phase and epoch are related.
Definition: SimplePredictor.C:86
void fcc1d(size_t nfft, float *into, const float *from)
Forward complex-to-complex FFT.
Definition: FTransform.C:51
void set_reference_epoch(const MJD &epoch)
Set the reference epoch.
Definition: SimplePredictor.h:96
normalization get_norm()
Returns the normalization convention of the currently selected library.
Definition: FTransform.C:102
long double frequency(const MJD &t) const
Return the spin frequency, given the epoch.
Definition: SimplePredictor.C:116

Generated using doxygen 1.8.17