Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
FrequencyTime.cpp
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 #include "cheetah/data/TimeFrequency.h"
25 #include "panda/Copy.h"
26 #include <type_traits>
27 
28 namespace ska {
29 namespace cheetah {
30 namespace data {
31 
32 template <class Arch, typename NumericalT>
34  : BaseT( pss::astrotypes::DimensionSize<Frequency>(0)
35  , pss::astrotypes::DimensionSize<Time>(0))
36 {}
37 
38 template <class Arch, typename NumericalT>
39 FrequencyTime<Arch, NumericalT>::FrequencyTime(DimensionSize<Time> number_of_spectra, DimensionSize<Frequency> number_of_channels)
40  : BaseT( number_of_channels, number_of_spectra)
41 {
42 }
43 
44 template <class Arch, typename NumericalT>
45 FrequencyTime<Arch, NumericalT>::FrequencyTime(DimensionSize<Frequency> number_of_channels, DimensionSize<Time> number_of_spectra)
46  : BaseT(number_of_channels, number_of_spectra)
47 {
48 }
49 
50 template<class Arch, typename NumericalT>
51 template<class OtherArch, typename OtherNumericalT>
53  : BaseT( pss::astrotypes::DimensionSize<Frequency>(ft.number_of_channels()), pss::astrotypes::DimensionSize<Time>(ft.number_of_spectra()))
54  , CommonBaseT(ft)
55 {
56  panda::copy(ft.begin(), ft.end(), this->begin());
57 }
58 
59 template <class Arch, typename NumericalT>
60 template<typename OtherNumericalT>
62  : BaseT(tf)
63  , CommonBaseT(tf)
64 {
65 }
66 
67 template <class Arch, typename NumericalT>
68 template<typename OtherArch, typename OtherNumericalT>
70  : BaseT(DimensionSize<Frequency>(tf.number_of_channels()), DimensionSize<Time>(tf.number_of_spectra()))
71  , CommonBaseT(tf)
72 {
74  panda::copy(ft_copy.begin(), ft_copy.end(), this->begin());
75 }
76 
77 template<class Arch, typename NumericalT>
78 void FrequencyTime<Arch, NumericalT>::set_channel(unsigned channel_number, DataType const& data)
79 {
80  Channel channel = this->channel(channel_number);
81  std::fill(channel.begin(), channel.end(), data);
82 }
83 
84 template<class Arch, typename NumericalT>
86 {
87  return static_cast<BaseT const&>(*this) == static_cast<BaseT const&>(o);
88 }
89 
90 template<typename T>
92 {
93 };
94 
95 template<typename T>
96 struct ExtractFrequencyTimeDataType<std::shared_ptr<T>>
97 {
98  typedef typename ExtractFrequencyTimeDataType<T>::type type;
99  inline static type& exctract(T& t) { return ExtractFrequencyTimeDataType<T>::extract(*t); }
100 };
101 
102 template<typename T>
103 struct ExtractFrequencyTimeDataType<std::unique_ptr<T>>
104 {
105  typedef typename ExtractFrequencyTimeDataType<T>::type type;
106  inline static type& exctract(T& t) { return ExtractFrequencyTimeDataType<T>::extract(*t); }
107 };
108 
109 template <class Arch, typename NumericalT>
111 {
113  inline static type& exctract(type& t) { return t; }
114 };
115 
116 } // namespace data
117 } // namespace cheetah
118 } // namespace ska
Implementation Helper class for the ExtractFrequencyTimeDataType - do not call directly.
bool operator==(FrequencyTime const &) const
return true if equivalent data
extract the FrequencyTime data type from compound types
NumericalT DataType
the underlying data storage type for the amplitude of the signal
Definition: FrequencyTime.h:98
Some limits and constants for FLDO.
Definition: Brdz.h:35
std::size_t number_of_channels() const
std::size_t number_of_spectra() const
void set_channel(unsigned channel_number, DataType const &value)
sets the value of the specified channel to the provided value across all time samples ...