TwoBitCorrection.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2002 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/TwoBitCorrection.h
10 
11 #ifndef __TwoBitCorrection_h
12 #define __TwoBitCorrection_h
13 
14 #include "dsp/ExcisionUnpacker.h"
15 #include "dsp/TwoBitFour.h"
16 
17 #include "environ.h"
18 #include <vector>
19 
20 namespace dsp {
21 
22  class TwoBitTable;
23 
25 
34  class TwoBitCorrection: public ExcisionUnpacker
35  {
36 
37  public:
38 
40  TwoBitCorrection (const char* name = "TwoBitCorrection");
41 
43  virtual ~TwoBitCorrection ();
44 
46  class Config;
47 
49  void set_dynamic_output_level_setting (bool flag = true);
50 
52  virtual double get_optimal_variance ();
53 
55  void set_threshold (float threshold);
56 
58  float get_threshold () const { return ja98.get_threshold(); }
59 
61  void set_table (TwoBitTable* table);
62 
64  const TwoBitTable* get_table () const;
65 
67  static TwoBitCorrection* create (const BitSeries& input,
68  unsigned ndat_per_weight = 0,
69  float cutoff_rms = 3.0);
70 
71  protected:
72 
75 
77  void build ();
78 
80  virtual unsigned get_ndig_per_byte () const;
81 
83  virtual void dig_unpack (const unsigned char* input_data,
84  float* output_data,
85  uint64_t ndat,
86  unsigned long* hist,
87  unsigned* weights = 0,
88  unsigned nweights = 0);
89 
92 
93  virtual TwoBitLookup* get_unpacker () { return &unpacker; }
94 
97 
98  };
99 
100 }
101 
102 #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.
An iterator through contiguous data.
Definition: StepIterator.h:16
virtual void build()
Build the look-up tables and allocate histograms.
Definition: ExcisionUnpacker.C:164
void set_nlow_min(unsigned min)
Set the minimum acceptable number of low voltage states.
Definition: TwoBitLookup.C:33
virtual void dig_unpack(const unsigned char *input_data, float *output_data, uint64_t ndat, unsigned long *hist, unsigned *weights=0, unsigned nweights=0)
Unpack a single polarization from raw into data.
Definition: TwoBitCorrection.C:153
void build()
Build the two-bit correction look-up table and allocate histograms.
Definition: TwoBitCorrection.C:116
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
const TwoBitTable * get_table() const
Get the digitization convention.
Definition: TwoBitCorrection.C:95
void set_table(TwoBitTable *table)
Set the digitization convention.
Definition: TwoBitCorrection.C:82
virtual void lookup_build(TwoBitTable *, JenetAnderson98 *=0)
Build the output value lookup table.
Definition: TwoBitLookup.C:77
void set_nlow_max(unsigned max)
Set the maximum acceptable number of low voltage states.
Definition: TwoBitLookup.C:39
std::string name
Operation name.
Definition: Operation.h:153
double get_threshold() const
TwoBitFour unpacker
Two-bit unpacker.
Definition: TwoBitCorrection.h:101
TwoBitCorrection(const char *name="TwoBitCorrection")
Null constructor.
Definition: TwoBitCorrection.C:27
void set_dynamic_output_level_setting(bool flag=true)
Enable or disable dynamic output level setting.
Definition: TwoBitCorrection.C:60
virtual ~TwoBitCorrection()
Virtual destructor.
Definition: TwoBitCorrection.C:39
void set_ndat(unsigned ndat)
Set the number of time samples in each population counted.
Definition: TwoBitLookup.C:45
virtual unsigned get_ndig_per_byte() const
Get the number of digitizer outputs in one byte.
Definition: TwoBitCorrection.C:54
float get_threshold() const
Get the sampling threshold as a fraction of the noise power.
Definition: TwoBitCorrection.h:63
Creates lookup table for 2-bit dynamic output level setting.
Definition: TwoBitLookup.h:23
void set_ndim(unsigned ndim)
Set the dimension of the time samples (1=real, 2=complex)
Definition: TwoBitLookup.C:52
Reference::To< TwoBitTable > table
Two-bit conversion table generator.
Definition: TwoBitCorrection.h:96
static TwoBitCorrection * create(const BitSeries &input, unsigned ndat_per_weight=0, float cutoff_rms=3.0)
Return a pointer to a new instance of the appropriate sub-class.
bool dynamic_output_level_setting
Perform dynamic output level setting.
Definition: TwoBitCorrection.h:79
Look-up table for converting 2-bit digitized to floating point numbers.
Definition: TwoBitTable.h:25
virtual void set_ndat_per_weight(unsigned ndat_per_weight)
Set the number of samples per weight in WeightTimeSeries output.
Definition: ExcisionUnpacker.C:88
virtual double get_optimal_variance()
Get the optimal value of the time series variance.
Definition: TwoBitCorrection.C:44
Unpack four 2-bit samples per byte from an array of bytes.
Definition: TwoBitFour.h:24
JenetAnderson98 ja98
The theory behind the implementation.
Definition: ExcisionUnpacker.h:130
Reference::To< const BitSeries > input
Container from which input data will be read.
Definition: HasInput.h:49
void set_threshold(float threshold)
Set the sampling threshold as a fraction of the noise power.
Definition: TwoBitCorrection.C:70
Excises digitized data with statistics outside of acceptable limits.
Definition: ExcisionUnpacker.h:28

Generated using doxygen 1.8.17