Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
RfimTester.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_RFIM_TEST_RFIMTESTER_H
25 #define SKA_CHEETAH_RFIM_TEST_RFIMTESTER_H
26 
27 #include "cheetah/utils/test_utils/AlgorithmTester.h"
28 #include "cheetah/rfim/Rfim.h"
29 #include "cheetah/rfim/Metrics.h"
30 #include "cheetah/rfim/policy/FlagPolicy.h"
31 #include <gtest/gtest.h>
32 
33 namespace ska {
34 namespace cheetah {
35 namespace rfim {
36 namespace test {
37 
115 template<class TestTypeTraits, class Scenario>
117 {
118  static
119  void evaluate(rfim::Metrics const& m) {
120  EXPECT_LT(m.false_positives_percentage(), 15);
121  EXPECT_LT(m.false_negatives_percentage(), 25);
122  }
123 };
124 
125 template<typename NumericalT, typename ArchitectureTag, typename ArchitectureCapability=ArchitectureTag>
126 struct RfimTesterTraits : public utils::test::AlgorithmTesterTraits<ArchitectureTag, ArchitectureCapability> {
128  typedef typename BaseT::DeviceType DeviceType;
131  typedef typename std::shared_ptr<FlaggedDataType> ResultType;
133 
134  static ResultType apply_algorithm(DeviceType&, DataType);
135 };
136 
137 
138 template <typename TestTraits>
140 {
141  protected:
142  TestTraits _traits;
143 
144  void SetUp() override;
145  void TearDown() override;
146 
147  public:
148  RfimTester();
149  ~RfimTester();
150 
151  static void verify_equal(typename TestTraits::DataType const& , typename TestTraits::DataType const&);
152 };
153 
154 TYPED_TEST_CASE_P(RfimTester);
155 
156 } // namespace test
157 } // namespace rfim
158 } // namespace cheetah
159 } // namespace ska
160 #include "cheetah/rfim/test_utils/detail/RfimTester.cpp"
161 
162 
163 #endif // SKA_CHEETAH_RFIM_TEST_RFIMTESTER_H
TimeFrequency data with flags representing rfim detection.
Some limits and constants for FLDO.
Definition: Brdz.h:35
describes the algorithm to be tested to the AlgorithmTester
A class for analysing and storing the results of the difference between two sets of flags representin...
Definition: Metrics.h:39
Base class for generic algortihm tests that require an accelerator device.
Specialise to set non-standard pass/fail criteria.
Definition: RfimTester.h:116