TwoBitStats.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/Extensions/Pulsar/TwoBitStats.h
10 
11 #ifndef __TwoBitStats_h
12 #define __TwoBitStats_h
13 
14 #include "Pulsar/ArchiveExtension.h"
15 
16 namespace Pulsar {
17 
19 
25  class TwoBitStats : public Pulsar::Archive::Extension {
26 
27  public:
28 
31 
33  TwoBitStats (const TwoBitStats& extension);
34 
36  const TwoBitStats& operator= (const TwoBitStats& extension);
37 
39  TwoBitStats* clone () const { return new TwoBitStats( *this ); }
40 
42  void resize (unsigned nsample, unsigned ndig);
43 
45  unsigned get_ndig () const;
46 
48  unsigned get_nsample () const;
49 
51  void set_threshold (float threshold);
52 
54  float get_threshold () const { return threshold; }
55 
57  void set_cutoff_sigma (float cutoff_sigma);
58 
60  float get_cutoff_sigma () const { return cutoff_sigma; }
61 
63  const std::vector<float>& get_histogram (unsigned idig) const;
64 
66  void set_histogram (const std::vector<float>&, unsigned idig);
67 
69  void zero ();
70 
72  double get_mean_Phi (unsigned idig) const;
73 
75  double get_distortion (unsigned idig) const;
76 
77  protected:
78 
80  unsigned ndig;
81 
83  unsigned nsample;
84 
86  float threshold;
87 
89  float cutoff_sigma;
90 
92  std::vector< std::vector<float> > histogram;
93 
95  void range_check (unsigned idig, const char* method) const;
96 
97  };
98 
99 }
100 
101 #endif
float cutoff_sigma
Cut off power used for impulsive interference excision.
Definition: TwoBitStats.h:99
void set_mean_Phi(double mean_Phi)
void range_check(unsigned idig, const char *method) const
Throw an exception if idig out of range.
Definition: TwoBitStats.C:117
unsigned nsample
Number of samples used to estimate undigitized power.
Definition: TwoBitStats.h:93
void set_cutoff_sigma(float cutoff_sigma)
Set the cut off power used for impulsive interference excision.
Definition: TwoBitStats.C:68
TwoBitStats * clone() const
Clone method.
Definition: TwoBitStats.h:49
void zero()
Set all histogram data to zero.
Definition: TwoBitStats.C:89
float get_threshold() const
Get the sampling threshold as a fraction of the noise power.
Definition: TwoBitStats.h:64
const TwoBitStats & operator=(const TwoBitStats &extension)
Operator =.
Definition: TwoBitStats.C:36
double get_distortion(unsigned idig) const
Get the difference between the measured and theoretical distributions.
Definition: TwoBitStats.C:129
void resize(unsigned nsample, unsigned ndig)
Set the number of samples per estimate and number of digitizers.
Definition: TwoBitStats.C:74
TwoBitStats()
Default constructor.
Definition: TwoBitStats.C:17
unsigned ndig
Number of digitizers.
Definition: TwoBitStats.h:90
unsigned get_ndig() const
Get the number of digitizers.
Definition: TwoBitStats.C:56
double get_mean_Phi(unsigned idig) const
Get the mean fraction of low voltage states.
Definition: TwoBitStats.C:123
const std::vector< float > & get_histogram(unsigned idig) const
Get the specified histogram.
Definition: TwoBitStats.C:98
unsigned get_nsample() const
Get the number of time samples used to estimate undigitized power.
Definition: TwoBitStats.C:50
void set_threshold(float threshold)
Set the sampling threshold as a fraction of the noise power.
Definition: TwoBitStats.C:62
std::vector< std::vector< float > > histogram
Low-voltage state count histograms.
Definition: TwoBitStats.h:102
Stores histograms of two-bit low-voltage states.
Definition: TwoBitStats.h:30
Definition: ArchiveExtension.h:28
void set_histogram(const std::vector< float > &, unsigned idig)
Set the specified histogram.
Definition: TwoBitStats.C:105
Defines the PSRCHIVE library.
Definition: CalSource.h:17
float get_cutoff_sigma() const
Get the cut off power for impulsive interference excision.
Definition: TwoBitStats.h:70
float threshold
Sampling threshold as a fraction of the noise power.
Definition: TwoBitStats.h:96
void get_prob_Phi(unsigned L, std::vector< float > &prob_Phi)
static double get_optimal_spacing(unsigned bits)

Generated using doxygen 1.8.17