TimerArchive.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2003 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/Base/Formats/Timer/Pulsar/TimerArchive.h
10
11#ifndef __Timer_Archive_h
12#define __Timer_Archive_h
13
14#include "Pulsar/Archive.h"
15#include "Pulsar/Agent.h"
16#include "timer.h"
17
18namespace Pulsar {
19
20 class TapeInfo;
21 class CalInfoExtension;
22
24 class TimerArchive : public Archive {
25
26 public:
27
28 static bool big_endian;
29
31 TimerArchive ();
32
34 TimerArchive (const TimerArchive& archive);
35
38
40 const TimerArchive& operator = (const TimerArchive& archive);
41
43 TimerArchive (const Archive& archive);
44
46 void copy (const Archive& archive);
47
48 // //////////////////////////////////////////////////////////////////
49 //
50 // implement the pure virtual methods of the Archive base class
51 //
52
54 TimerArchive* clone () const;
55
57 virtual std::string get_telescope () const;
59 virtual void set_telescope (const std::string& telescope);
60
62 virtual Signal::State get_state () const;
64 virtual void set_state (Signal::State state);
65
67 virtual Signal::Scale get_scale () const;
69 virtual void set_scale (Signal::Scale scale);
70
72 virtual Signal::Source get_type () const;
74 virtual void set_type (Signal::Source type);
75
77 virtual std::string get_source () const;
79 virtual void set_source (const std::string& source);
80
82 virtual sky_coord get_coordinates () const;
84 virtual void set_coordinates (const sky_coord& coordinates);
85
87
88 virtual unsigned get_nbin () const;
89
91
92 virtual unsigned get_nchan () const;
93
95
96 virtual unsigned get_npol () const;
97
99
100 virtual unsigned get_nsubint () const;
101
103 virtual double get_bandwidth () const;
105 virtual void set_bandwidth (double bw);
106
108 virtual double get_centre_frequency () const;
110 virtual void set_centre_frequency (double cf);
111
113 virtual double get_dispersion_measure () const;
115 virtual void set_dispersion_measure (double dm);
116
118 virtual double get_rotation_measure () const;
120 virtual void set_rotation_measure (double rm);
121
123 virtual bool get_dedispersed () const;
125 virtual void set_dedispersed (bool done = true);
126
128 virtual bool get_faraday_corrected () const;
130 virtual void set_faraday_corrected (bool done = true);
131
133 virtual bool get_poln_calibrated () const;
135 virtual void set_poln_calibrated (bool done = true);
136
138 int hydra_obstype ();
139
141 virtual void correct ();
142
143 protected:
144
145 friend class Archive::Advocate<TimerArchive>;
146
147 // Advocates the use of the TimerArchive plugin
148 class Agent : public Archive::Advocate<TimerArchive> {
149
150 public:
151
153 Agent () {}
154
156 bool advocate (const char* filename);
157
159 std::string get_name () { return "Timer"; }
160
162 std::string get_description ();
163
164 };
165
167 virtual void load_header (const char* filename);
168
170 virtual Integration*
171 load_Integration (const char* filename, unsigned subint);
172
174 bool can_unload () const { return true; }
175
177 virtual void unload_file (const char* filename) const;
178
180 struct timer hdr;
181
183
187 bool valid;
188
190 virtual void set_nbin (unsigned numbins);
191
193 virtual void set_nchan (unsigned numchan);
194
196 virtual void set_npol (unsigned numpol);
197
199 virtual void set_nsubint (unsigned nsubint);
200
202 virtual Integration* new_Integration (const Integration* copy_this = 0);
203
205 void set_corrected (int code, bool done);
206
208 void set_calibrated (int code, bool done);
209
211 void load (FILE* fptr);
212
214 void unload (FILE* fptr) const;
215
216 // loading is broken up into the following steps, so that inherited
217 // types can use the building blocks to do different things
218
220 void hdr_load (FILE* fptr);
221
223 virtual void backend_load (FILE* fptr);
224
226 void psr_load (FILE* fptr);
227
229 void subint_load (FILE* fptr);
230
231 // unloading is broken up into the following steps, so that inherited
232 // types can use the building blocks to do different things
233
235 void hdr_unload (FILE* fptr) const;
236
238 virtual void set_be_data_size ();
239
241 virtual void backend_unload (FILE* fptr) const;
242
244 void psr_unload (FILE* fptr) const;
245
247 void subint_unload (FILE* fptr) const;
248
250 void correct_Integrations ();
251
253 void unpack_extensions ();
254
256 void pack_extensions ();
257
259 void unpack (Receiver* receiver);
260
262 void pack (const Receiver* receiver);
263
265 void unpack (TapeInfo* tape);
266
268 void pack (const TapeInfo* tape);
269
271 void unpack (CalInfoExtension* cal);
272
277 };
278
279
280
281}
282
283#endif
Archive()
Default constructor.
Definition Archive.C:67
Stores information about the reference source (ATNF)
Definition CalInfoExtension.h:23
Array of Profiles integrated over the same time interval.
Definition Integration.h:37
Contains information about the receiver and receiver platform.
Definition Receiver.h:23
Stores information about the tape on which the data were recorded.
Definition TapeInfo.h:19
void unload(FILE *fptr) const
unload the archive to an open file
Definition TimerArchive_unload.C:57
static bool big_endian
files are big endian by default
Definition TimerArchive.h:28
virtual void set_rotation_measure(double rm)
Set the rotation measure (in )
Definition TimerArchive.C:476
void unpack(Receiver *receiver)
Unpack the Receiver extension.
Definition TimerArchive_Receiver.C:29
void set_corrected(int code, bool done)
set code bit in hdr.corrected
Definition TimerArchive.C:515
~TimerArchive()
Destructor.
Definition TimerArchive.C:60
virtual Integration * load_Integration(const char *filename, unsigned subint)
Load the specified Integration from filename, returning new instance.
Definition TimerArchive.C:165
void pack(const Receiver *receiver)
Pack the Receiver extension.
Definition TimerArchive_Receiver.C:173
virtual Signal::State get_state() const
Get the state of the profiles.
Definition TimerArchive.C:356
virtual Signal::Source get_type() const
Get the observation type (psr, cal)
Definition TimerArchive.C:188
virtual void set_dispersion_measure(double dm)
Set the dispersion measure (in )
Definition TimerArchive.C:463
virtual std::string get_telescope() const
Get the telescope name.
Definition TimerArchive.C:172
virtual void unload_file(const char *filename) const
Unload the Archive (header and Integration data) to filename.
Definition TimerArchive_unload.C:27
void pack_extensions()
Pack the Receiver and Telescope Extension classes (before unloading)
Definition TimerArchive_extensions.C:74
virtual void set_nchan(unsigned numchan)
Set the number of frequency channels.
Definition TimerArchive.C:305
virtual void set_type(Signal::Source type)
Set the observation type (psr, cal)
Definition TimerArchive.C:226
int hydra_obstype()
Returns the Hydra observation type, given the coordinates.
Definition TimerArchive.C:210
struct timer hdr
The original FPTM header information.
Definition TimerArchive.h:180
virtual bool get_poln_calibrated() const
Data has been poln calibrated.
Definition TimerArchive.C:483
virtual unsigned get_npol() const
Get the number of frequency channels used.
Definition TimerArchive.C:311
void hdr_unload(FILE *fptr) const
unload the timer header to an open file
Definition TimerArchive_unload.C:108
double dispersion_measure
Double-precision dispersion measure stored for runtime use.
Definition TimerArchive.h:274
virtual void set_poln_calibrated(bool done=true)
Set the status of the poln calibrated flag.
Definition TimerArchive.C:488
virtual double get_rotation_measure() const
Get the rotation measure (in )
Definition TimerArchive.C:470
virtual bool get_dedispersed() const
Inter-channel dispersion delay has been removed.
Definition TimerArchive.C:505
TimerArchive()
Default constructor.
Definition TimerArchive.C:31
void hdr_load(FILE *fptr)
load the timer header from an open file
Definition TimerArchive_load.C:477
virtual void backend_unload(FILE *fptr) const
unload the backend-specific information to an open file
Definition TimerArchive_unload.C:157
double rotation_measure
Double-precision rotation measure stored for runtime use.
Definition TimerArchive.h:276
virtual void set_centre_frequency(double cf)
Set the centre frequency of the observation.
Definition TimerArchive.C:350
virtual void set_nsubint(unsigned nsubint)
Set the number of sub-integrations.
Definition TimerArchive.C:330
void copy(const Archive &archive)
Copy all of the class attributes and the selected Integration data.
Definition TimerArchive.C:94
void subint_load(FILE *fptr)
load the sub-integrations from an open file
Definition TimerArchive_load.C:93
void psr_unload(FILE *fptr) const
unload the polyco and ephemeris from an open file
Definition TimerArchive_unload.C:168
virtual void correct()
Set various redundant parameters in the timer and mini headers.
Definition TimerArchive.C:592
virtual void load_header(const char *filename)
Load the header information from filename.
Definition TimerArchive_load.C:30
virtual bool get_faraday_corrected() const
Data has been corrected for ISM faraday rotation.
Definition TimerArchive.C:494
virtual sky_coord get_coordinates() const
Get the coordinates of the source.
Definition TimerArchive.C:262
bool can_unload() const
The unload_file method is implemented.
Definition TimerArchive.h:174
virtual void set_source(const std::string &source)
Set the source name.
Definition TimerArchive.C:255
void load(FILE *fptr)
load the archive from an open file
Definition TimerArchive_load.C:57
void set_calibrated(int code, bool done)
set code bit in hdr.calibrated
Definition TimerArchive.C:523
virtual std::string get_source() const
Get the source name.
Definition TimerArchive.C:250
virtual Signal::Scale get_scale() const
Get the scale of the profiles.
Definition TimerArchive.C:423
const TimerArchive & operator=(const TimerArchive &archive)
Assignment operator.
Definition TimerArchive.C:70
virtual void set_coordinates(const sky_coord &coordinates)
Set the coordinates of the source.
Definition TimerArchive.C:275
virtual unsigned get_nchan() const
Get the number of frequency channels used.
Definition TimerArchive.C:298
virtual void set_telescope(const std::string &telescope)
Set the telescope name.
Definition TimerArchive.C:177
virtual void set_state(Signal::State state)
Set the state of the profiles.
Definition TimerArchive.C:390
TimerArchive * clone() const
Return a pointer to a new copy constructed instance equal to this.
Definition TimerArchive.C:133
virtual void backend_load(FILE *fptr)
load the backend-specific information from an open file
Definition TimerArchive_load.C:492
virtual unsigned get_nsubint() const
Get the number of sub-integrations stored in the file.
Definition TimerArchive.C:323
void subint_unload(FILE *fptr) const
unload the sub-integrations to an open file
Definition TimerArchive_unload.C:72
virtual double get_centre_frequency() const
Get the centre frequency of the observation.
Definition TimerArchive.C:345
virtual void set_dedispersed(bool done=true)
Set true when the inter-channel dispersion delay has been removed.
Definition TimerArchive.C:510
virtual void set_nbin(unsigned numbins)
Set the number of pulsar phase bins.
Definition TimerArchive.C:292
virtual void set_scale(Signal::Scale scale)
Set the scale of the profiles.
Definition TimerArchive.C:434
virtual Integration * new_Integration(const Integration *copy_this=0)
The subints vector will point to TimerIntegrations.
Definition TimerArchive.C:145
virtual void set_bandwidth(double bw)
Set the overall bandwidth of the observation.
Definition TimerArchive.C:340
virtual void set_faraday_corrected(bool done=true)
Set the status of the ISM RM flag.
Definition TimerArchive.C:499
virtual unsigned get_nbin() const
Get the number of pulsar phase bins used.
Definition TimerArchive.C:285
virtual double get_dispersion_measure() const
Get the dispersion measure (in )
Definition TimerArchive.C:457
void unpack_extensions()
Unpack the Receiver and Telescope Extension classes (after loading)
Definition TimerArchive_extensions.C:22
void correct_Integrations()
Set the state of various redundant parameters in the mini headers.
Definition TimerArchive.C:531
virtual void set_be_data_size()
set the backend data size
Definition TimerArchive_unload.C:163
bool valid
State of the TimerArchive attributes can be trusted.
Definition TimerArchive.h:187
void psr_load(FILE *fptr)
load the polyco and ephemeris from an open file
Definition TimerArchive_load.C:512
virtual void set_npol(unsigned numpol)
Set the number of polarization measurements.
Definition TimerArchive.C:318
virtual double get_bandwidth() const
Get the overall bandwidth of the observation.
Definition TimerArchive.C:335
Defines the PSRCHIVE library.
Definition CalSource.h:17

Generated using doxygen 1.14.0