PuMaArchive.h
1 //-*-C++-*-
2 
3 // psrchive/Base/Formats/PuMa/Pulsar/PuMaArchive.h
4 
5 #ifndef __PuMaArchive_h
6 #define __PuMaArchive_h
7 
8 #include "Pulsar/Archive.h"
9 #include "Pulsar/Agent.h"
10 
11 // PuMa header definition
12 #include <pumadata.h>
13 
14 namespace Pulsar {
15 
17 
24  class PuMaArchive : public Archive {
25 
26  public:
27 
29  PuMaArchive ();
30 
32  PuMaArchive (const PuMaArchive& archive);
33 
35  ~PuMaArchive ();
36 
38  const PuMaArchive& operator = (const PuMaArchive& archive);
39 
41  PuMaArchive (const Archive& archive);
42 
44  void copy (const Archive& archive);
45 
46  // //////////////////////////////////////////////////////////////////
47  //
48  // Implementation of Pulsar::Archive pure virtual methods
49  //
50  // //////////////////////////////////////////////////////////////////
51 
53  Archive* clone () const;
54 
56  unsigned get_nbin () const;
57 
59  unsigned get_nchan () const;
60 
62  unsigned get_npol () const;
63 
65  unsigned get_nsubint () const;
66 
68  std::string get_telescope () const;
70  void set_telescope (const std::string& telescope);
71 
73  Signal::State get_state () const;
75  void set_state (Signal::State state);
76 
78  virtual Signal::Scale get_scale () const;
80  virtual void set_scale (Signal::Scale scale);
81 
83  Signal::Source get_type () const;
85  void set_type (Signal::Source type);
86 
88  std::string get_source () const;
90  void set_source (const std::string& source);
91 
93  std::string get_backend () const;
95  void set_backend (const std::string& bak);
96 
98  std::string get_receiver () const;
100  void set_receiver (const std::string& rec);
101 
103  sky_coord get_coordinates () const;
105  void set_coordinates (const sky_coord& coordinates);
106 
108  double get_centre_frequency () const;
110  void set_centre_frequency (double cf);
111 
113  double get_bandwidth () const;
115  void set_bandwidth (double bw);
116 
118  double get_dispersion_measure () const;
120  void set_dispersion_measure (double dm);
121 
123  bool get_dedispersed () const;
125  void set_dedispersed (bool done = true);
126 
128  double get_rotation_measure () const;
130  void set_rotation_measure (double rm);
131 
133  bool get_faraday_corrected () const;
135  void set_faraday_corrected (bool done = true);
136 
138  bool get_poln_calibrated () const;
140  void set_poln_calibrated (bool done = true);
141 
142 
143  protected:
144 
146  void set_nbin (unsigned numbins);
147 
149  void set_nchan (unsigned numchan);
150 
152  void set_npol (unsigned numpol);
153 
155  void set_nsubint (unsigned nsubint);
156 
158  Integration* new_Integration (const Integration* copy_this = 0);
159 
161  void load_header (const char* filename);
162 
164  static void load_header (Header_type& hdr, const char* filename);
165 
167  Integration*
168  load_Integration (const char* filename, unsigned subint);
169 
171  bool can_unload () const { return true; }
172 
174  void unload_file (const char* filename) const;
175 
176  // //////////////////////////////////////////////////////////////////
177  //
178  // Pulsar::PuMaArchive::Agent
179  //
180  // //////////////////////////////////////////////////////////////////
181 
182  friend class Archive::Advocate<PuMaArchive>;
183 
185  class Agent : public Archive::Advocate<PuMaArchive> {
186 
187  public:
188 
190  Agent ();
191 
193  bool advocate (const char* filename);
194 
196  std::string get_name () { return "PuMa"; }
197 
199  std::string get_description ();
200 
201  };
202 
203  private:
204 
206  Header_type hdr;
207 
209  unsigned npol;
210 
212  Signal::State state;
213 
215  Signal::Source source;
216 
218  unsigned header_bytes;
219 
221  bool little_endian;
222 
224  void init ();
225 
227  void set_GenType (int code, bool done);
228 
229  };
230 
231 
232 }
233 
234 #endif
bool advocate(const char *filename)
Advocate the use of PuMaArchive to interpret filename.
Definition: PuMaArchive.C:590
unsigned get_nsubint() const
Get the number of sub-integrations stored in the file.
Definition: PuMaArchive.C:128
void set_type(Signal::Source type)
Set the observation type (psr, cal)
Definition: PuMaArchive.C:205
bool can_unload() const
The unload_file method is implemented.
Definition: PuMaArchive.h:171
sky_coord get_coordinates() const
Get the coordinates of the source.
Definition: PuMaArchive.C:230
void set_backend(const std::string &bak)
Set the backend.
Warning warning
Warning messages filter.
Definition: Pulsar.C:12
bool get_poln_calibrated() const
Data has been poln calibrated.
Definition: PuMaArchive.C:322
Signal::Source get_type() const
Get the observation type (psr, cal)
Definition: PuMaArchive.C:199
PuMaArchive()
Default constructor.
Definition: PuMaArchive.C:30
unsigned get_nchan() const
Get the number of frequency channels used.
Definition: PuMaArchive.C:104
virtual Signal::Scale get_scale() const
Get the scale of the profiles.
Definition: PuMaArchive.C:166
void set_source(const std::string &source)
Set the source name.
Definition: PuMaArchive.C:221
const float * get_amps() const
Return a pointer to the amplitudes array.
Definition: ProfileAmps.C:141
bool get_dedispersed() const
Inter-channel dispersion delay has been removed.
Definition: PuMaArchive.C:286
virtual void set_centre_frequency(double cfreq)
set the centre frequency (in MHz)
Definition: Profile.h:204
std::string get_receiver() const
Get the receiver.
void set_nbin(unsigned numbins)
Set the number of pulsar phase bins.
Definition: PuMaArchive.C:98
std::string get_name()
Return the name of the PuMaArchive plugin.
Definition: PuMaArchive.h:196
unsigned get_npol() const
Get the number of frequency channels used.
Definition: PuMaArchive.C:116
virtual std::string warning() const
void unload_file(const char *filename) const
Unload the PuMaArchive (header and Integration data) to filename.
Definition: PuMaArchive.C:547
void set_rotation_measure(double rm)
Set the rotation measure (in )
Definition: PuMaArchive.C:302
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
The primary interface to pulsar observational data.
Definition: Archive.h:45
std::string get_description()
Return description of this plugin.
Definition: PuMaArchive.C:581
double get_dispersion_measure() const
Get the dispersion measure (in )
Definition: PuMaArchive.C:274
double get_bandwidth() const
Get the overall bandwidth of the observation.
Definition: PuMaArchive.C:262
void set_poln_calibrated(bool done=true)
Set the status of the poln calibrated flag.
Definition: PuMaArchive.C:328
ReferenceFluxDensity
Signal::State get_state() const
Get the state of the profiles.
Definition: PuMaArchive.C:153
void set_receiver(const std::string &rec)
Set the receiver.
Integration * load_Integration(const char *filename, unsigned subint)
Load the specified Integration from filename, returning new instance.
Definition: PuMaArchive.C:466
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
void set_coordinates(const sky_coord &coordinates)
Set the coordinates of the source.
Definition: PuMaArchive.C:243
void load_header(const char *filename)
Load the PuMa header information from filename.
Definition: PuMaArchive.C:416
virtual void set_epoch(const MJD &mjd)
Set the epoch of the rising edge of bin zero.
Definition: BasicIntegration.h:63
void set_dedispersed(bool done=true)
Set the status of the parallactic angle flag.
Definition: PuMaArchive.C:292
BasicIntegration class.
Definition: BasicIntegration.h:24
void set_faraday_corrected(bool done=true)
Set the status of the ISM RM flag.
Definition: PuMaArchive.C:315
std::string get_source() const
Get the source name.
Definition: PuMaArchive.C:211
Agent()
Default constructor (necessary even when empty)
Definition: PuMaArchive.C:576
This class registers the PuMaArchive plugin class for use.
Definition: PuMaArchive.h:185
void set_nchan(unsigned numchan)
Set the number of frequency channels.
Definition: PuMaArchive.C:110
void set_dispersion_measure(double dm)
Set the dispersion measure (in )
Definition: PuMaArchive.C:280
double get_rotation_measure() const
Get the rotation measure (in )
Definition: PuMaArchive.C:297
double get_centre_frequency() const
Get the centre frequency of the observation.
Definition: PuMaArchive.C:250
virtual void set_folding_period(double seconds)
Set the folding period (in seconds)
Definition: BasicIntegration.h:73
~PuMaArchive()
Destructor.
Definition: PuMaArchive.C:35
Integration * new_Integration(const Integration *copy_this=0)
The subints vector will point to BasicIntegrations.
Definition: PuMaArchive.C:345
Archive * clone() const
Return a new copy-constructed PuMaArchive instance.
Definition: PuMaArchive.C:84
unsigned get_nbin() const
Get the number of pulsar phase bins used.
Definition: PuMaArchive.C:92
bool get_faraday_corrected() const
Data has been corrected for ISM faraday rotation.
Definition: PuMaArchive.C:309
void set_nsubint(unsigned nsubint)
Set the number of sub-integrations.
Definition: PuMaArchive.C:134
Defines the PSRCHIVE library.
Definition: CalSource.h:17
std::string get_backend() const
Get the backend.
Loads and unloads PuMa Pulsar archives.
Definition: PuMaArchive.h:24
void set_state(Signal::State state)
Set the state of the profiles.
Definition: PuMaArchive.C:159
virtual void set_duration(double seconds)
Set the total time integrated (in seconds)
Definition: BasicIntegration.h:68
virtual void set_weight(float)
set the weight of the profile
Definition: Profile.C:185
Profile * get_Profile(unsigned ipol, unsigned ichan)
Returns a pointer to the Profile given by the specified indeces.
Definition: Integration.C:306
void set_npol(unsigned numpol)
Set the number of polarization measurements.
Definition: PuMaArchive.C:122
std::string get_telescope() const
Get the telescope name.
Definition: PuMaArchive.C:140
void set_telescope(const std::string &telescope)
Set the telescope name.
Definition: PuMaArchive.C:146
virtual void set_scale(Signal::Scale scale)
Set the scale of the profiles.
Definition: PuMaArchive.C:177
void set_centre_frequency(double cf)
Set the centre frequency of the observation.
Definition: PuMaArchive.C:256
void set_bandwidth(double bw)
Set the overall bandwidth of the observation.
Definition: PuMaArchive.C:268
void copy(const Archive &archive)
Copy all of the class attributes and the selected Integration data.
Definition: PuMaArchive.C:57
const PuMaArchive & operator=(const PuMaArchive &archive)
Assignment operator.

Generated using doxygen 1.8.17