aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/include/uhd/cal/pwr_cal.hpp4
-rw-r--r--host/lib/cal/cal_python.hpp2
-rw-r--r--host/tests/cal_data_gain_pwr_test.cpp24
3 files changed, 27 insertions, 3 deletions
diff --git a/host/include/uhd/cal/pwr_cal.hpp b/host/include/uhd/cal/pwr_cal.hpp
index b30c6dfc2..58606abb8 100644
--- a/host/include/uhd/cal/pwr_cal.hpp
+++ b/host/include/uhd/cal/pwr_cal.hpp
@@ -53,8 +53,8 @@ public:
*
* \param gain_power_map A mapping gain -> power (dB -> dBm) for all
* measured gain points for this frequency.
- * \param max_power The maximum available power for this frequency.
* \param min_power The minimum available power for this frequency.
+ * \param max_power The maximum available power for this frequency.
* \param freq The frequency at which this power level was measured
* \param temperature The temperature at which this power level was measured,
* in Celsius. This parameter is optional, the return
@@ -62,8 +62,8 @@ public:
* is provided here.
*/
virtual void add_power_table(const std::map<double, double>& gain_power_map,
- const double max_power,
const double min_power,
+ const double max_power,
const double freq,
const boost::optional<int> temperature = boost::none) = 0;
diff --git a/host/lib/cal/cal_python.hpp b/host/lib/cal/cal_python.hpp
index 5de9e8288..bf1975416 100644
--- a/host/lib/cal/cal_python.hpp
+++ b/host/lib/cal/cal_python.hpp
@@ -117,8 +117,8 @@ void export_cal(py::module& m)
.def("add_power_table",
&pwr_cal::add_power_table,
py::arg("gain_power_map"),
- py::arg("max_power"),
py::arg("min_power"),
+ py::arg("max_power"),
py::arg("freq"),
py::arg("temperature") = boost::optional<int>())
.def("clear", &pwr_cal::clear)
diff --git a/host/tests/cal_data_gain_pwr_test.cpp b/host/tests/cal_data_gain_pwr_test.cpp
index e066a96f3..5dd3ad8a4 100644
--- a/host/tests/cal_data_gain_pwr_test.cpp
+++ b/host/tests/cal_data_gain_pwr_test.cpp
@@ -93,6 +93,30 @@ BOOST_AUTO_TEST_CASE(test_pwr_cal_api)
BOOST_CHECK_CLOSE(gain_power_data->get_gain(-19.0, ref_freq), 1/1.1, 1e-6);
}
+BOOST_AUTO_TEST_CASE(test_pwr_cal_api_irreg)
+{
+ const std::string name = "Mock Gain/Power Data";
+ const std::string serial = "ABC1234";
+ const uint64_t timestamp = 0x12340000;
+
+ auto gain_power_data = pwr_cal::make(name, serial, timestamp);
+ constexpr int ROOM_TEMP = 20;
+ gain_power_data->set_temperature(ROOM_TEMP);
+
+ constexpr double MIN_POWER = -40;
+ constexpr double MAX_POWER = -10;
+ // Write a table...
+ gain_power_data->add_power_table(
+ {{0.0, -30.0}, {10.0, -20.0}}, MIN_POWER, MAX_POWER, 1e9);
+ // Let's say power goes down 10 dB per octave
+ gain_power_data->add_power_table(
+ {{0.0, -40.0}, {10.0, -30.0}}, MIN_POWER, MAX_POWER, 2e9);
+ // Interpolated readback:
+ BOOST_CHECK_CLOSE(gain_power_data->get_power(5.0, 1.5e9), -30.0, 1e-6);
+ BOOST_CHECK_CLOSE(gain_power_data->get_gain(-30.0, 1.5e9), 5.0, 0.1);
+
+}
+
BOOST_AUTO_TEST_CASE(test_pwr_cal_serdes)
{
const std::string name = "Mock Gain/Power Data";