Predictor.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/tempo/Pulsar/Predictor.h
10 
11 #ifndef __PulsarPredictor_h
12 #define __PulsarPredictor_h
13 
14 #include "Reference.h"
15 #include "Phase.h"
16 #include "MJD.h"
17 #include "Configuration.h"
18 
19 #include <stdio.h>
20 
21 namespace Pulsar {
22 
23  class Generator;
24 
26 
28  class Predictor : public Reference::Able {
29 
30  public:
31 
33  enum Policy
34  {
36  Input,
40  Ephemeris
41  };
42 
45 
47  static bool verbose;
48 
50  virtual Predictor* clone () const = 0;
51 
53  virtual Generator* generator () const = 0;
54 
56 
57  virtual void insert (const Predictor*) = 0;
58 
60  virtual void keep (const std::vector<MJD>& epochs) = 0;
61 
63  virtual bool matches (const Predictor*) const = 0;
64 
66  virtual void set_observing_frequency (long double MHz) = 0;
67 
69  virtual long double get_observing_frequency () const = 0;
70 
72  virtual Phase phase (const MJD& t) const = 0;
73 
75  virtual MJD iphase (const Phase& phase, const MJD* guess = 0) const = 0;
76 
78  virtual long double frequency (const MJD& t) const = 0;
79 
81  virtual Phase dispersion (const MJD &t, long double MHz) const = 0;
82 
84  virtual void load (FILE*) = 0;
85 
87  virtual void unload (FILE*) const = 0;
88 
90  virtual void load_file (const std::string& filename);
92  virtual void unload_file (const std::string& filename) const;
93 
95  static void children (std::vector< Reference::To<Predictor> >&);
96 
97  };
98 
99  std::ostream& operator<< (std::ostream& ostr, Predictor::Policy p);
100 
101  std::istream& operator>> (std::istream& istr, Predictor::Policy& p);
102 }
103 
104 #endif
@ Pulsar
A pulsar.
Definition: Types.h:63
virtual long double frequency(const MJD &t) const =0
Return the spin frequency, given the epoch.
static Configuration::Parameter< Policy > & get_policy()
Policy for creating new predictors.
virtual void unload_file(const std::string &filename) const
Unload to the specified file.
Definition: Predictor.C:17
virtual Generator * generator() const =0
Return a new Generator set up to produce a new Predictor like self.
virtual void set_observing_frequency(long double MHz)=0
Set the observing frequency at which phase and time are related.
virtual void insert(const Predictor *)=0
Add the information from the supplied predictor to self.
virtual MJD iphase(const Phase &phase, const MJD *guess=0) const =0
Return the epoch, given the phase and, optionally, a first guess.
virtual void unload(FILE *) const =0
Unload to an open stream.
Template class manages Reference::Able objects.
Definition: Reference.h:74
@ Input
Clone the input predictor.
Definition: Predictor.h:41
virtual long double get_observing_frequency() const =0
Get the observing frequency at which phase and epoch are related.
Generator of functions that predict pulse phase.
Definition: Generator.h:31
static void children(std::vector< Reference::To< Predictor > > &)
Factory helper creates a vector of pointers to derived class instances.
Definition: Predictor_children.C:22
Manages Reference::To references to the instance.
Definition: ReferenceAble.h:40
Closes a FILE* when it goes out of scope.
Definition: FilePtr.h:18
virtual void load(FILE *)=0
Load from an open stream.
Functions that predict pulse phase.
Definition: Predictor.h:33
A configurable parameter.
Definition: Configuration.h:47
static bool verbose
Verbosity flag.
Definition: Predictor.h:52
virtual void keep(const std::vector< MJD > &epochs)=0
Keep only the components required to span the given epochs.
virtual bool matches(const Predictor *) const =0
Return true if the Predictor configuration matches this.
@ Default
Generate a new predictor using the default generator.
Definition: Predictor.h:43
virtual Phase dispersion(const MJD &t, long double MHz) const =0
Return the phase correction for dispersion delay.
virtual Predictor * clone() const =0
Return a new, copy constructed instance of self.
Class for representing modified Julian dates with high precision.
Definition: MJD.h:27
virtual void load_file(const std::string &filename)
Load from the specified file.
Definition: Predictor.C:11
virtual Phase phase(const MJD &t) const =0
Return the phase, given the epoch.
Policy
Policy for creating new predictors.
Definition: Predictor.h:38
@ Ephemeris
Generate a new predictor based on the input ephemeris.
Definition: Predictor.h:45

Generated using doxygen 1.8.17