BasebandArchive.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/BasebandArchive.h
10 
11 #ifndef __Baseband_Archive_h
12 #define __Baseband_Archive_h
13 
14 #include "Pulsar/TimerArchive.h"
15 #include "Pulsar/baseband_header.h"
16 
17 #include "Pulsar/Passband.h"
18 #include "Pulsar/dspReduction.h"
19 #include "Pulsar/TwoBitStats.h"
20 
21 namespace Pulsar {
22 
24  class BasebandArchive : public TimerArchive {
25 
26  public:
27 
30 
32  BasebandArchive (const BasebandArchive& archive);
33 
36 
38  const BasebandArchive& operator = (const BasebandArchive& archive);
39 
41  BasebandArchive (const Archive& archive);
42 
44  void copy (const Archive& archive);
45 
47  virtual BasebandArchive* clone () const;
48 
49  // //////////////////////////////////////////////////////////////////
50  //
51  // BasebandArchive specific
52  //
53 
55  int get_npassband () const { return bhdr.pband_channels; };
57  const std::vector<float>& get_passband (unsigned channel) const;
58 
60  int get_nhistogram () const { return bhdr.analog_channels; };
62  const std::vector<float>& get_histogram (unsigned channel) const;
63 
65  void set_hanning_smoothing_factor (int factor);
66 
68  int get_hanning_smoothing_factor () const;
69 
71  float get_tolerance () const;
72 
74  const char* get_apodizing_name () const;
75 
77  bool get_scattered_power_corrected () const;
78 
80  bool get_coherent_calibration () const;
81 
82 
83  protected:
84 
85  friend class Archive::Advocate<BasebandArchive>;
86 
87  // Advocates the use of the BasebandArchive plugin
88  class Agent : public Archive::Advocate<BasebandArchive> {
89 
90  public:
91 
93  Agent () {}
94 
96  bool advocate (const char* filename);
97 
99  std::string get_name () { return "Baseband"; }
100 
102  std::string get_description ();
103 
104  };
105 
107  baseband_header bhdr;
108 
110  void set_header ();
111 
113  void set_reduction ();
114 
116  void backend_load (FILE* fptr);
117 
119  void backend_unload (FILE* fptr) const;
120 
122  void convert_hdr_Endian ();
123 
125  void correct ();
126 
128  void set_be_data_size ();
129 
131  void check_be_data_size ();
132 
134  void check_extensions ();
135 
136  void init ();
137 
140 
141  };
142 
143 
144 }
145 
146 #endif
147 
148 
unsigned get_nsamp_overlap_neg() const
Number of time samples in wrap-around region, right-hand side.
Definition: dspReduction.h:127
BasebandArchive()
Default constructor.
Definition: BasebandArchive.C:37
int get_nhistogram() const
Return the number of analog channels.
Definition: BasebandArchive.h:70
double get_scale() const
Pulsar::Profiles are normalized by Observation::scale.
Definition: dspReduction.h:183
void set_nchan(unsigned _nchan)
Number of frequency channels.
Definition: dspReduction.h:143
unsigned get_nchan() const
Number of frequency channels.
Definition: dspReduction.h:141
Stores dspsr data reduction parameters.
Definition: dspReduction.h:27
void set_nsamp_fft(unsigned _nsamp_fft)
Number of time samples in each FFT.
Definition: dspReduction.h:117
Signal::State get_state() const
The state of the signal from Input::info.
Definition: dspReduction.h:101
bool get_scattered_power_corrected() const
Return true if data was scattered power corrected.
Definition: BasebandArchive.C:728
void copy(const Archive &archive)
Copy all of the class attributes and the selected Integration data.
Definition: BasebandArchive.C:94
Instrumental passband (or bandpass)
Definition: Passband.h:25
void set_nsamp_overlap_pos(unsigned _nsamp_overlap_pos)
Number of time samples in wrap-around region, left-hand side.
Definition: dspReduction.h:123
unsigned get_nsamp_fft() const
Number of time samples in each FFT.
Definition: dspReduction.h:115
void check_extensions()
Check the Passband and TwoBitStats Extensions.
Definition: BasebandArchive.C:289
unsigned get_freq_res() const
Frequency resolution.
Definition: dspReduction.h:147
The primary interface to pulsar observational data.
Definition: Archive.h:45
baseband_header bhdr
Baseband data reduction specific header information.
Definition: BasebandArchive.h:117
Pulsar Archive produced by psrdisp.
Definition: BasebandArchive.h:29
void set_total_samples(uint64_t _total_samples)
The total number of time samples.
Definition: dspReduction.h:85
unsigned get_time_res() const
Time resolution.
Definition: dspReduction.h:153
void set_ScrunchFactor(unsigned _ScrunchFactor)
Time resolution reduction factor.
Definition: dspReduction.h:170
unsigned get_nchan() const
Get the number of frequency channels in each passband.
Definition: Passband.C:47
unsigned get_nsamp_overlap_pos() const
Number of time samples in wrap-around region, left-hand side.
Definition: dspReduction.h:121
const std::vector< float > & get_passband(unsigned ipol, unsigned iband=0) const
Get the specified passband.
Definition: Passband.C:95
uint64_t get_block_size() const
The number of time samples in each block.
Definition: dspReduction.h:89
void set_be_data_size()
Set the backend data size information in the timer header.
Definition: BasebandArchive.C:371
void correct()
Over-ride TimerArchive::correct.
Definition: BasebandArchive.C:360
void check_be_data_size()
Check the backend data size information without reseting header.
Definition: BasebandArchive.C:377
unsigned get_ScrunchFactor() const
Time resolution reduction factor.
Definition: dspReduction.h:168
const BasebandArchive & operator=(const BasebandArchive &archive)
Assignment operator.
Definition: BasebandArchive.C:70
void backend_unload(FILE *fptr) const
Unload BasebandArchive specific information.
Definition: BasebandArchive.C:616
unsigned get_ndig() const
Get the number of digitizers.
Definition: TwoBitStats.C:56
uint64_t get_overlap() const
The number of time samples by which consecutive blocks overlap.
Definition: dspReduction.h:95
unsigned get_nband() const
Get the number of bands.
Definition: Passband.C:59
void set_software(const std::string &soft)
Set the software information.
Definition: dspReduction.h:74
int get_npassband() const
Return the number of passbands.
Definition: BasebandArchive.h:65
const std::vector< float > & get_histogram(unsigned idig) const
Get the specified histogram.
Definition: TwoBitStats.C:98
uint64_t get_total_samples() const
The total number of time samples.
Definition: dspReduction.h:83
unsigned get_nsample() const
Get the number of time samples used to estimate undigitized power.
Definition: TwoBitStats.C:50
void set_scale(double _scale)
Pulsar::Profiles are normalized by Observation::scale.
Definition: dspReduction.h:185
float get_tolerance() const
Get the tolerance (old - disused)
Definition: BasebandArchive.C:753
~BasebandArchive()
Destructor.
Definition: BasebandArchive.C:60
void set_block_size(uint64_t _block_size)
The number of time samples in each block.
Definition: dspReduction.h:91
void set_reduction()
Update the reduction attribute with the current state.
Definition: BasebandArchive.C:326
const std::vector< float > & get_histogram(unsigned channel) const
Return a reference to the digitization histogram in the given channel.
Definition: BasebandArchive.C:717
void set_nsamp_overlap_neg(unsigned _nsamp_overlap_neg)
Number of time samples in wrap-around region, right-hand side.
Definition: dspReduction.h:129
void set_hanning_smoothing_factor(int factor)
Set the hanning smoothing factor.
Definition: BasebandArchive.C:736
virtual BasebandArchive * clone() const
Return a pointer to a new copy constructed instance equal to this.
Definition: BasebandArchive.C:121
void set_state(Signal::State _state)
The state of the signal from Input::info.
Definition: dspReduction.h:103
void set_header()
Update the baseband_header struct with the current state.
Definition: BasebandArchive.C:236
const char * get_apodizing_name() const
Get the name of the apodizing function.
Definition: BasebandArchive.C:758
void backend_load(FILE *fptr)
Load BasebandArchive specific information.
Definition: BasebandArchive.C:438
int get_hanning_smoothing_factor() const
Get the hanning smoothing factor.
Definition: BasebandArchive.C:745
std::string get_software() const
Get the software information.
Definition: dspReduction.h:71
Stores histograms of two-bit low-voltage states.
Definition: TwoBitStats.h:30
unsigned get_npol() const
Get the number of polarizations.
Definition: Passband.C:53
bool get_coherent_calibration() const
Return true if phase-coherent polarimetric calibration was performed.
Definition: BasebandArchive.C:732
Defines the PSRCHIVE library.
Definition: CalSource.h:17
void fix_header_memory_alignment()
Correct memory alignment error in pre-Version 5 headers.
Definition: BasebandArchive.C:420
void set_time_res(unsigned _time_res)
Time resolution.
Definition: dspReduction.h:155
void set_overlap(uint64_t _overlap)
The number of time samples by which consecutive blocks overlap.
Definition: dspReduction.h:97
const std::vector< float > & get_passband(unsigned channel) const
Return a reference to the bandpass in the given channel.
Definition: BasebandArchive.C:706
void set_freq_res(unsigned _freq_res)
Frequency resolution.
Definition: dspReduction.h:149
void convert_hdr_Endian()
Convert the endian of baseband_header.
Definition: BasebandArchive.C:200

Generated using doxygen 1.8.17