TimeDivide.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2005 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Signal/Pulsar/dsp/TimeDivide.h
10 
11 #ifndef __baseband_dsp_TimeDivide_h
12 #define __baseband_dsp_TimeDivide_h
13 
14 #include "environ.h"
15 #include "Pulsar/Predictor.h"
16 #include "OwnStream.h"
17 
18 namespace dsp {
19 
20  class Observation;
21 
23  class TimeDivide : public OwnStream {
24 
25  public:
26 
29 
31  ~TimeDivide ();
32 
36 
39 
41  MJD get_start_time () const { return start_time; }
42 
44  void set_seconds (double division_seconds);
45 
47  double get_seconds () const { return division_seconds; }
48 
50  void set_reference_epoch (const MJD& epoch) { reference_epoch = epoch; }
51 
53  MJD get_reference_epoch () const { return reference_epoch; }
54 
56  void set_turns (double division_turns);
57 
59  double get_turns () const { return division_turns; }
60 
62  void set_predictor (const Pulsar::Predictor*);
63 
65  const Pulsar::Predictor* get_predictor () const { return poly; }
66 
68  void set_period (double);
69 
71  double get_period () const { return period; }
72 
74  void set_reference_phase (double phase);
75 
77  double get_reference_phase () const { return reference_phase; }
78 
80  void set_fractional_pulses (bool);
81  bool get_fractional_pulses () const;
82 
84 
88 
90  void set_bounds (const Observation*);
91 
93  void discard_bounds (const Observation*);
94 
96  bool get_is_valid () const { return is_valid; }
97 
99  bool get_new_division () const { return new_division; }
100 
102  bool get_in_next () const { return in_next; }
103 
105  bool get_end_reached () const { return end_reached; }
106 
108  uint64_t get_idat_start () const { return idat_start; }
109 
111  uint64_t get_ndat () const { return ndat; }
112 
114  uint64_t get_division_ndat () const { return division_ndat; }
115 
117  unsigned get_phase_bin () const { return phase_bin; }
118 
120  uint64_t get_division () const { return division; }
121 
123  uint64_t get_division (const MJD& epoch);
124 
126 
127  protected:
128 
130  MJD start_time;
131 
133  Pulsar::Phase start_phase;
134 
136  double division_seconds = 0;
137 
140 
142  double division_turns = 0;
143 
145  double reference_phase = 0;
146 
148  bool fractional_pulses = false;
149 
152 
154  double period = 0;
155 
158 
160  void set_boundaries (const MJD& time);
161 
163  void set_boundaries (const MJD& mjd1, const MJD& mjd2);
164 
165  private:
166 
168  MJD lower;
169 
171  MJD upper;
172 
174  MJD current_end;
175 
177  uint64_t division = 0;
178 
180  bool is_valid = false;
181 
183  bool in_next = false;
184 
186  bool end_reached = false;
187 
189  bool new_division = false;
190 
192  mutable const Observation* observation;
193 
195  uint64_t idat_start = 0;
196 
198  uint64_t ndat = 0;
199 
201  uint64_t division_ndat = 0;
202 
204  unsigned phase_bin = 0;
205 
206  };
207 
208 }
209 
210 #endif // !defined(__SubFold_h)
Pulsar::Phase start_phase
The corresponding phase at which to begin dividing time.
Definition: TimeDivide.h:138
uint64_t get_idat_start() const
Get the first time sample from observation in the current division.
Definition: TimeDivide.h:113
virtual void set_output_order(TimeSeries::Order)
Set the order of the dimensions in the output TimeSeries.
Definition: Unpacker.C:65
void phase(Profile *input)
void set_start_time(MJD start_time)
Set the start time at which to begin dividing.
Definition: TimeDivide.C:35
double get_seconds() const
Get the number of seconds in each division.
Definition: TimeDivide.h:52
Parses Observation attributes from a SigProc header.
Definition: SigProcObservation.h:24
Produces TimeSeries data by integrating an Input with an Unpacker.
Definition: IOManager.h:26
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
void tscrunch(Container *, const ScrunchFactor &)
static bool verbose
Verbosity flag.
Definition: Observation.h:39
MJD get_start_time() const
Get the start time at which to begin dividing.
Definition: TimeDivide.h:46
Simple 8-bit to float unpacker for the BPSR cross pol files.
Definition: BPSRCrossUnpacker.h:23
void set_period(double)
Set the folding period used to determine pulse phase.
Definition: TimeDivide.C:98
void discard_bounds(const Observation *)
Call this method if, after calling set_bounds, the data were not used.
Definition: TimeDivide.C:339
Order
Order of the dimensions.
Definition: TimeSeries.h:39
void unload(FILE *header)
Write a SigProc header block.
Definition: SigProcObservation.C:230
virtual void copy(const Observation *obs)
Same as operator= but takes a pointer.
Definition: Observation.h:57
MJD get_reference_epoch() const
Set the reference epoch (start time of first division)
Definition: TimeDivide.h:58
Rescale all channels and polaristions indepdenently to a zero mean and unit variance.
Definition: Rescale.h:29
double reference_phase
The reference phase.
Definition: TimeDivide.h:150
double get_rate() const
Return the sampling rate (time samples per second in Hz)
Definition: Observation.h:157
uint64_t get_division() const
Get the current division.
Definition: TimeDivide.h:125
bool set_output_ppqq()
only unpack PP & QQ inputs
Definition: BPSRCrossUnpacker.C:45
bool integer_division_seconds_boundaries
Round division boundaries to integer numbers of division_seconds.
Definition: TimeDivide.h:156
bool get_is_valid() const
Return true if the last bound Observation covers the current division.
Definition: TimeDivide.h:101
static bool record_time
Global flag enables stopwatch to record the time spent operating.
Definition: Operation.h:42
Decimates a TimeSeries in the time domain.
Definition: TScrunch.h:28
void fscrunch(Container *, const ScrunchFactor &)
void set_reference_phase(double phase)
Set the reference phase (phase of bin zero)
Definition: TimeDivide.C:106
PScrunch all channels and polarizations.
Definition: PScrunch.h:25
void set_seconds(double division_seconds)
Set the number of seconds in each division.
Definition: TimeDivide.C:68
Stores information about digital, band-limited, time-varying signals.
Definition: Observation.h:33
Decimates a TimeSeries in the frequency domain.
Definition: FScrunch.h:23
Converts floating point values to N-bit sigproc filterbank format.
Definition: SigProcDigitizer.h:24
double get_reference_phase() const
Get the reference phase (phase of bin zero)
Definition: TimeDivide.h:82
bool fractional_pulses
Include the fractional pulses at the start and end of data.
Definition: TimeDivide.h:153
Arrays of consecutive samples for each polarization and frequency channel.
Definition: TimeSeries.h:29
double get_bandwidth() const
Return the bandwidth of signal in MHz (-ve = lsb; +ve = usb)
Definition: Observation.h:147
uint64_t get_division_ndat() const
Get the total number of time samples in the current division.
Definition: TimeDivide.h:119
void set_predictor(const Pulsar::Predictor *)
Set the Pulsar::Predictor used to determine pulse phase.
Definition: TimeDivide.C:88
bool get_in_next() const
Return true if the last bound Observation covers the next division.
Definition: TimeDivide.h:107
void set_bounds(const Observation *)
Calculate the boundaries of the current division.
Definition: TimeDivide.C:123
bool get_end_reached() const
Return true if the end of the current division has been reached.
Definition: TimeDivide.h:110
void set_turns(double division_turns)
Set the number of turns in each division.
Definition: TimeDivide.C:78
Reference::To< const Pulsar::Predictor > poly
The Pulsar::Predictor used to determine pulse phase.
Definition: TimeDivide.h:162
std::string get_source() const
Return the source name.
Definition: Observation.h:122
double get_turns() const
Get the number of turns in each division.
Definition: TimeDivide.h:64
static bool verbose
Global verbosity flag.
Definition: Operation.h:48
A container for storing digitized (generally not floating point) data
Definition: BitSeries.h:35
TimeDivide()
Constructor.
Definition: TimeDivide.C:27
void unload(char *header)
Write an ASCII header block.
Definition: ASCIIObservation.C:563
double get_centre_frequency() const
Return the centre frequency of the band-limited signal in MHz.
Definition: Observation.h:134
void set_boundaries(const MJD &time)
Calculates the boundaries of the sub-integration containing time.
Definition: TimeDivide.C:345
bool verbose
Abstract base class of Transformations that convert n-bit to float.
Definition: Unpacker.h:42
double division_seconds
Number of seconds in each division.
Definition: TimeDivide.h:141
void set_fractional_pulses(bool)
Fold the fractional pulses at the start and end of data.
Definition: TimeDivide.C:113
unsigned get_phase_bin() const
Get the phase bin of the current division (turns < 1)
Definition: TimeDivide.h:122
MJD start_time
The start time from which to begin dividing time.
Definition: TimeDivide.h:135
double period
The period used to determine pulse phase.
Definition: TimeDivide.h:159
bool get_new_division() const
Return true if the last bound Observation covers a new division.
Definition: TimeDivide.h:104
State pscrunch(State state)
void set_reference_epoch(const MJD &epoch)
Set the reference epoch (start time of first division)
Definition: TimeDivide.h:55
double get_period() const
Set the folding period used to determine pulse phase.
Definition: TimeDivide.h:76
uint64_t get_ndat() const
Get the number of time samples from observation in the current division.
Definition: TimeDivide.h:116
virtual bool get_order_supported(TimeSeries::Order) const
Return true if the unpacker supports the specified output order.
Definition: Unpacker.C:58
Parses Observation attributes from an ASCII header.
Definition: ASCIIObservation.h:29
const Pulsar::Predictor * get_predictor() const
Get the Pulsar::Predictor used to determine pulse phase.
Definition: TimeDivide.h:70
bool get_fractional_pulses() const
Set the start time at which to begin dividing.
Definition: TimeDivide.C:118
MJD reference_epoch
Reference epoch at start of the first division.
Definition: TimeDivide.h:144
@ OrderFPT
Frequency, Polarization, Time (default before 3 October 2008)
Definition: TimeSeries.h:47
@ OrderTFP
Time, Frequency, Polarization (better for many things)
Definition: TimeSeries.h:50
double division_turns
Number of turns in each division.
Definition: TimeDivide.h:147
~TimeDivide()
Destructor.
Definition: TimeDivide.C:31
unsigned get_nchan() const
Return the number of channels into which the band is divided.
Definition: Observation.h:85

Generated using doxygen 1.8.17