Statistics.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2004 - 2016 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/More/General/Pulsar/Statistics.h
10
11#ifndef __Pulsar_Statistics_h
12#define __Pulsar_Statistics_h
13
14#include "Pulsar/HasArchive.h"
15#include "TextInterface.h"
16#include "PhaseRange.h"
17
18namespace Pulsar {
19
20 class ProfileStats;
21 class PhaseWeight;
22 class StrategySet;
23
25 class Statistics : public Reference::Able, public HasArchive
26 {
27
28 public:
29
31 static unsigned get_instance_count ();
32
34 Statistics (const Archive* = 0);
35
37 ~Statistics ();
38
40 StrategySet* get_strategy () const;
41
43 ::Phase::Value get_peak () const;
44
46 double get_effective_duty_cycle () const;
47
49 double get_nfnr () const;
50
52 unsigned get_cal_ntrans () const;
53
55 unsigned get_nzero () const;
56
58 double get_design_effect () const;
59
61 double get_2bit_dist () const;
62
65
68
71
74
76 double get_weighted_frequency () const;
77
79 double get_bin_width () const;
80
82 double get_dispersive_smearing () const;
83
85 class Interface;
86
89
91 class Plugin;
92
94 void add_plugin (Plugin*);
95
96 protected:
97
98 void setup_stats ();
99 mutable Reference::To<ProfileStats> stats;
100
101 mutable std::vector< Reference::To<Plugin> > plugins;
102
104 void set_period (::Phase::HasUnit&) const;
105
106 };
107
108 class Statistics::Plugin : public Reference::Able
109 {
110 public:
111
112 Plugin () { setup = false; }
113
114 virtual TextInterface::Parser* get_interface () = 0;
115
117 { return parent->get_Integration(); }
118
119 protected:
120 friend class Statistics;
121 Reference::To<Statistics, false> parent;
122 virtual void set_setup (bool flag) { setup = flag; }
123 mutable bool setup;
124 };
125
126}
127
128// standard interface constructor defined in More/General/standard_interface.C
129TextInterface::Parser* standard_interface (Pulsar::Archive*);
130
131// also defined in More/General/standard_interface.C
132std::string process (TextInterface::Parser* interface, const std::string& txt);
133
134#endif
Array of Profiles integrated over the same time interval.
Definition Integration.h:37
The primary interface to pulsar observational data.
Definition Archive.h:46
HasArchive()
Default constructor.
Definition HasArchive.C:19
const Integration * get_Integration() const
Get the sub-integration defined by the current indeces.
Definition HasArchive.C:44
Stores a weight for each Profile phase bin.
Definition PhaseWeight.h:24
Computes pulse profile statistics.
Definition ProfileStats.h:32
Archive statistics text interface.
Definition StatisticsInterface.h:21
PhaseWeight * get_baseline()
Get the off-pulse baseline.
Definition Statistics.C:162
double get_nfnr() const
Get the Fourier-noise-to-noise ratio.
Definition Statistics.C:74
double get_2bit_dist() const
Get the predicted level of 2-bit distortion.
Definition Statistics.C:148
ProfileStats * get_stats()
Get the Profile statistics interface.
Definition Statistics.C:192
~Statistics()
Destructor.
Definition Statistics.C:39
StrategySet * get_strategy() const
Get the strategy manager owned by the Archive.
Definition Statistics.C:51
Statistics(const Archive *=0)
Default constructor.
Definition Statistics.C:33
PhaseWeight * get_onpulse()
Get the on-pulse phase bins.
Definition Statistics.C:172
unsigned get_cal_ntrans() const
Get the number of cal transitions.
Definition Statistics.C:91
PhaseWeight * get_all()
Get all phase bins.
Definition Statistics.C:182
double get_effective_duty_cycle() const
Get the effective duty cycle.
Definition Statistics.C:82
TextInterface::Parser * get_interface()
Get the text interface to this.
Definition Statistics.C:46
double get_weighted_frequency() const
Get the weighted frequency from the Pulsar::Archive.
Definition Statistics.C:203
double get_bin_width() const
Get the width of a phase bin in seconds.
Definition Statistics.C:209
static unsigned get_instance_count()
Get the number of Statistics objects in existence.
Definition Statistics.C:27
void set_period(::Phase::HasUnit &) const
Set the period attribute of the Phase::Value/Range/Ranges argument.
Definition Statistics.C:67
double get_dispersive_smearing() const
Get the dispersive smearing in the worst channel in seconds.
Definition Statistics.C:215
unsigned get_nzero() const
Get the number of profiles that have zero weight.
Definition Statistics.C:126
void add_plugin(Plugin *)
Add a plugin.
Definition Statistics.C:267
::Phase::Value get_peak() const
Get the phase of the pulse peak.
Definition Statistics.C:60
double get_design_effect() const
Get Kish's design effect.
Definition Statistics.C:98
Defines the PSRCHIVE library.
Definition CalSource.h:17

Generated using doxygen 1.14.0