ExcisionUnpacker.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2008 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/ExcisionUnpacker.h
10 
11 #ifndef __ExcisionUnpacker_h
12 #define __ExcisionUnpacker_h
13 
14 #include "dsp/HistUnpacker.h"
15 #include "JenetAnderson98.h"
16 
17 namespace dsp
18 {
19  class WeightedTimeSeries;
20  class Input;
21 
23  class ExcisionUnpacker: public HistUnpacker
24  {
25 
26  public:
27 
29  ExcisionUnpacker (const char* name = "ExcisionUnpacker");
30 
32  void reserve ();
33 
35  void set_output (TimeSeries*);
36 
38  void match_resolution (Input*);
39 
41  unsigned get_resolution () const;
42 
44  virtual unsigned get_input_offset (unsigned idig) const;
45 
47  virtual unsigned get_input_incr () const;
48 
50  virtual unsigned get_output_incr () const;
51 
53  virtual void set_ndat_per_weight (unsigned ndat_per_weight);
54 
56  unsigned get_ndat_per_weight () const { return ndat_per_weight; }
57 
59  virtual void set_nstate (unsigned nstate) { set_ndat_per_weight (nstate); }
60 
62  virtual void set_cutoff_sigma (float cutoff_sigma);
63 
65  virtual float get_cutoff_sigma() const { return cutoff_sigma; }
66 
68  virtual void set_threshold (float threshold) { }
69 
71  virtual float get_threshold () const { return 0.0; }
72 
73  //
74  //
75  //
76 
78  float get_fraction_low () const { return ja98.get_mean_Phi(); }
79 
81  unsigned get_nlow_min() const { return nlow_min; }
82 
84  unsigned get_nlow_max() const { return nlow_max; }
85 
86  protected:
87 
90 
92  void set_limits ();
93 
95  virtual void build ();
96 
98  void unpack ();
99 
101  virtual void dig_unpack (const unsigned char* input_data,
102  float* output_data,
103  uint64_t ndat,
104  unsigned long* hist,
105  unsigned* weights = 0,
106  unsigned nweights = 0) = 0;
107 
109  template<class U, class Iterator>
111  float* output_data, uint64_t ndat,
112  unsigned long* hist,
113  unsigned* weights, unsigned nweights);
114 
116  float cutoff_sigma;
117 
119  unsigned nlow_min;
120 
122  unsigned nlow_max;
123 
126 
128  unsigned current_digitizer;
129 
131  void not_built ();
132 
133  private:
134 
136  bool built;
137 
139  unsigned ndat_per_weight;
140 
141  };
142 }
143 
144 #endif
void excision_unpack(U &unpack, Iterator &input, float *output_data, uint64_t ndat, unsigned long *hist, unsigned *weights, unsigned nweights)
Template method can be used to implement pure virtual dig_unpack.
virtual unsigned get_input_offset(unsigned idig) const
Get the offset (number of bytes) into input for the given digitizer.
Definition: ExcisionUnpacker.C:265
virtual void build()
Build the look-up tables and allocate histograms.
Definition: ExcisionUnpacker.C:164
void set_limits()
Set nlow_min and nlow_max using current attributes.
Definition: ExcisionUnpacker.C:99
unsigned get_ndat_per_weight() const
Get the number of samples per weight in WeightTimeSeries output.
Definition: ExcisionUnpacker.h:61
void set_output(TimeSeries *)
Overload Transformation::set_output to also set weighted_output.
Definition: ExcisionUnpacker.C:43
Bit unpacker that keeps a histogram and optimal statistics.
Definition: HistUnpacker.h:25
Pure virtual base class of all objects that can load BitSeries data.
Definition: Input.h:31
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
double get_mean_Phi() const
virtual float get_cutoff_sigma() const
Get the cut off power for impulsive interference excision.
Definition: ExcisionUnpacker.h:70
virtual float get_threshold() const
Get the sampling threshold as a fraction of the noise power.
Definition: ExcisionUnpacker.h:76
ExcisionUnpacker(const char *name="ExcisionUnpacker")
Null constructor.
Definition: ExcisionUnpacker.C:22
bool psrdisp_compatible
Set true to enable backward compatibility features.
Definition: dsp.C:10
virtual unsigned get_output_incr() const
Get the offset (number of floats) between consecutive digitizer samples.
Definition: ExcisionUnpacker.C:277
unsigned get_nlow_max() const
Get the maxumum number of ones in ndat_per_weight points.
Definition: ExcisionUnpacker.h:89
float cutoff_sigma
Cut off power for impulsive interference excision.
Definition: ExcisionUnpacker.h:121
void not_built()
Derived types may not set built flag to true, but can set it to false.
Definition: ExcisionUnpacker.C:173
std::string name
Operation name.
Definition: Operation.h:153
unsigned get_nlow_min() const
Get the minumum number of ones in ndat_per_weight points.
Definition: ExcisionUnpacker.h:86
unsigned nlow_min
Minumum number of low states in ndat_per_weight points.
Definition: ExcisionUnpacker.h:124
virtual unsigned get_input_incr() const
Get the offset to the next byte containing the current digitizer data.
Definition: ExcisionUnpacker.C:271
Container of weighted time-major order floating point data.
Definition: WeightedTimeSeries.h:26
Arrays of consecutive samples for each polarization and frequency channel.
Definition: TimeSeries.h:29
virtual void set_cutoff_sigma(float cutoff_sigma)
Set the cut off power for impulsive interference excision.
Definition: ExcisionUnpacker.C:286
virtual void set_threshold(float threshold)
Set the sampling threshold as a fraction of the noise power.
Definition: ExcisionUnpacker.h:73
void set_output(TimeSeries *output)
Set the container into which output data will be written.
Definition: Transformation.h:275
virtual void set_ndat_per_weight(unsigned ndat_per_weight)
Set the number of samples per weight in WeightTimeSeries output.
Definition: ExcisionUnpacker.C:88
unsigned nlow_max
Maximum number of low states in ndat_per_weight points.
Definition: ExcisionUnpacker.h:127
void reserve()
Initialize the WeightedTimeSeries dimensions.
Definition: ExcisionUnpacker.C:53
unsigned current_digitizer
The current digitized stream.
Definition: ExcisionUnpacker.h:133
float get_fraction_low() const
Get the fraction of samples in the low state.
Definition: ExcisionUnpacker.h:83
void unpack()
Unpack using dig_unpack.
Definition: ExcisionUnpacker.C:178
virtual void dig_unpack(const unsigned char *input_data, float *output_data, uint64_t ndat, unsigned long *hist, unsigned *weights=0, unsigned nweights=0)=0
Unpack a single digitized stream from raw into data.
Reference::To< WeightedTimeSeries > weighted_output
Set when Transformation::output is a WeightedTimeSeries.
Definition: ExcisionUnpacker.h:94
Interface to Unpacker iterator implementations.
Definition: UnpackerIterator.h:24
virtual void set_nstate(unsigned nstate)
Set the number of states in the histogram.
Definition: ExcisionUnpacker.h:64
JenetAnderson98 ja98
The theory behind the implementation.
Definition: ExcisionUnpacker.h:130
unsigned get_resolution() const
Return ndat_per_weight.
Definition: ExcisionUnpacker.C:81
Reference::To< const BitSeries > input
Container from which input data will be read.
Definition: HasInput.h:49
void match_resolution(Input *)
Match the ndat_per_weight to the resolution of the Input.
Definition: ExcisionUnpacker.C:69
virtual void set_nstate(unsigned nstate)
Set the number of states in the histogram.
Definition: HistUnpacker.C:88

Generated using doxygen 1.8.17