当前位置: 首页>>代码示例>>Python>>正文


Python DeviceManager.get_device_db方法代码示例

本文整理汇总了Python中artiq.master.worker_db.DeviceManager.get_device_db方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceManager.get_device_db方法的具体用法?Python DeviceManager.get_device_db怎么用?Python DeviceManager.get_device_db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在artiq.master.worker_db.DeviceManager的用法示例。


在下文中一共展示了DeviceManager.get_device_db方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from artiq.master.worker_db import DeviceManager [as 别名]
# 或者: from artiq.master.worker_db.DeviceManager import get_device_db [as 别名]
def main():
    args = get_argparser().parse_args()
    init_logger(args)

    if not args.print_decoded and args.write_vcd is None and args.write_dump is None:
        print("No action selected, use -p, -w and/or -d. See -h for help.")
        sys.exit(1)

    device_mgr = DeviceManager(DeviceDB(args.device_db))
    try:
        if args.read_dump:
            with open(args.read_dump, "rb") as f:
                dump = f.read()
        else:
            comm = device_mgr.get("comm")
            dump = comm.get_analyzer_dump()
        decoded_dump = decode_dump(dump)
        if args.print_decoded:
            print("Log channel:", decoded_dump.log_channel)
            print("DDS one-hot:", decoded_dump.dds_onehot_sel)
            for message in decoded_dump.messages:
                print(message)
        if args.write_vcd:
            with open(args.write_vcd, "w") as f:
                decoded_dump_to_vcd(f, device_mgr.get_device_db(), decoded_dump)
        if args.write_dump:
            with open(args.write_dump, "wb") as f:
                f.write(dump)
    finally:
        device_mgr.close_devices()
开发者ID:cjbe,项目名称:artiq,代码行数:32,代码来源:artiq_coreanalyzer.py

示例2: main

# 需要导入模块: from artiq.master.worker_db import DeviceManager [as 别名]
# 或者: from artiq.master.worker_db.DeviceManager import get_device_db [as 别名]
def main():
    args = get_argparser().parse_args()
    init_logger(args)

    if (not args.print_decoded
            and args.write_vcd is None and args.write_dump is None):
        print("No action selected, use -p, -w and/or -d. See -h for help.")
        sys.exit(1)

    device_mgr = DeviceManager(DeviceDB(args.device_db))
    if args.read_dump:
        with open(args.read_dump, "rb") as f:
            dump = f.read()
    else:
        core_addr = device_mgr.get_desc("core")["arguments"]["host"]
        dump = get_analyzer_dump(core_addr)
    decoded_dump = decode_dump(dump)
    if args.print_decoded:
        print("Log channel:", decoded_dump.log_channel)
        print("DDS one-hot:", decoded_dump.dds_onehot_sel)
        for message in decoded_dump.messages:
            print(message)
    if args.write_vcd:
        with open(args.write_vcd, "w") as f:
            decoded_dump_to_vcd(f, device_mgr.get_device_db(),
                                decoded_dump,
                                uniform_interval=args.vcd_uniform_interval)
    if args.write_dump:
        with open(args.write_dump, "wb") as f:
            f.write(dump)
开发者ID:m-labs,项目名称:artiq,代码行数:32,代码来源:artiq_coreanalyzer.py


注:本文中的artiq.master.worker_db.DeviceManager.get_device_db方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。