Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
PowerSeries.h
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef SKA_CHEETAH_DATA_POWERSERIES_H
25 #define SKA_CHEETAH_DATA_POWERSERIES_H
26 
27 #include "cheetah/data/FrequencySeries.h"
28 #pragma GCC diagnostic push
29 #pragma GCC diagnostic ignored "-Wall"
30 #pragma GCC diagnostic ignored "-Wpragmas"
31 #pragma GCC diagnostic ignored "-Wunused-parameter"
32 #pragma GCC diagnostic ignored "-Wunused-variable"
33 #include <boost/math/distributions/chi_squared.hpp>
34 #include <boost/math/distributions/normal.hpp>
35 #pragma GCC diagnostic pop
36 
37 namespace ska {
38 namespace cheetah {
39 namespace data {
40 
41 
57 template <typename Arch, typename ValueType, typename Alloc=typename DefaultAllocator<Arch,ValueType>::type>
59  : public FrequencySeries<Arch, ValueType, Alloc>
60  , public panda::DataChunk<PowerSeries<Arch, ValueType, Alloc>>
61 {
62  private:
64 
65  public:
66  typedef Alloc Allocator;
67 
68  public:
69  typedef boost::math::chi_squared_distribution<double> ChiSquaredType;
70  typedef boost::math::normal_distribution<double> GaussianType;
71 
72  public:
76  PowerSeries(std::size_t size=0, Allocator const& allocator = Allocator());
77 
85  PowerSeries(FourierFrequencyType const& df, double degrees_of_freedom=2.0f
86  , std::size_t=0, Allocator const& allocator=Allocator());
87  ~PowerSeries();
88 
94  double degrees_of_freedom() const;
95 
101  void degrees_of_freedom(double dof);
102 
114  double pvalue(float power) const;
115 
123  float power_to_equiv_sigma(float power) const;
124 
132  float equiv_sigma_to_power(float sigma) const;
133 
134  private:
135  double _dof;
136  ChiSquaredType _distribution;
137  GaussianType _gaussian;
138 };
139 
140 
141 } // namespace data
142 } // namespace cheetah
143 } // namespace ska
144 
145 #include "cheetah/data/detail/PowerSeries.cpp"
146 
147 #endif // SKA_CHEETAH_DATA_POWERSERIES_H
float power_to_equiv_sigma(float power) const
For a given power level compute the Gaussian equivalent sigma.
Definition: PowerSeries.cpp:77
PowerSeries(std::size_t size=0, Allocator const &allocator=Allocator())
Create a new default PowerSeries instance.
Definition: PowerSeries.cpp:36
A container of Fourier series data.
Some limits and constants for FLDO.
Definition: Brdz.h:35
Class for power series (detected FrequencySeries).
Definition: PowerSeries.h:58
float equiv_sigma_to_power(float sigma) const
Compute the power that corresponds to a Gaussian equivalent sigma.
Definition: PowerSeries.cpp:83
double pvalue(float power) const
Return the statistical probability of a given power level occurring.
Definition: PowerSeries.cpp:71
std::size_t size() const
the size of the series
Definition: Series.cpp:109
double degrees_of_freedom() const
Retreive the (assumed) degrees of freedom of the data distribution.
Definition: PowerSeries.cpp:58