Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
PulsarInjectionConfigTest.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/generators/test/PulsarInjectionConfigTest.h"
25 #include "cheetah/generators/PulsarInjectionConfig.h"
26 #include "panda/test/gtest.h"
27 
28 namespace ska {
29 namespace cheetah {
30 namespace generators {
31 namespace test {
32 
33 
34 PulsarInjectionConfigTest::PulsarInjectionConfigTest()
35  : ::testing::Test()
36 {
37 }
38 
39 PulsarInjectionConfigTest::~PulsarInjectionConfigTest()
40 {
41 }
42 
43 void PulsarInjectionConfigTest::SetUp()
44 {
45 }
46 
47 void PulsarInjectionConfigTest::TearDown()
48 {
49 }
50 
51 TEST_F(PulsarInjectionConfigTest, test_simple_phase_model)
52 {
53  // test the sinple phase configuration propogates to the model
54  // we test this by ensuring the generated models generate different results
55  PulsarInjectionConfig config_a;
56  SimplePhaseModelConfig simple_config_a;
57  simple_config_a.coefficients( {1.0} );
58  config_a.set_phase_model(simple_config_a);
59  auto model_a = config_a.phase_model();
60 
61  PulsarInjectionConfig config_b;
62  SimplePhaseModelConfig simple_config_b;
63  simple_config_b.coefficients( {5.0, 3.0} );
64  config_b.set_phase_model(simple_config_b);
65  auto model_b = config_b.phase_model();
66 
67  utils::ModifiedJulianClock::time_point mjd = utils::ModifiedJulianClock::now();
68 
69  ASSERT_NE(model_a(mjd, 100 * boost::units::si::mega * boost::units::si::hertz),
70  model_b(mjd, 100 * boost::units::si::mega * boost::units::si::hertz) );
71 }
72 
73 TEST_F(PulsarInjectionConfigTest, test_tempo2_phase_model)
74 {
75  PulsarInjectionConfig config;
76  Tempo2PhaseModelConfig tempo2_config;
77  tempo2_config.filename(panda::test::test_file("tempo2_psr_a.pred"));
78  config.set_phase_model(tempo2_config);
79 
80  config.phase_model();
81 }
82 
83 } // namespace test
84 } // namespace generators
85 } // namespace cheetah
86 } // namespace ska
Some limits and constants for FLDO.
Definition: Brdz.h:35