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
21namespace 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
Class for representing modified Julian dates with high precision.
Definition MJD.h:23
Generator of functions that predict pulse phase.
Definition Generator.h:26
Functions that predict pulse phase.
Definition Predictor.h:28
Pulsar::Phase dispersion(const MJD &t, long double MHz) const
Return the phase correction for dispersion delay.
Definition SimplePredictor.C:138
double get_dispersion_measure() const
Dispersion measure.
Definition SimplePredictor.h:83
void load(FILE *)
Load from an open stream.
Definition SimplePredictor.C:145
double get_reffrequency() const
spin frequency at reference epoch; used by Pulsar::inverse phase
Definition SimplePredictor.h:96
void unload(FILE *) const
Unload to an open stream.
Definition SimplePredictor.C:286
MJD get_reference_epoch() const
Get the reference epoch.
Definition SimplePredictor.h:89
Pulsar::Phase get_refphase() const
reference phase is always zero; used by Pulsar::inverse_phase
Definition SimplePredictor.h:94
Generator * generator() const
Set up Generator to produce a new Predictor like self.
Definition SimplePredictor.C:327
void insert(const Pulsar::Predictor *)
Add the information from the supplied predictor to self.
Definition SimplePredictor.C:55
void set_reference_epoch(const MJD &epoch)
Set the reference epoch.
Definition SimplePredictor.h:86
bool matches(const Pulsar::Predictor *) const
Return true if reference attributes are equal.
Definition SimplePredictor.C:68
sky_coord get_coordinates() const
Coordinates.
Definition SimplePredictor.h:80
Predictor * clone() const
Return a new, copy constructed instance of self.
Definition SimplePredictor.C:47
long double get_observing_frequency() const
Get the observing frequency at which phase and epoch are related.
Definition SimplePredictor.C:86
~SimplePredictor()
Destructor.
Definition SimplePredictor.C:43
static double precision
The precision of the prediction in seconds.
Definition SimplePredictor.h:29
MJD get_reftime() const
alias for reference epoch used by Pulsar::inverse_phase
Definition SimplePredictor.h:92
Pulsar::Phase phase(const MJD &t) const
Return the phase, given the epoch.
Definition SimplePredictor.C:92
MJD iphase(const Pulsar::Phase &phase, const MJD *guess) const
Return the epoch, given the phase.
Definition SimplePredictor.C:319
void keep(const std::vector< MJD > &epochs)
Keep only the components required to span the given epochs.
Definition SimplePredictor.C:61
void set_observing_frequency(long double MHz)
Set the observing frequency at which predictions will be made.
Definition SimplePredictor.C:81
long double frequency(const MJD &t) const
Return the spin frequency, given the epoch.
Definition SimplePredictor.C:116
std::string get_name() const
Source name.
Definition SimplePredictor.h:77
SimplePredictor(const char *filename=0)
Default constructor.
Definition SimplePredictor.C:22
Class for sky coordinates.
Definition sky_coord.h:20

Generated using doxygen 1.14.0