BPPArchive.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2007 by Paul Demorest
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 #ifndef __BPPArchive_h
10 #define __BPPArchive_h
11 
12 #include "Pulsar/BasicArchive.h"
13 #include "Pulsar/Agent.h"
14 
15 // BPP header struct
16 #include <bpp_header.h>
17 
18 namespace Pulsar {
19 
21 
24  class BPPArchive : public BasicArchive {
25 
26  public:
27 
30 
32  BPPArchive (const BPPArchive& archive);
33 
35  ~BPPArchive ();
36 
38  const BPPArchive& operator = (const BPPArchive& archive);
39 
41  BPPArchive (const Archive& archive);
42 
44  void copy (const Archive& archive);
45 
47  BPPArchive* clone () const;
48 
50 
54  enum Linearization { Mean, Bins, None };
55 
56  protected:
57 
59  void fix_orig_rfs();
60 
62  void hdr_to_big_endian ();
63 
65  virtual void load_header (const char* filename);
66 
68  int get_mjd_from_hdr();
69 
72 
74  int linearize_power(float quant_power, float *input_power, float *gain,
75  float *xgain);
76 
78  virtual Integration*
79  load_Integration (const char* filename, unsigned subint);
80 
82  void load_extensions();
83 
85  bool can_unload () const { return false; }
86 
88  virtual void unload_file (const char* filename) const;
89 
90  // Advocates the use of the BPPArchive plugin
91  class Agent;
92 
94  friend class Archive::Advocate<BPPArchive>;
95 
96  private:
97 
99  bpp_header hdr;
100 
103  double *orig_rfs;
104  int orig_rfs_corrected;
105 
107  void init ();
108 
109  };
110 
111 
112  // Advocates the use of the BPPArchive plugin
113  class BPPArchive::Agent : public Archive::Advocate<BPPArchive> {
114 
115  public:
116 
117  Agent () { }
118 
120  bool advocate (const char* filename);
121 
123  std::string get_name () { return "BPP"; }
124 
126  std::string get_description ();
127 
128  };
129 
130 
131 }
132 
133 #endif
virtual void load_header(const char *filename)
Load the BPP header information from filename.
Definition: BPPArchive.C:190
std::string get_name() const
Get the name of the observatory and/or primary reflector.
Definition: Telescope.h:96
BPPArchive * clone() const
Return a new copy-constructed BPPArchive instance.
Definition: BPPArchive.C:94
void copy(const Archive &archive)
Copy all of the class attributes and the selected Integration data.
Definition: BPPArchive.C:71
void offset(double offset)
offsets each bin of the profile by offset
Definition: Profile.C:301
Linearization
Different linearization methods
Definition: BPPArchive.h:64
const float * get_amps() const
Return a pointer to the amplitudes array.
Definition: ProfileAmps.C:141
Loads and unloads BPP Pulsar archives.
Definition: BPPArchive.h:29
Stores information about the instrument backend.
Definition: Backend.h:26
~BPPArchive()
Destructor.
Definition: BPPArchive.C:46
BPPArchive()
Default constructor.
Definition: BPPArchive.C:41
void set_amps(const T *data)
set the amplitudes array equal to the contents of the data array
Definition: ProfileAmps.h:89
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
The primary interface to pulsar observational data.
Definition: Archive.h:45
Contains information about the receiver and receiver platform.
Definition: Receiver.h:28
void scale(double scale)
multiplies each bin of the profile by scale
Definition: Profile.C:311
bool can_unload() const
The unload_file method is not implemented.
Definition: BPPArchive.h:95
virtual Integration * load_Integration(const char *filename, unsigned subint)
Load the specified Integration from filename, returning new instance.
Definition: BPPArchive.C:407
void set_delay(const double set_delay)
Set the delay.
Definition: Backend.h:96
void load_extensions()
Fill in Archive extension info.
Definition: BPPArchive.C:611
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
void fix_orig_rfs()
Correct the RFs array from the file.
Definition: BPPArchive.C:124
const BPPArchive & operator=(const BPPArchive &archive)
Assignment operator.
BasicIntegration class.
Definition: BasicIntegration.h:24
void hdr_to_big_endian()
Convert raw header data to big endian.
Definition: BPPArchive.C:155
Contains information about the telescope used for the observation.
Definition: Telescope.h:26
int linearize_power(float quant_power, float *input_power, float *gain, float *xgain)
Linearize 2-bit power scale.
Definition: BPPArchive.C:370
Defines the PSRCHIVE library.
Definition: CalSource.h:17
Linearization lin_method
Selected linearization method.
Definition: BPPArchive.h:81
int get_mjd_from_hdr()
Get integer MJD out of the BPP header.
Definition: BPPArchive.C:344
virtual void unload_file(const char *filename) const
Unload the BPPArchive (header and Integration data) to filename.
Definition: BPPArchive.C:658

Generated using doxygen 1.8.17