diff options
author | Josh Blum <josh@joshknows.com> | 2012-01-16 18:07:09 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-03-14 00:02:44 -0700 |
commit | 8a33423ad6877fdb2bc1bc50c6506cff4ce9c5aa (patch) | |
tree | c0aef50afc507333f80fe31e000fa6f3f980a4d3 /host/lib/usrp/common | |
parent | abab58f5404fcd769bf72fd0f486323659e9c087 (diff) | |
download | uhd-8a33423ad6877fdb2bc1bc50c6506cff4ce9c5aa.tar.gz uhd-8a33423ad6877fdb2bc1bc50c6506cff4ce9c5aa.tar.bz2 uhd-8a33423ad6877fdb2bc1bc50c6506cff4ce9c5aa.zip |
uhd: rev iq correction numbers format
Diffstat (limited to 'host/lib/usrp/common')
-rw-r--r-- | host/lib/usrp/common/apply_corrections.cpp | 49 |
1 files changed, 6 insertions, 43 deletions
diff --git a/host/lib/usrp/common/apply_corrections.cpp b/host/lib/usrp/common/apply_corrections.cpp index 6aee00753..b889266f2 100644 --- a/host/lib/usrp/common/apply_corrections.cpp +++ b/host/lib/usrp/common/apply_corrections.cpp @@ -54,7 +54,7 @@ static bool fe_cal_comp(fe_cal_t a, fe_cal_t b){ static uhd::dict<std::string, std::vector<fe_cal_t> > fe_cal_cache; -static std::complex<double> get_fe_dc_correction( +static std::complex<double> get_fe_correction( const std::string &key, const double lo_freq ){ const std::vector<fe_cal_t> &datas = fe_cal_cache[key]; @@ -81,36 +81,6 @@ static std::complex<double> get_fe_dc_correction( ); } -static std::complex<double> get_fe_iq_correction( - const std::string &key, const double lo_freq -){ - const std::vector<fe_cal_t> &datas = fe_cal_cache[key]; - if (datas.empty()) throw uhd::runtime_error("empty calibration table " + key); - - //search for lo freq - size_t lo_index = 0; - size_t hi_index = datas.size()-1; - for (size_t i = 0; i < datas.size(); i++){ - if (datas[i].lo_freq > lo_freq){ - hi_index = i; - break; - } - lo_index = i; - } - - if (lo_index == 0) return std::complex<double>(datas[lo_index].iq_corr_real, datas[lo_index].iq_corr_imag); - if (hi_index == lo_index) return std::complex<double>(datas[hi_index].iq_corr_real, datas[hi_index].iq_corr_imag); - - const std::complex<double> lo_val(datas[lo_index].iq_corr_real, datas[lo_index].iq_corr_imag); - const std::complex<double> hi_val(datas[hi_index].iq_corr_real, datas[hi_index].iq_corr_imag); - - //interpolation time - return std::polar<double>( - linear_interp(lo_freq, datas[lo_index].lo_freq, std::abs(lo_val), datas[hi_index].lo_freq, std::abs(hi_val)), - linear_interp(lo_freq, datas[lo_index].lo_freq, std::arg(lo_val), datas[hi_index].lo_freq, std::arg(hi_val)) - ); -} - static void apply_fe_corrections( uhd::property_tree::sptr sub_tree, const uhd::fs_path &db_path, @@ -155,15 +125,8 @@ static void apply_fe_corrections( } - if (file_prefix.find("dc_cal") != std::string::npos){ - sub_tree->access<std::complex<double> >(fe_path) - .set(get_fe_dc_correction(cal_data_path.string(), lo_freq)); - } - else if (file_prefix.find("iq_cal") != std::string::npos){ - sub_tree->access<std::complex<double> >(fe_path) - .set(get_fe_iq_correction(cal_data_path.string(), lo_freq)); - } - else throw uhd::runtime_error("could not determine interpolation function"); + sub_tree->access<std::complex<double> >(fe_path) + .set(get_fe_correction(cal_data_path.string(), lo_freq)); } /*********************************************************************** @@ -180,14 +143,14 @@ void uhd::usrp::apply_tx_fe_corrections( sub_tree, "dboards/" + slot + "/tx_eeprom", "tx_frontends/" + slot + "/iq_balance/value", - "tx_iq_cal_v0.1_", + "tx_iq_cal_v0.2_", lo_freq ); apply_fe_corrections( sub_tree, "dboards/" + slot + "/tx_eeprom", "tx_frontends/" + slot + "/dc_offset/value", - "tx_dc_cal_v0.1_", + "tx_dc_cal_v0.2_", lo_freq ); } @@ -207,7 +170,7 @@ void uhd::usrp::apply_rx_fe_corrections( sub_tree, "dboards/" + slot + "/rx_eeprom", "rx_frontends/" + slot + "/iq_balance/value", - "rx_iq_cal_v0.1_", + "rx_iq_cal_v0.2_", lo_freq ); } |