SpectralKurtosis.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2011 by Andrew Jameson
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/Base/Extensions/Pulsar/SpectralKurtosis.h
10
11#ifndef __Pulsar_SpectralKurtosis_h
12#define __Pulsar_SpectralKurtosis_h
13
14#include "Pulsar/IntegrationExtension.h"
15#include "TextInterface.h"
16
17namespace Pulsar {
18
21
22 public:
23
26
28 SpectralKurtosis (const SpectralKurtosis& extension);
29
31 const SpectralKurtosis& operator= (const SpectralKurtosis& extension);
32
35
37 SpectralKurtosis* clone () const { return new SpectralKurtosis( *this ); }
38
41
42 // Text interface to a SpectralKurtosis instance
43 class Interface : public TextInterface::To<SpectralKurtosis>
44 {
45 public:
46 Interface( SpectralKurtosis *s_instance = NULL );
47 };
48
49 // Abstract loader for SpectralKurtosis extension
50 class Loader : public Reference::Able
51 {
52 public:
53 virtual void load (SpectralKurtosis * s) = 0;
54 };
55
57 std::string get_short_name () const { return "skz"; }
58
60 const SpectralKurtosis& operator += (const SpectralKurtosis& extension);
61
63 void set_loader (SpectralKurtosis::Loader *);
64
66 void resize (unsigned npol, unsigned nchan);
67
69 void integrate (const Integration* subint);
70
72 void update (const Integration* subint);
73
75 void set_npol (unsigned n) { npol = n; }
77 unsigned get_npol() const { get_data(); return npol; }
78
80 void set_nchan (unsigned n) { nchan = n; }
82 unsigned get_nchan() const { get_data(); return nchan; }
83
85 void set_M (unsigned _M);
87 unsigned get_M() const;
88
90 void set_excision_threshold (unsigned nsigma);
92 unsigned get_excision_threshold () const;
93
95 float get_filtered_sum (unsigned ichan, unsigned ipol) const;
97 void set_filtered_sum (unsigned ichan, unsigned ipol, float sum);
98
100 uint64_t get_filtered_hits (unsigned ichan) const;
102 void set_filtered_hits (unsigned ichan, uint64_t hits);
103
105 float get_unfiltered_sum (unsigned ichan, unsigned ipol) const;
107 void set_unfiltered_sum (unsigned ichan, unsigned ipol, float sum);
108
109 // Get the unfiltered hits, common to all channels and polarizations
110 uint64_t get_unfiltered_hits () const;
111 // Set the unfiltered hits, common to all channels and polarizations
112 void set_unfiltered_hits (uint64_t hits);
113
115 void set_ipol_mean (unsigned ipol) { ipol_mean = ipol; }
116 unsigned get_ipol_mean () const { return ipol_mean; }
117
119 float get_unfiltered_mean (unsigned ichan) const;
120 float get_filtered_mean (unsigned ichan) const;
121
122 protected:
123
126
128 unsigned npol = 0;
129
131 unsigned nchan = 0;
132
134 unsigned M = 0;
135
137 unsigned nsigma = 0;
138
140 std::vector<float> filtered_sum;
141
143 std::vector<uint64_t> filtered_hits;
144
146 std::vector<float> unfiltered_sum;
147
149 uint64_t unfiltered_hits = 0;
150
152 void get_data () const;
153 void load ();
154
156 void range_check (unsigned ichan, unsigned ipol, const char* method) const;
157
158 unsigned ipol_mean = 0;
159 };
160
161}
162
163#endif
164
Definition IntegrationExtension.h:25
Array of Profiles integrated over the same time interval.
Definition Integration.h:37
Spectral Kurtosis Staticstics calculated during observation.
Definition SpectralKurtosis.h:20
unsigned npol
number of polarizations
Definition SpectralKurtosis.h:128
const SpectralKurtosis & operator=(const SpectralKurtosis &extension)
Assignment operator.
Definition SpectralKurtosis.C:29
unsigned nchan
number of channels
Definition SpectralKurtosis.h:131
float get_filtered_sum(unsigned ichan, unsigned ipol) const
Get the filtered sum of the specified channel and polarization.
Definition SpectralKurtosis.C:130
float get_unfiltered_sum(unsigned ichan, unsigned ipol) const
Get the unfiltered sum of the specified channel and polarization.
Definition SpectralKurtosis.C:167
uint64_t get_filtered_hits(unsigned ichan) const
Get the filtered hits of the specified channel and polarization.
Definition SpectralKurtosis.C:149
unsigned nsigma
Threshold used to excise RFI in SK Detection.
Definition SpectralKurtosis.h:137
std::vector< float > filtered_sum
Average SK statistic for each channel, post f/t scrunch zapping.
Definition SpectralKurtosis.h:140
void set_excision_threshold(unsigned nsigma)
Set the excision threshold in terms of std deviations.
Definition SpectralKurtosis.C:115
Reference::To< SpectralKurtosis::Loader > loader
loads the SK data from file
Definition SpectralKurtosis.h:125
void set_ipol_mean(unsigned ipol)
Set the polarization for which means will be computed.
Definition SpectralKurtosis.h:115
void resize(unsigned npol, unsigned nchan)
Resize the extension.
Definition SpectralKurtosis.C:229
float get_unfiltered_mean(unsigned ichan) const
Get the unfiltered mean of the specified channel.
Definition SpectralKurtosis.C:201
void get_data() const
Load the integration data from file.
Definition SpectralKurtosis.C:276
void update(const Integration *subint)
Update information based on the provided Integration.
Definition SpectralKurtosis.C:256
void integrate(const Integration *subint)
Integrate information from another Integration.
Definition SpectralKurtosis.C:239
~SpectralKurtosis()
Destructor.
Definition SpectralKurtosis.C:95
void set_unfiltered_sum(unsigned ichan, unsigned ipol, float sum)
Set the unfiltered sum of the specified channel and polarization.
Definition SpectralKurtosis.C:178
unsigned get_nchan() const
Get the number of channels.
Definition SpectralKurtosis.h:82
void set_loader(SpectralKurtosis::Loader *)
Set the loader used for this integration.
Definition SpectralKurtosis.C:223
unsigned get_npol() const
Get the number of polarizations.
Definition SpectralKurtosis.h:77
SpectralKurtosis * clone() const
Clone method.
Definition SpectralKurtosis.h:37
unsigned get_M() const
Get the base integration factor used in the SK statistic.
Definition SpectralKurtosis.C:105
std::string get_short_name() const
Short name.
Definition SpectralKurtosis.h:57
void range_check(unsigned ichan, unsigned ipol, const char *method) const
Ensure that ichan < nchan and ipol < npol.
Definition SpectralKurtosis.C:214
const SpectralKurtosis & operator+=(const SpectralKurtosis &extension)
Addition operator.
Definition SpectralKurtosis.C:47
void set_nchan(unsigned n)
Set the number of channels.
Definition SpectralKurtosis.h:80
unsigned M
Number of samples integrated into each atomic SK statistic.
Definition SpectralKurtosis.h:134
uint64_t unfiltered_hits
Hits on unfiltered SK statistic, same for each channel/pol.
Definition SpectralKurtosis.h:149
SpectralKurtosis()
Default constructor.
Definition SpectralKurtosis.C:16
unsigned get_excision_threshold() const
Get the excision threshold in terms of std deviations.
Definition SpectralKurtosis.C:120
void set_filtered_hits(unsigned ichan, uint64_t hits)
Set the filtered hits of the specified channel and polarization.
Definition SpectralKurtosis.C:160
std::vector< float > unfiltered_sum
Average SK statistic for each channel formed from block length SK estimates.
Definition SpectralKurtosis.h:146
std::vector< uint64_t > filtered_hits
Hits on filtered average for each channel.
Definition SpectralKurtosis.h:143
void set_npol(unsigned n)
Set the number of polarizations.
Definition SpectralKurtosis.h:75
void set_M(unsigned _M)
Set the base integration factor used to calculate the SK statistic.
Definition SpectralKurtosis.C:100
void set_filtered_sum(unsigned ichan, unsigned ipol, float sum)
Set the filtered sum of the specified channel and polarization.
Definition SpectralKurtosis.C:141
TextInterface::Parser * get_interface()
Return a text interfaces that can be used to access this instance.
Definition SpectralKurtosis.C:295
Spectral Kurtosis Staticstics calculated during observation.
Definition SpectralKurtosis.h:20
Defines the PSRCHIVE library.
Definition CalSource.h:17

Generated using doxygen 1.14.0