diff options
author | Samuel O'Brien <sam.obrien@ni.com> | 2020-08-06 14:05:36 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-10-28 15:25:48 -0500 |
commit | a5091cd52614e01e1a8acf0e77cf4185baa5dd3d (patch) | |
tree | 438027eedd6123950dc2ec43123807eef85a0165 /mpm/python/usrp_mpm/simulator/config.py | |
parent | a56f4f63e235c7511cccfc291d395481828703f5 (diff) | |
download | uhd-a5091cd52614e01e1a8acf0e77cf4185baa5dd3d.tar.gz uhd-a5091cd52614e01e1a8acf0e77cf4185baa5dd3d.tar.bz2 uhd-a5091cd52614e01e1a8acf0e77cf4185baa5dd3d.zip |
sim: Support Out of Tree Sources and Sinks
This commit adds the ability to specify a path to an arbitrary python
file in a simulator config file, which will be imported and used to
construct a SampleSink or SampleSource for use with data streaming.
Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
Diffstat (limited to 'mpm/python/usrp_mpm/simulator/config.py')
-rw-r--r-- | mpm/python/usrp_mpm/simulator/config.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mpm/python/usrp_mpm/simulator/config.py b/mpm/python/usrp_mpm/simulator/config.py index 6698f9fd0..d97a30266 100644 --- a/mpm/python/usrp_mpm/simulator/config.py +++ b/mpm/python/usrp_mpm/simulator/config.py @@ -11,7 +11,7 @@ it identifies itself as. """ import configparser -from .sample_source import sinks, sources, NullSamples +from .sample_source import sinks, sources, NullSamples, from_import_path from .hardware_presets import presets import numbers @@ -105,7 +105,12 @@ class Config: def _read_sample_section(section, lookup): args = dict(section) class_name = args.pop("class") - constructor = lookup[class_name] + constructor = None + if "import_path" in args: + import_path = args.pop("import_path") + constructor = from_import_path(class_name, import_path) + else: + constructor = lookup[class_name] def section_gen(): return constructor(**args) return section_gen |