WAPPArchive.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2008 by Paul Demorest
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 #ifndef __WAPPArchive_h
10 #define __WAPPArchive_h
11 
12 #include "Pulsar/BasicArchive.h"
13 #include "Pulsar/Agent.h"
14 
15 #include "polyco.h"
16 #include "wapp_headers.h"
17 
18 // Default to DCT if FFTW is present
19 #define WAPP_USE_FFTW_DCT 1
20 
21 #if WAPP_USE_FFTW_DCT
22 # ifdef HAVE_CONFIG_H
23 # include <config.h>
24 # endif
25 # if HAVE_FFTW3
26 # include <fftw3.h>
27 # else
28 # warning "WAPP_USE_FFTW_DCT requires FFTW3, falling back to general R2C"
29 # undef WAPP_USE_FFTW_DCT
30 # define WAPP_USE_FFTW_DCT 0
31 # endif
32 #endif
33 
34 namespace Pulsar {
35 
37 
41  class WAPPArchive : public BasicArchive {
42 
43  public:
44 
46  WAPPArchive ();
47 
49  WAPPArchive (const WAPPArchive& archive);
50 
52  ~WAPPArchive ();
53 
55  const WAPPArchive& operator = (const WAPPArchive& archive);
56 
58  WAPPArchive (const Archive& archive);
59 
61  void copy (const Archive& archive);
62 
64  WAPPArchive* clone () const;
65 
66  protected:
67 
69  virtual void load_header (const char* filename);
70 
72  void load_polycos();
73 
75  virtual Integration*
76  load_Integration (const char* filename, unsigned subint);
77 
79  void load_extensions();
80 
82  bool can_unload () const { return false; }
83 
85  virtual void unload_file (const char* filename) const;
86 
87  // Advocates the use of the ExampleArchive plugin
88  class Agent;
89 
91  friend class Archive::Advocate<WAPPArchive>;
92 
93  private:
94 
96  void init ();
97 
99  polyco hdr_polyco;
100 
102  uint32_t wapp_hdr_version;
103  uint32_t wapp_hdr_size;
104  size_t wapp_ascii_hdr_size; // Includes terminating null byte
105  size_t wapp_file_size;
106 
108  char *rawhdr;
109 
111  WAPP_HEADER *hdr;
112 
114  int raw_data_is_lags;
115 
117 #if WAPP_USE_FFTW_DCT
118  fftwf_plan fplan;
119  float *fftbuf;
120 #endif
121 
122  };
123 
124 
125  // Advocates the use of the ExampleArchive plugin
126  class WAPPArchive::Agent : public Archive::Advocate<WAPPArchive> {
127 
128  public:
129 
130  Agent () { }
131 
133  bool advocate (const char* filename);
134 
136  std::string get_name () { return "WAPP"; }
137 
139  std::string get_description ();
140 
141  };
142 
143 }
144 
145 #endif
virtual void load_header(const char *filename)
Load the Example header information from filename.
Definition: WAPPArchive.C:109
WAPPArchive * clone() const
Return a new copy-constructed ExampleArchive instance.
Definition: WAPPArchive.C:102
~WAPPArchive()
Destructor.
Definition: WAPPArchive.C:50
Stores information about the instrument backend.
Definition: Backend.h:26
void frc1d(size_t nfft, float *into, const float *from)
void set_name(const std::string &_name)
Set the name of the receiver.
Definition: Receiver.h:92
bool can_unload() const
The unload_file method is not implemented.
Definition: WAPPArchive.h:82
const WAPPArchive & operator=(const WAPPArchive &archive)
Assignment operator.
void copy(const Archive &archive)
Copy all of the class attributes and the selected Integration data.
Definition: WAPPArchive.C:79
void set_amps(const T *data)
set the amplitudes array equal to the contents of the data array
Definition: ProfileAmps.h:89
void set_centre_frequency(unsigned ichan, double frequency)
Set the Profile centre frequency attributes of the given channel.
Definition: Integration.C:372
The primary interface to pulsar observational data.
Definition: Archive.h:45
Contains information about the receiver and receiver platform.
Definition: Receiver.h:28
Loads and unloads WAPP Pulsar archives.
Definition: WAPPArchive.h:41
void set_name(const std::string &name)
Set the name of the backend.
Definition: Backend.C:89
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
std::string project_ID
Project ID.
Definition: ObsExtension.h:84
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
void load_extensions()
Fill various Archive extensions.
Definition: WAPPArchive.C:616
Stores PSRFITS SUBINT header parameters.
Definition: FITSSUBHdrExtension.h:28
Contains information about the telescope used for the observation.
Definition: Telescope.h:26
Observation Information Extension.
Definition: ObsExtension.h:29
WAPPArchive()
Default constructor.
Definition: WAPPArchive.C:45
std::string observer
Observer name.
Definition: ObsExtension.h:78
virtual void set_folding_period(double seconds)
Set the folding period (in seconds)
Definition: BasicIntegration.h:73
void load_polycos()
Load any polycos from the header.
Definition: WAPPArchive.C:337
Defines the pure virtual methods declared in Pulsar::Archive.
Definition: BasicArchive.h:37
Defines the PSRCHIVE library.
Definition: CalSource.h:17
virtual Integration * load_Integration(const char *filename, unsigned subint)
Load the specified Integration from filename, returning new instance.
Definition: WAPPArchive.C:396
virtual void unload_file(const char *filename) const
Unload the ExampleArchive (header and Integration data) to filename.
Definition: WAPPArchive.C:650
virtual void set_duration(double seconds)
Set the total time integrated (in seconds)
Definition: BasicIntegration.h:68
Profile * get_Profile(unsigned ipol, unsigned ichan)
Returns a pointer to the Profile given by the specified indeces.
Definition: Integration.C:306

Generated using doxygen 1.8.17