14 #include "Pulsar/Predictor.h"
15 #include "Pulsar/Generator.h"
80 std::vector<double> coefs;
108 int load (std::string* instr);
109 int unload (std::string *outstr) const;
110 int unload (FILE* fptr) const;
112 void prettyprint () const;
118 Pulsar::Phase phase ( const MJD &t) const;
121 MJD iphase ( const Pulsar::Phase& p, const MJD* = 0) const;
127 Pulsar::Phase dispersion ( const MJD &t, long double MHz) const;
135 bool is_tempov11 () const { return tempov11; }
136 char get_telescope () const { return telescope; }
137 double get_freq () const { return freq; }
139 Pulsar::Phase get_refphase () const { return ref_phase; }
140 double get_reffrequency () const { return ref_freq; }
141 double get_nspan () const { return nspan_mins; }
142 float get_dm () const { return dm; }
143 int get_ncoeff () const { return ( int) coefs.size(); }
144 double get_doppler_shift () const { return doppler_shift / 1e4; }
145 std::string get_psrname () const { return psrname; }
146 bool get_binary () const { return binary; }
147 double get_binph () const { return binph; }
150 static double flexibility;
152 MJD start_time( double f = flexibility ) const
154 MJD end_time( double f = flexibility ) const
157 Pulsar::Phase start_phase( double f = flexibility ) const
158 { return phase (start_time(f)); };
159 Pulsar::Phase end_phase( double f = flexibility ) const
160 { return phase (end_time(f)); };
167 friend int mpiPack_size ( const polynomial&, MPI_Comm comm, int* size);
168 friend int mpiPack ( const polynomial&, void* outbuf, int outcount,
169 int* position, MPI_Comm comm);
170 friend int mpiUnpack ( void* inbuf, int insize, int* position,
182 void set_tempov11 ( bool v) { instance-> tempov11 = v; }
183 void set_telescope ( char v) { instance-> telescope = v; }
184 void set_freq ( double v) { instance-> freq = v; }
185 void set_reftime ( const MJD& v) { instance-> ref_time = v; }
186 void set_refphase ( const Pulsar::Phase& v) { instance-> ref_phase = v; }
187 void set_reffrequency ( double v) { instance-> ref_freq = v; }
188 void set_nspan ( double v) { instance-> nspan_mins = v; }
189 void set_dm ( float v) { instance-> dm = v; }
190 void set_ncoef ( unsigned v) { instance-> coefs.resize(v); }
191 void set_doppler_shift ( double v) { instance-> doppler_shift = v * 1e4; }
192 void set_psrname ( const std::string& v) { instance-> psrname = v; }
193 void set_binary ( bool v) { instance-> binary = v; }
194 void set_binph ( double v) { instance-> binph = v; }
196 double* get_coefs () { return &(instance-> coefs[0]); }
227 Predictor* clone () const;
233 void insert ( const Predictor*);
236 void keep ( const std::vector<MJD>& epochs);
239 bool matches ( const Predictor*) const;
249 { return best(t). phase(t); }
252 Pulsar::Phase phase ( const MJD& t, long double MHz) const
271 void unload (FILE*) const;
278 polyco ( const std::string& id);
281 int load ( const std::string& filename);
282 int load (std::string* instr);
285 int unload ( const std::string& filename) const;
288 int unload (std::string *outstr) const;
290 void append ( const polyco& poly);
292 void prettyprint () const;
297 const polynomial& best ( const Pulsar::Phase &p) const;
299 int i_nearest ( const MJD &t, bool throw_exception = false) const;
300 int i_nearest ( const Pulsar::Phase &p, bool throw_exception = false) const;
302 double doppler_shift ( const MJD& t) const
303 { return best(t).get_doppler_shift(); };
305 double period( const MJD& t) const
306 { return best(t). period(t); };
308 double chirp( const MJD& t) const
309 { return best(t). chirp(t); };
311 double accel( const MJD& t) const
312 { return best(t). accel(t); };
314 char get_telescope () const;
315 double get_freq () const;
316 MJD get_reftime () const;
317 double get_refperiod () const;
318 double get_nspan () const;
319 float get_dm () const;
320 int get_ncoeff () const;
321 std::string get_psrname () const;
323 bool is_tempov11() const;
325 MJD start_time () const { return pollys.front().start_time(); };
326 MJD end_time () const { return pollys.back().end_time(); };
328 Pulsar::Phase start_phase () const { return pollys.front().start_phase(); };
329 Pulsar::Phase end_phase () const { return pollys.back().end_phase(); };
331 friend bool operator == ( const polyco &, const polyco &);
332 friend bool operator != ( const polyco &, const polyco &);
335 friend int mpiPack_size ( const polyco&, MPI_Comm comm, int* size);
336 friend int mpiPack ( const polyco&, void* outbuf, int outcount,
337 int* position, MPI_Comm comm);
338 friend int mpiUnpack ( void* inbuf, int insize, int* position,
345 mutable int last_index;
347 mutable MJD last_epoch;
348 mutable double last_span_epoch;
350 mutable Pulsar::Phase last_phase;
351 mutable double last_span_phase;
354 void set_last ( int i) const;
357 inline std::ostream& operator<< (std::ostream& ostr, const polyco& p)
359 std::string out; p. unload(&out); return ostr << out;
@ Pulsar A pulsar. Definition: Types.h:63
double accel(const MJD &t) const Returns the apparent acceleration toward observer (m s^-2) Definition: polyco.h:138
std::vector< polynomial > pollys The polynomial sets. Definition: polyco.h:208
Pulsar::Phase ref_phase The pulsar phase at reftime. Definition: polyco.h:46
MJD iphase(const Pulsar::Phase &p, const MJD *=0) const Returns the time at the given pulse phase. Definition: polyco.C:411
void set_ncoef(unsigned ncoef) Set the number of coefficients per polynomial ephemeris. Definition: Predict.C:121
char telescope TEMPO telescope id code. Definition: polyco.h:55
void set_nspan(unsigned minutes) Set the time spanned by each polynomial ephemeris. Definition: Predict.C:104
~polyco() Destructor. Definition: polyco.C:568
MJD iphase(const Pulsar::Phase &phase, const MJD *guess=0) const Return the epoch, given the phase. Definition: polyco.h:256
void set_observing_frequency(long double MHz) Set the observing frequency at which predictions will be made. Definition: polyco.C:620
double freq Observing frequency. Definition: polyco.h:58
double binfreq if binary, binary frequency Definition: polyco.h:67
A convenient exception handling class. Definition: Error.h:54
Pulsar::Generator * generator() const Return a new Generator set up to produce a new Predictor like self. Definition: polyco.C:588
bool binary true if the pulsar is in a binary system Definition: polyco.h:61
char code(const std::string &telescope_name) Convert a telescope name to a single-character tempo code. Definition: tempo++.C:167
long double frequency(const MJD &t) const Return the spin frequency, given the epoch. Definition: polyco.h:260
Pulsar::Phase phase(const MJD &t) const Returns the pulse phase (in turns) at the given time. Definition: polyco.C:391
bool tempov11 Flag that the polyco was created using TEMPO v.11 or greater. Definition: polyco.h:76
Pulsar::Phase dispersion(const MJD &t, long double MHz) const Return the phase correction for dispersion delay. Definition: polyco.C:459
std::string date The calendar date string. Definition: polyco.h:40
void init() intializes all values to null Definition: polyco.C:47
std::vector< double > coefs polynomial coefficients Definition: polyco.h:85
polyco() Default constructor. Definition: polyco.C:530
double doppler_shift Doppler shift due to Earth's motion along line of sight. Definition: polyco.h:79
Uses tempo orediction mode to produce polynomial ephemerides (polyco) Definition: Predict.h:26
double chirp(const MJD &t) const Returns the spin frequency derivative (in Hz/s) at the given time. Definition: polyco.C:436
Predictor * clone() const Return a new, copy constructed instance of self. Definition: polyco.C:583
Describes a single Tempo polyco set. Definition: polyco.h:25
@ Phase Pulsar Phase, for instance. Definition: Types.h:39
std::string psrname The pulsar name. Definition: polyco.h:37
double period(const MJD &t) const Returns the pulse period (in seconds) at the given time. Definition: polyco.C:454
Generator of functions that predict pulse phase. Definition: Generator.h:31
void load(FILE *) Load from an open stream. Definition: polyco.C:728
Pulsar::Phase dispersion(const MJD &t, long double MHz) const Return the phase correction for dispersion delay. Definition: polyco.h:264
double binph if binary, binary phase Definition: polyco.h:64
double nspan_mins number of minutes spanned by polynomial Definition: polyco.h:73
Pulsar::Phase phase(const MJD &t, long double MHz) const Return the phase plus the dispersion delay. Definition: polyco.h:252
void unload(FILE *) const Unload to an open stream. Definition: polyco.C:802
std::string utc The UTC string. Definition: polyco.h:43
bool matches(const Predictor *) const Return true if the Predictor configuration matches this. Definition: polyco.C:607
Functions that predict pulse phase. Definition: Predictor.h:33
long double frequency(const MJD &t) const Returns the spin frequency (in Hz) at the given time. Definition: polyco.C:419
static bool verbose Verbosity flag. Definition: Predictor.h:52
void insert(const Predictor *) Add the information from the supplied predictor to self. Definition: polyco.C:597
static double precision Determines the precision of iphase (stopping threshold) in seconds. Definition: polyco.h:100
~polynomial() destructor Definition: polyco.C:100
Class for representing modified Julian dates with high precision. Definition: MJD.h:27
long double get_observing_frequency() const Get the observing frequency at which phase and epoch are related. Definition: polyco.C:624
polynomial() default constructor Definition: polyco.C:62
Implements Predictor class for Tempo. Definition: polyco.h:202
double ref_freq Reference rotation frequency, F0 (Hz) Definition: polyco.h:49
bool keep used by polyco::keep to determine if this polynomial is used Definition: polyco.h:91
Expert interface to polynomial attributes. Definition: polyco.h:177
float dm dispersion measure Definition: polyco.h:70
double log_rms_resid log of the r.m.s residual between polynomial and model Definition: polyco.h:82
void keep(const std::vector< MJD > &epochs) Keep only the components required to span the given epochs. Definition: polyco.C:863
Pulsar::Phase phase(const MJD &t) const Return the phase, given the epoch. Definition: polyco.h:248
MJD ref_time The epoch to which the polynomial is referenced. Definition: polyco.h:52
const polyco & operator=(const polyco &) Assignment operator. Definition: polyco.C:547
Generated using doxygen 1.8.17
|