Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
FrequencySeries.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_FREQUENCYSERIES_H
25 #define SKA_CHEETAH_DATA_FREQUENCYSERIES_H
26 
27 #include "cheetah/data/Series.h"
28 #include "cheetah/data/Units.h"
29 #include "cheetah/data/DefaultAllocator.h"
30 #include "cheetah/utils/Architectures.h"
31 
32 #include "panda/DataChunk.h"
33 
34 namespace ska {
35 namespace cheetah {
36 namespace data {
37 
53 template <typename Arch, typename ValueType, typename Alloc=typename DefaultAllocator<Arch,ValueType>::type>
55  : public Series<Arch, ValueType, Alloc>
56  , public panda::DataChunk<FrequencySeries<Arch, ValueType, Alloc>>
57 {
59 
60  public:
61  typedef Alloc Allocator;
62  typedef Arch Architecture;
63 
64  public:
68  FrequencySeries(Allocator const& allocator = Allocator());
69 
73  FrequencySeries(std::size_t size, Allocator const& allocator = Allocator());
74 
78  template<typename OtherArch, typename OtherAlloc>
79  explicit FrequencySeries(FrequencySeries<OtherArch, ValueType, OtherAlloc> const& copy, Alloc const& allocator = Allocator());
80 
86  FrequencySeries(FourierFrequencyType const& df, std::size_t size, Allocator const& allocator = Allocator());
87 
93  FrequencySeries(FourierFrequencyType const& df, Allocator const& allocator = Allocator());
94  ~FrequencySeries();
95 
101  FourierFrequencyType const& frequency_step() const;
102 
108  void frequency_step(FourierFrequencyType const& df);
109 
110 
111  data::FourierFrequencyType const bin_to_frequency(std::size_t idx) const;
112  data::TimeType const bin_to_period(std::size_t idx) const;
113  std::size_t frequency_to_bin(data::FourierFrequencyType const& frequency) const;
114 
115  private:
116  FourierFrequencyType _frequency_step;
117 };
118 
119 
120 } // namespace data
121 } // namespace cheetah
122 } // namespace ska
123 
124 #include "cheetah/data/detail/FrequencySeries.cpp"
125 
126 #endif // SKA_CHEETAH_DATA_FREQUENCYSERIES_H
127 
FourierFrequencyType const & frequency_step() const
Retrieve the frequency step of the series.
A container of Fourier series data.
Some limits and constants for FLDO.
Definition: Brdz.h:35
Base class for generic data series.
Definition: Series.h:44
FrequencySeries(Allocator const &allocator=Allocator())
Construct a default frequency series (of size 0)
std::size_t size() const
the size of the series
Definition: Series.cpp:109