EPNArchive.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2004 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Base/Formats/EPN/Pulsar/EPNArchive.h
10 
11 #ifndef __EPN_Archive_h
12 #define __EPN_Archive_h
13 
14 #include "Pulsar/Archive.h"
15 #include "Pulsar/Agent.h"
16 #include "epnio.h"
17 
18 namespace Pulsar {
19 
21  class EPNArchive : public Archive {
22 
23  public:
24 
27 
29  EPNArchive (const EPNArchive& archive);
30 
32  ~EPNArchive ();
33 
35  const EPNArchive& operator = (const EPNArchive& archive);
36 
38  EPNArchive (const Archive& archive);
39 
41  void copy (const Archive& archive);
42 
43  // //////////////////////////////////////////////////////////////////
44  //
45  // implement the pure virtual methods of the Archive base class
46  //
47 
49  EPNArchive* clone () const;
50 
52  std::string get_telescope () const;
54  void set_telescope (const std::string&);
55 
57  Signal::State get_state () const;
60 
62  Signal::Scale get_scale () const;
64  void set_scale (Signal::Scale scale);
65 
67  Signal::Source get_type () const;
69  void set_type (Signal::Source type);
70 
72  std::string get_source () const;
74  void set_source (const std::string& source);
75 
77  sky_coord get_coordinates () const;
79  void set_coordinates (const sky_coord& coordinates);
80 
82 
83  unsigned get_nbin () const;
84 
86 
87  unsigned get_nchan () const;
88 
90 
91  unsigned get_npol () const;
92 
94 
95  unsigned get_nsubint () const;
96 
98  double get_bandwidth () const;
100  void set_bandwidth (double bw);
101 
103  double get_centre_frequency () const;
105  void set_centre_frequency (double cf);
106 
108  double get_dispersion_measure () const;
110  void set_dispersion_measure (double dm);
111 
113  double get_rotation_measure () const;
115  void set_rotation_measure (double rm);
116 
118  bool get_dedispersed () const;
120  void set_dedispersed (bool done = true);
121 
123  bool get_faraday_corrected () const;
125  void set_faraday_corrected (bool done = true);
126 
128  bool get_poln_calibrated () const;
130  void set_poln_calibrated (bool done = true);
131 
132  protected:
133 
134  friend class Archive::Advocate<EPNArchive>;
135 
136  // Advocates the use of the EPNArchive plugin
137  class Agent : public Archive::Advocate<EPNArchive> {
138 
139  public:
140 
142  Agent () {}
143 
145  bool advocate (const char* filename);
146 
148  std::string get_name () { return "EPN"; }
149 
151  std::string get_description ();
152 
153  };
154 
156  void load_header (const char* filename);
157 
159  Integration* load_Integration (const char* filename, unsigned subint);
160 
162  bool can_unload () const { return false; }
163 
165  void unload_file (const char* filename) const;
166 
170 
171  epn_header_line1 line1;
172 
173  epn_header_line2 line2;
174 
175  epn_header_line3 line3;
176 
177  epn_header_line4 line4;
178 
179  epn_header_line5 line5;
180 
181  epn_block_subheader_line1 sub_line1;
182 
183  epn_block_subheader_line2 sub_line2;
184 
185  epn_data_block data;
186 
187  unsigned current_record;
188 
190 
192  double centre_frequency;
193 
195  double bandwidth;
196 
199 
201  unsigned nsubint;
202 
204  virtual void set_nbin (unsigned numbins);
205 
207  virtual void set_nchan (unsigned numchan);
208 
210  virtual void set_npol (unsigned numpol);
211 
213  virtual void set_nsubint (unsigned nsubint);
214 
216  virtual Integration* new_Integration (const Integration* copy_this = 0);
217 
219  void init();
220 
222  void read_record (const char* filename, unsigned record);
223 
224  };
225 
226 
227 
228 }
229 
230 #endif
unsigned get_nchan() const
Get the number of frequency channels used.
Definition: EPNArchive.C:176
void set_telescope(const std::string &)
Set the telescope name.
Definition: EPNArchive.C:103
epn_header_line1 line1
The centre frequency.
Definition: EPNArchive.h:181
virtual void set_npol(unsigned numpol)
Set the number of polarization measurements.
Definition: EPNArchive.C:198
bool get_poln_calibrated() const
Data has been poln calibrated.
Definition: EPNArchive.C:302
double get_dispersion_measure() const
Get the dispersion measure (in )
Definition: EPNArchive.C:278
unsigned current_record
The centre frequency.
Definition: EPNArchive.h:197
Integration * load_Integration(const char *filename, unsigned subint)
Load the specified Integration from filename, returning new instance.
Definition: EPNArchive.C:435
virtual void set_nsubint(unsigned nsubint)
Set the number of sub-integrations.
Definition: EPNArchive.C:208
epn_block_subheader_line1 sub_line1
The centre frequency.
Definition: EPNArchive.h:191
EPNArchive * clone() const
Return a pointer to a new copy constructed instance equal to this.
Definition: EPNArchive.C:91
~EPNArchive()
Destructor.
Definition: EPNArchive.C:33
virtual void set_centre_frequency(double cfreq)
set the centre frequency (in MHz)
Definition: Profile.h:204
const Integration * get_Integration(const Archive *data, Index subint)
Return the requested profile, cloning and integrating when needed.
Definition: Index.C:118
void set_dedispersed(bool done=true)
Set true when the inter-channel dispersion delay has been removed.
Definition: EPNArchive.C:329
Reads the European Pulsar Network (EPN) file format.
Definition: EPNArchive.h:26
void set_amps(const T *data)
set the amplitudes array equal to the contents of the data array
Definition: ProfileAmps.h:89
unsigned nsubint
The number of sub-integrations.
Definition: EPNArchive.h:211
double get_bandwidth() const
Get the overall bandwidth of the observation.
Definition: EPNArchive.C:213
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
The primary interface to pulsar observational data.
Definition: Archive.h:45
Signal::State get_state() const
Get the state of the profiles.
Definition: EPNArchive.C:234
void set_coordinates(const sky_coord &coordinates)
Set the coordinates of the source.
Definition: EPNArchive.C:154
std::string get_source() const
Get the source name.
Definition: EPNArchive.C:121
void init()
Initialize data structures.
Definition: EPNArchive.C:17
void set_rotation_measure(double rm)
Set the rotation measure (in )
Definition: EPNArchive.C:296
ReferenceFluxDensity
void set_dispersion_measure(double dm)
Set the dispersion measure (in )
Definition: EPNArchive.C:284
void set_faraday_corrected(bool done=true)
Set the status of the ISM RM flag.
Definition: EPNArchive.C:318
virtual void set_nchan(unsigned numchan)
Set the number of frequency channels.
Definition: EPNArchive.C:184
virtual Integration * new_Integration(const Integration *copy_this=0)
The subints vector will point to BasicIntegrations.
Definition: EPNArchive.C:338
double get_rotation_measure() const
Get the rotation measure (in )
Definition: EPNArchive.C:290
void set_centre_frequency(double cf)
Set the centre frequency of the observation.
Definition: EPNArchive.C:228
sky_coord get_coordinates() const
Get the coordinates of the source.
Definition: EPNArchive.C:143
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
bool can_unload() const
The unload_file method is not implemented.
Definition: EPNArchive.h:172
virtual void set_epoch(const MJD &mjd)
Set the epoch of the rising edge of bin zero.
Definition: BasicIntegration.h:63
BasicIntegration class.
Definition: BasicIntegration.h:24
unsigned get_nsubint() const
Get the number of sub-integrations stored in the file.
Definition: EPNArchive.C:203
double bandwidth
The bandwidth.
Definition: EPNArchive.h:205
bool get_faraday_corrected() const
Data has been corrected for ISM faraday rotation.
Definition: EPNArchive.C:313
bool get_dedispersed() const
Inter-channel dispersion delay has been removed.
Definition: EPNArchive.C:324
unsigned get_npol() const
Get the number of frequency channels used.
Definition: EPNArchive.C:190
void unload_file(const char *filename) const
Unload the Archive (header and Integration data) to filename.
Definition: EPNArchive.C:520
void read_record(const char *filename, unsigned record)
Read the requested record from filename.
Definition: EPNArchive.C:356
epn_data_block data
The centre frequency.
Definition: EPNArchive.h:195
void set_source(const std::string &source)
Set the source name.
Definition: EPNArchive.C:126
std::string get_telescope() const
Get the telescope name.
Definition: EPNArchive.C:98
Signal::Scale get_scale() const
Get the scale of the profiles.
Definition: EPNArchive.C:245
virtual void set_folding_period(double seconds)
Set the folding period (in seconds)
Definition: BasicIntegration.h:73
const EPNArchive & operator=(const EPNArchive &archive)
Assignment operator.
void copy(const Archive &archive)
Copy all of the class attributes and the selected Integration data.
Definition: EPNArchive.C:56
epn_header_line2 line2
The centre frequency.
Definition: EPNArchive.h:183
epn_header_line3 line3
The centre frequency.
Definition: EPNArchive.h:185
double centre_frequency
The centre frequency.
Definition: EPNArchive.h:202
unsigned get_nbin() const
Get the number of pulsar phase bins used.
Definition: EPNArchive.C:163
virtual void set_nbin(unsigned numbins)
Set the number of pulsar phase bins.
Definition: EPNArchive.C:171
void load_header(const char *filename)
Load the header information from filename.
Definition: EPNArchive.C:378
epn_block_subheader_line2 sub_line2
The centre frequency.
Definition: EPNArchive.h:193
epn_header_line4 line4
The centre frequency.
Definition: EPNArchive.h:187
Defines the PSRCHIVE library.
Definition: CalSource.h:17
epn_header_line5 line5
The centre frequency.
Definition: EPNArchive.h:189
void set_scale(Signal::Scale scale)
Set the scale of the profiles.
Definition: EPNArchive.C:258
void set_bandwidth(double bw)
Set the overall bandwidth of the observation.
Definition: EPNArchive.C:218
void set_type(Signal::Source type)
Set the observation type (psr, cal)
Definition: EPNArchive.C:115
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
Signal::State state
The state.
Definition: EPNArchive.h:208
EPNArchive()
Default constructor.
Definition: EPNArchive.C:25
void set_state(Signal::State state)
Set the state of the profiles.
Definition: EPNArchive.C:239
Signal::Source get_type() const
Get the observation type (psr, cal)
Definition: EPNArchive.C:109
void set_poln_calibrated(bool done=true)
Set the status of the poln calibrated flag.
Definition: EPNArchive.C:307
double get_centre_frequency() const
Get the centre frequency of the observation.
Definition: EPNArchive.C:223

Generated using doxygen 1.8.17