PRESTOArchive.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 __PRESTOArchive_h
10 #define __PRESTOArchive_h
11 
12 #include "Pulsar/BasicArchive.h"
13 #include "Pulsar/Agent.h"
14 
15 #include <prepfold.h>
16 
17 namespace Pulsar {
18 
20  class PRESTOArchive : public BasicArchive {
21 
22  public:
23 
26 
28  PRESTOArchive (const PRESTOArchive& archive);
29 
31  ~PRESTOArchive ();
32 
34  const PRESTOArchive& operator = (const PRESTOArchive& archive);
35 
37  PRESTOArchive (const Archive& archive);
38 
40  void copy (const Archive& archive);
41 
43  PRESTOArchive* clone () const;
44 
45  protected:
46 
48  virtual void load_header (const char* filename);
49 
51  virtual Integration*
52  load_Integration (const char* filename, unsigned subint);
53 
55  bool can_unload () const { return false; }
56 
58  virtual void unload_file (const char* filename) const;
59 
60  // Advocates the use of the PRESTOArchive plugin
61  class Agent;
62 
64  friend class Archive::Advocate<PRESTOArchive>;
65 
66  private:
67 
69  prepfoldinfo pfd;
70 
72  int header_size;
73 
75  void init ();
76 
78  int read_string(char **out, FILE *f);
79 
81  void read_position(position *out, FILE *f);
82 
84  int test_param_range(std::string &whynot);
85 
87  int is_spigot();
88 
90  int endian_swap;
91 
93  void change_header_endian();
94 
96  void change_foldstats_endian(foldstats *f);
97 
99  bool polyco_load_failed;
100 
101  };
102 
103 
104  // Advocates the use of the ExampleArchive plugin
105  class PRESTOArchive::Agent : public Archive::Advocate<PRESTOArchive> {
106 
107  public:
108 
109  Agent () { }
110 
112  bool advocate (const char* filename);
113 
115  std::string get_name () { return "PRESTO"; }
116 
118  std::string get_description ();
119 
120  };
121 
122 }
123 
124 #endif
PRESTOArchive()
Default constructor.
Definition: PRESTOArchive.C:31
const float * get_amps() const
Return a pointer to the amplitudes array.
Definition: ProfileAmps.C:141
virtual void load_header(const char *filename)
Load the PRESTO header information from filename.
Definition: PRESTOArchive.C:211
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
~PRESTOArchive()
Destructor.
Definition: PRESTOArchive.C:36
void copy(const Archive &archive)
Copy all of the class attributes and the selected Integration data.
Definition: PRESTOArchive.C:59
void shift(unsigned npts, float *arr, double shift)
Array of Profiles integrated over the same time interval.
Definition: Integration.h:37
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
const PRESTOArchive & operator=(const PRESTOArchive &archive)
Assignment operator.
virtual double get_folding_period() const
Get the folding period (in seconds)
Definition: BasicIntegration.h:71
virtual void set_folding_period(double seconds)
Set the folding period (in seconds)
Definition: BasicIntegration.h:73
bool can_unload() const
The unload_file method is not implemented.
Definition: PRESTOArchive.h:65
PRESTOArchive * clone() const
Return a new copy-constructed PRESTOArchive instance.
Definition: PRESTOArchive.C:82
virtual Integration * load_Integration(const char *filename, unsigned subint)
Load the specified Integration from filename, returning new instance.
Definition: PRESTOArchive.C:356
Defines the PSRCHIVE library.
Definition: CalSource.h:17
virtual void unload_file(const char *filename) const
Unload the PRESTOArchive (header and Integration data) to filename.
Definition: PRESTOArchive.C:508
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
Loads and unloads PRESTO Prepfold (.pfd) pulsar archives.
Definition: PRESTOArchive.h:25

Generated using doxygen 1.8.17