Archiver.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2002 - 2023 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Signal/Pulsar/dsp/Archiver.h
10 
11 #ifndef __Archiver_h
12 #define __Archiver_h
13 
14 #include "dsp/PhaseSeriesUnloader.h"
15 #include "Pulsar/Archive.h"
16 
17 namespace Pulsar
18 {
19  class Interpreter;
20  class Integration;
21  class Profile;
22 
23  class MoreProfiles;
24  class dspReduction;
25  class TwoBitStats;
26  class DigitiserCounts;
27  class Passband;
28  class Backend;
29 }
30 
31 namespace dsp
32 {
33  class Response;
34  class Operation;
35  class ExcisionUnpacker;
36  class HistUnpacker;
37  class SpectralKurtosis;
38 
40 
43  class Archiver : public PhaseSeriesUnloader {
44 
45  public:
46 
48  static unsigned verbose;
49 
51  Archiver ();
52 
54  Archiver (const Archiver&);
55 
57  virtual ~Archiver ();
58 
60  Archiver* clone () const;
61 
63  void set_archive_class (const std::string& archive_class_name);
64  void set_force_archive_class (bool);
65 
67  void set_command_line (const std::string&);
68 
70  void set_script (const std::vector<std::string>& jobs);
71 
73  void set_archive (Pulsar::Archive* archive);
74 
76  bool postprocess (Pulsar::Archive* archive);
77 
79  void set_minimum_integration_length (double seconds);
80 
83 
84  bool has_archive() const;
85 
88 
90  void unload (const PhaseSeries*);
91 
93  void finish ();
94 
96  unsigned get_npol (const PhaseSeries* phase) const;
97 
99  void set (Pulsar::Archive* archive, const PhaseSeries* phase);
100 
102  void add (Pulsar::Archive* archive, const PhaseSeries* phase);
103 
104  void set_archive_dedispersed (bool _archive_dedispersed)
105  { archive_dedispersed = _archive_dedispersed; }
106 
107  bool get_archive_dedispersed() const
108  { return archive_dedispersed; }
109 
111  void set_archive_software(std::string _archive_software)
112  { archive_software = _archive_software; }
113 
115  std::string get_archive_software()
116  { return archive_software; }
117 
118  void set_store_dynamic_extensions (bool flag)
119  { store_dynamic_extensions = flag; }
120 
121  void set_use_single_archive (bool flag)
122  { use_single_archive = flag; }
123 
124  void set_subints_per_file (unsigned nsub)
125  { subints_per_file = nsub; }
126 
127  protected:
128 
131 
134 
136  std::string command_line;
137 
139  std::string archive_class_name;
140 
143 
146 
149 
152 
154  std::vector<std::string> script;
155 
158 
161 
164 
167 
170 
172  std::vector< Reference::To<Pulsar::Archive::Extension> > extensions;
173 
176 
178  void set (Pulsar::Integration* integration, const PhaseSeries* phase,
179  unsigned isub=0, unsigned nsub=1);
180 
182  void set (Pulsar::Profile* profile, const PhaseSeries* phase, double scale,
183  unsigned ichan, unsigned ipol, unsigned idim);
184 
186  void set (Pulsar::Backend*);
187 
189  void set (Pulsar::dspReduction*);
190 
193 
195  void pack (Pulsar::Integration*);
196 
197  void set_coherent_dedispersion (Signal::State state, const Response* response);
198 
200  void set (Pulsar::TwoBitStats*);
201 
203  void set (Pulsar::DigitiserCounts* dig_cnts, unsigned isub=0);
204 
206  void set (Pulsar::Passband*);
207 
209  void raw_to_central (unsigned ichan,
210  Pulsar::MoreProfiles* moments,
211  const Pulsar::Integration* means,
212  const unsigned* hits);
213 
215  Pulsar::Archive* new_Archive() const;
216 
217  private:
218 
220  bool archive_dedispersed;
221 
223  std::string archive_software;
224 
227 
230 
232  unsigned corrupted_profiles;
233 
235  mutable unsigned fourth_moments;
236  };
237 
238 }
239 
240 #endif // !defined(__Archiver_h)
241 
242 
void set_coordmode(const std::string &mode)
virtual unsigned get_npol() const=0
void set_date_str(const std::string &date)
std::string archive_class_name
Name of the Pulsar::Archive class used to create new instances.
Definition: Archiver.h:139
Pulsar::Archive * new_Archive() const
Generate a new Archive for output.
Definition: Archiver.C:150
virtual unsigned get_npol() const=0
Reference::To< Pulsar::Archive > single_archive
The Pulsar::Archive instance to which data will be added.
Definition: Archiver.h:148
uint64_t get_ndat_folded() const
Return the number of time samples folded into the profiles for all channels.
Definition: PhaseSeries.C:521
virtual void add_extension(Extension *extension)
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
Reference::To< Pulsar::Interpreter > interpreter
The script interpreter used to process Archive data before unloading.
Definition: Archiver.h:157
void raw_to_central(unsigned ichan, Pulsar::MoreProfiles *moments, const Pulsar::Integration *means, const unsigned *hits)
Convert raw moments to central moments of means.
Definition: Archiver.C:819
const float * get_amps() const
void add_extension(Pulsar::Archive::Extension *extension)
Add a Pulsar::Archive::Extension to those added to the output archive.
Definition: Archiver.C:144
unsigned get_npol(const PhaseSeries *phase) const
Get the effective number of polarizations in the output archive.
Definition: Archiver.C:451
void set_basis(Signal::Basis basis)
virtual MJD get_epoch() const=0
void finish()
Perform any clean up tasks before completion.
Definition: Archiver.C:326
std::string extension
The filename extension.
Definition: PhaseSeriesUnloader.h:94
Data as a function of pulse phase.
Definition: PhaseSeries.h:28
void set_name(const std::string &_name)
void set_archive(Pulsar::Archive *archive)
Set the Pulsar::Archive instance to which data will be added.
Definition: Archiver.C:121
virtual unsigned get_nsubint() const=0
Archiver()
Constructor.
Definition: Archiver.C:50
void set(Pulsar::Archive *archive, const PhaseSeries *phase)
Set the Pulsar::Archive with the PhaseSeries data.
Definition: Archiver.C:477
void set_script(const std::vector< std::string > &jobs)
Set the post-processing script.
Definition: Archiver.C:138
double minimum_integration_length
Minimum integration length required to unload data.
Definition: Archiver.h:130
Reference::To< const HistUnpacker > hist_unpacker
HistUnpacker from which DigitiserCounts Extension will be constructed.
Definition: Archiver.h:166
Describes a frequency (or impulse) response.
Definition: Response.h:34
virtual unsigned get_nbin() const=0
unsigned get_nbin() const
virtual void add_extension(Extension *extension)
void set_archive_class(const std::string &archive_class_name)
Set the name of the Pulsar::Archive class used to create new instances.
Definition: Archiver.C:111
static bool record_time
Global flag enables stopwatch to record the time spent operating.
Definition: Operation.h:42
virtual ~Archiver()
Destructor.
Definition: Archiver.C:90
static Archive * new_Archive(const std::string &class_name)
virtual unsigned get_nchan() const=0
Defines the interface by which operations are performed on data.
Definition: Operation.h:37
std::vector< std::string > script
Commands used to process Archive data before unloading.
Definition: Archiver.h:154
Reference::To< const Response > passband
Response from which Passband Extension will be constructed.
Definition: Archiver.h:160
virtual double get_duration() const=0
Integration * get_Integration(unsigned subint)
unsigned subints_per_file
Number of subints per output Archive (0 implies no limit)
Definition: Archiver.h:151
std::vector< Reference::To< Pulsar::Archive::Extension > > extensions
The Pulsar::Archive::Extension classes to be added to the output.
Definition: Archiver.h:172
Base class for things that can unload PhaseSeries data somewhere.
Definition: PhaseSeriesUnloader.h:30
Creates a new instance of Pulsar::Archive to be used for output.
Definition: OutputArchive.h:22
Pulsar::Archive * get_archive()
Get the Pulsar::Archive instance to which all data were added.
Definition: Archiver.C:127
std::string command_line
Command line of the calling program.
Definition: Archiver.h:136
void set_weight(unsigned ichan, float weight)
void unload(const PhaseSeries *)
Unloads all available data to a Pulsar::Archive instance.
Definition: Archiver.C:198
void set_dispersion_measure(double dispersion_measure)
void set_archive_software(std::string _archive_software)
A dspReduction extension is added to the archive with this string.
Definition: Archiver.h:111
void set_reference_frequency(double MHz)
bool unload_profiles_with_zero_hits
Unload profiles with phase bins that have zero hits.
Definition: Archiver.h:133
Reference::To< SpectralKurtosis > spectral_kurtosis
SpectralKurtosis from which SpectralKurtosis Extension will be constructed.
Definition: Archiver.h:169
bool store_dynamic_extensions
Output dynamic header information (mostly diagnostic statistics)
Definition: Archiver.h:175
Class to unload PhaseSeries data in a Pulsar::Archive.
Definition: Archiver.h:43
bool force_archive_class
do not allow the Input class to dicate the output archive file format
Definition: Archiver.h:142
virtual void add_extension(Extension *extension)
void set_command_line(const std::string &)
Set the command line of the calling program.
Definition: Archiver.C:101
Archiver * clone() const
Clone operator.
Definition: Archiver.C:95
std::string get_filename() const
void add(Pulsar::Archive *archive, const PhaseSeries *phase)
Add the PhaseSeries data to the Pulsar::Archive instance.
Definition: Archiver.C:405
void pack(Pulsar::dspReduction *, Operation *)
Set the Pulsar::dspReduction Extension.
Definition: ArchiverExtensions.C:101
const T * get() const
std::string get_archive_software()
A dspReduction extension is added to the archive with this string.
Definition: Archiver.h:115
virtual unsigned get_nchan() const=0
const std::string get_message() const
bool postprocess(Pulsar::Archive *archive)
Execute any post-processing steps, return true if successful.
Definition: Archiver.C:352
void set_minimum_integration_length(double seconds)
Set the minimum integration length required to unload data.
Definition: Archiver.C:106
virtual double get_folding_period() const=0
static unsigned verbose
Verbose flag.
Definition: Archiver.h:48
virtual void set_weight(float)
Profile * get_Profile(unsigned ipol, unsigned ichan)
virtual unsigned get_nbin() const=0
bool use_single_archive
Store all output in a single archive.
Definition: Archiver.h:145
virtual Profile * get_Profile(unsigned i)
@ OrderFPT
Frequency, Polarization, Time (default before 3 October 2008)
Definition: TimeSeries.h:47
virtual void set_state(Signal::State state)=0
@ OrderTFP
Time, Frequency, Polarization (better for many things)
Definition: TimeSeries.h:50
virtual unsigned get_size() const
unsigned get_nbin() const
Get the number of phase bins.
Definition: PhaseSeries.h:99
Reference::To< const ExcisionUnpacker > excision_unpacker
ExcisionUnpacker from which TwoBitStats Extension will be constructed.
Definition: Archiver.h:163

Generated using doxygen 1.8.17