DP3
H5ParmFixture.h
Go to the documentation of this file.
1 // Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 
4 #ifndef DP3_STEPS_TEST_UNIT_H5PARMFIXTURE_H_
5 #define DP3_STEPS_TEST_UNIT_H5PARMFIXTURE_H_
6 
7 #include <filesystem>
8 
9 #include <schaapcommon/h5parm/h5parm.h>
10 
11 #include "tPredict.h"
12 
13 namespace dp3 {
14 namespace steps {
15 namespace test {
16 
18 struct H5ParmFixture {
20  schaapcommon::h5parm::H5Parm h5parm(kParmDb, true);
21  // "gain" must be accepted by JonesParameters::StringToCorrectType.
22  // "dir" is the name of a required h5parm axis.
23  auto soltab = h5parm.CreateSolTab(kSoltabName, "gain", {{"dir", 1}});
24  soltab.SetSources({'[' + kPredictDirection + ']'});
25  // Set a dummy value and weight.
26  soltab.SetValues({42.0}, {1.0}, "CREATE with H5ParmFixture");
27  }
28 
29  ~H5ParmFixture() { std::filesystem::remove(kParmDb); }
30 
31  const std::string kParmDb = "test_h5parmfixture.h5";
32  const std::string kSoltabName = "foobar42";
33 };
34 
35 } // namespace test
36 } // namespace steps
37 } // namespace dp3
38 
39 #endif
const std::string kPredictDirection
Definition: tPredict.h:19
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53
Creates a basic H5Parm file for testing H5ParmPredict.
Definition: H5ParmFixture.h:18
const std::string kSoltabName
Definition: H5ParmFixture.h:32
H5ParmFixture()
Definition: H5ParmFixture.h:19
const std::string kParmDb
Definition: H5ParmFixture.h:31
~H5ParmFixture()
Definition: H5ParmFixture.h:29