diff options
author | Lars Amsel <lars.amsel@ni.com> | 2021-06-04 08:27:50 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-06-10 12:01:53 -0500 |
commit | 2a575bf9b5a4942f60e979161764b9e942699e1e (patch) | |
tree | 2f0535625c30025559ebd7494a4b9e7122550a73 /tools | |
parent | e17916220cc955fa219ae37f607626ba88c4afe3 (diff) | |
download | uhd-2a575bf9b5a4942f60e979161764b9e942699e1e.tar.gz uhd-2a575bf9b5a4942f60e979161764b9e942699e1e.tar.bz2 uhd-2a575bf9b5a4942f60e979161764b9e942699e1e.zip |
uhd: Add support for the USRP X410
Co-authored-by: Lars Amsel <lars.amsel@ni.com>
Co-authored-by: Michael Auchter <michael.auchter@ni.com>
Co-authored-by: Martin Braun <martin.braun@ettus.com>
Co-authored-by: Paul Butler <paul.butler@ni.com>
Co-authored-by: Cristina Fuentes <cristina.fuentes-curiel@ni.com>
Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com>
Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Co-authored-by: Lane Kolbly <lane.kolbly@ni.com>
Co-authored-by: Max Köhler <max.koehler@ni.com>
Co-authored-by: Andrew Lynch <andrew.lynch@ni.com>
Co-authored-by: Grant Meyerhoff <grant.meyerhoff@ni.com>
Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
Co-authored-by: Thomas Vogel <thomas.vogel@ni.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/json_to_zbx_dsa_cal.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/json_to_zbx_dsa_cal.py b/tools/json_to_zbx_dsa_cal.py new file mode 100755 index 000000000..cc9bf265d --- /dev/null +++ b/tools/json_to_zbx_dsa_cal.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +# +# Copyright 2020 Ettus Research, a National Instruments Brand +# +# SPDX-License-Identifier: GPL-3.0-or-later +# + +import uhd +import json +import pathlib + +def convert(name): + print("Convert {} ... ".format(name), end='') + with open(name) as jsonfile: + data = json.load(jsonfile) + num_steps = len(data['freq_gain_dsa_map'][0]['gains'][0]['steps']) + metadata = data['metadata'] + if num_steps == 2: + cal = uhd.usrp.cal.ZbxTxDsaCal(metadata['name'], metadata.get('serial', ''), metadata['timestamp']) + elif num_steps == 3: + cal = uhd.usrp.cal.ZbxRxDsaCal(metadata['name'], metadata.get('serial', ''), metadata['timestamp']) + else: + raise ValueError("Invalid number of steps {}".format(num_steps)) + for band in data["freq_gain_dsa_map"]: + print(band['name'], end=',') + gain_indizes = [i['steps'] for i in band['gains']] + print(len(gain_indizes), end=' ') + cal.add_frequency_band(band['max_freq'], band['name'], gain_indizes) + + rc_file = pathlib.Path(name).stem + ".cal" + with open(rc_file, "wb") as f: + f.write(cal.serialize()) + print('Done') + + +if __name__ == "__main__": + for filename in pathlib.Path.cwd().glob('*.json'): + convert(filename) |