Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
PwftTester.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/pwft/test_utils/PwftTester.h"
25 #include "cheetah/data/FrequencySeries.h"
26 #include "cheetah/data/PowerSeries.h"
27 #include "cheetah/utils/Architectures.h"
28 #include "cheetah/data/ComplexTypeTraits.h"
29 
30 #include <iostream>
31 #include <typeinfo>
32 
33 namespace ska {
34 namespace cheetah {
35 namespace pwft {
36 namespace test {
37 
38 template<typename ArchitectureTag, typename ArchitectureCapability>
39 PwftTesterTraits<ArchitectureTag,ArchitectureCapability>::PwftTesterTraits()
40  : _api(_config)
41 {
42 }
43 
44 template<typename ArchitectureTag, typename ArchitectureCapability>
45 pwft::Pwft& PwftTesterTraits<ArchitectureTag,ArchitectureCapability>::api()
46 {
47  return _api;
48 }
49 
50 
51 template <typename DeviceType, typename InputDataType, typename OutputDataType>
53 {
54  inline static void test_direct(DeviceType& device, pwft::Pwft& api)
55  {
56  InputDataType input(0.001 * data::hz);
57  input.resize(20);
58  OutputDataType output;
59  api.process_direct(device,input,output);
60  ASSERT_EQ(output.frequency_step(),input.frequency_step());
61  }
62 
63  inline static void test_nn(DeviceType& device, pwft::Pwft& api)
64  {
65  InputDataType input(0.002 * data::hz);
66  input.resize(20);
67  OutputDataType output;
68  api.process_nn(device,input,output);
69  ASSERT_EQ(output.frequency_step(),input.frequency_step());
70  }
71 };
72 
73 template <typename TestTraits>
76 {
77 }
78 
79 template <typename TestTraits>
81 {
82 }
83 
84 template<typename TestTraits>
86 {
87 
88 }
89 
90 template<typename TestTraits>
92 {
93 }
94 
95 ALGORITHM_TYPED_TEST_P(PwftTester, test_frequency_step_propagation)
96 {
97  TypeParam traits;
103 }
104 
105 // each test defined by ALGORITHM_TYPED_TEST_P must be added to the
106 // test register (each one as an element of the comma seperated list)
107 REGISTER_TYPED_TEST_CASE_P(PwftTester, test_frequency_step_propagation);
108 
109 } // namespace test
110 } // namespace pwft
111 } // namespace cheetah
112 } // namespace ska
Power Spectrum Fourier Transform version / Transform / Module.
Definition: Pwft.h:48
void process_direct(panda::PoolResource< Arch > &resource, data::FrequencySeries< Arch, typename data::ComplexTypeTraits< Arch, T >::type, InputAlloc >const &input, data::PowerSeries< Arch, T, OutputAlloc > &output, Args &&... args)
Form power spectrum using absolute squared.
Definition: Pwft.cpp:33
A container of Fourier series data.
A helper class to determine the type of complex data for different architectures. ...
Some limits and constants for FLDO.
Definition: Brdz.h:35
Class for power series (detected FrequencySeries).
Definition: PowerSeries.h:58
void process_nn(panda::PoolResource< Arch > &resource, data::FrequencySeries< Arch, typename data::ComplexTypeTraits< Arch, T >::type, InputAlloc >const &input, data::PowerSeries< Arch, T, OutputAlloc > &output, Args &&... args)
Form power spectrum using absolute squared with nearest neighbour comparison.
Definition: Pwft.cpp:43