def main(): parser = OptionParser(conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") rx_top_block.add_options(parser) receive_path.add_options(parser, expert_grp) uhd_receiver.add_options(parser) (options, args) = parser.parse_args() if options.cfg is not None: (options,args) = parser.parse_args(files=[options.cfg]) print "Using configuration file %s" % ( options.cfg ) tb = rx_top_block(options) if options.dot_graph: # write a dot graph of the flowgraph to file dot_str = tb.dot_graph() file_str = os.path.expanduser('rx_ofdm.dot') dot_file = open(file_str,'w') dot_file.write(dot_str) dot_file.close() try: tb.run() except [[KeyboardInterrupt]]: pass
def main(): parser = OptionParser(conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") tx_top_block.add_options(parser) transmit_path.add_options(parser, expert_grp) uhd_transmitter.add_options(parser) (options, args) = parser.parse_args() if options.cfg is not None: (options, args) = parser.parse_args(files=[options.cfg]) print "Using configuration file %s" % (options.cfg) tb = tx_top_block(options) if options.dot_graph: # write a dot graph of the flowgraph to file dot_str = tb.dot_graph() file_str = os.path.expanduser('tx_ofdm.dot') dot_file = open(file_str, 'w') dot_file.write(dot_str) dot_file.close() try: tb.run() except [[KeyboardInterrupt]]: pass
def parse_args(self): opts, args = OptionParser.parse_args(self) new_opts = {} for k, v in opts.__dict__.items(): match = re.match('(.*)\[(.*)\]', k) if match: group = match.group(1) opt = match.group(2) if not new_opts.has_key(group): new_opts[group] = {} if not new_opts[group].has_key(opt): new_opts[group][opt] = {} new_opts[group][opt] = v else: new_opts[k] = v opts = optparse.Values() opts._update_loose(new_opts) return opts, args
def main(): logger = logging.getLogger("suw") logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) logger.addHandler(ch) parser = OptionParser(conflict_handler='resolve') expert_grp = parser.add_option_group('Expert') resource_manager.add_options(parser, expert_grp) parser.add_option( '-c', '--cfg', action='store', type='string', default=None, help='Specifiy configuration file, default: none', config='false', ) (options, args) = parser.parse_args() if options.cfg is not None: (options, args) = parser.parse_args(files=[options.cfg]) print 'Using configuration file %s' % options.cfg start_resource_manager(resource_manager, 'PA', options)
def main(): parser = OptionParser(conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") ofdm_mrrc_benchmark.add_options(parser, expert_grp) transmit_path.add_options(parser, expert_grp) receive_path.add_options(parser, expert_grp) fusb_options.add_options(expert_grp) parser.add_option("-c", "--cfg", action="store", type="string", default=None, help="Specifiy configuration file, default: none", config="false") (options, args) = parser.parse_args() if options.cfg is not None: (options, args) = parser.parse_args(files=[options.cfg]) print "Using configuration file %s" % (options.cfg) benchmark = ofdm_mrrc_benchmark(options) runtime = benchmark r = gr.enable_realtime_scheduling() if r != gr.RT_OK: print "Couldn't enable realtime scheduling" else: print "Enabled realtime scheduling" try: if options.dot_graph: string_benchmark = runtime.dot_graph() filetx = os.path.expanduser('benchmark_mrrc_ofdm.dot') dot_file = open(filetx, 'w') dot_file.write(string_benchmark) dot_file.close() runtime.run() #runtime.start() try: tx.txpath._control._id_source.ready() except: pass except KeyboardInterrupt: runtime.stop() runtime.wait() if options.measure: print "min", tx.m.get_min() print "max", tx.m.get_max() print "avg", tx.m.get_avg()
def main(): parser = OptionParser(conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") ofdm_tx.add_options(parser, expert_grp) transmit_path.add_options(parser, expert_grp) fusb_options.add_options(expert_grp) parser.add_option("-c", "--cfg", action="store", type="string", default=None, help="Specifiy configuration file, default: none", config="false") (options, args) = parser.parse_args() if options.cfg is not None: (options, args) = parser.parse_args(files=[options.cfg]) print "Using configuration file %s" % (options.cfg) tx = ofdm_tx(options) runtime = tx r = gr.enable_realtime_scheduling() if r != gr.RT_OK: print "Couldn't enable realtime scheduling" else: print "Enabled realtime scheduling" try: orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) string_tx = runtime.dot_graph() dot_file = open("text_tx.dot", 'w') dot_file.write(string_tx) dot_file.close() runtime.start() try: tx.txpath._control._id_source.ready() except: pass orb.run() except KeyboardInterrupt: runtime.stop() runtime.wait() if options.measure: print "min", tx.m.get_min() print "max", tx.m.get_max() print "avg", tx.m.get_avg()
def main(): parser = OptionParser(conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") ofdm_mrrc_benchmark.add_options(parser, expert_grp) transmit_path.add_options(parser, expert_grp) receive_path.add_options(parser, expert_grp) fusb_options.add_options(expert_grp) parser.add_option( "-c", "--cfg", action="store", type="string", default=None, help="Specifiy configuration file, default: none", config="false" ) (options, args) = parser.parse_args() if options.cfg is not None: (options,args) = parser.parse_args(files=[options.cfg]) print "Using configuration file %s" % ( options.cfg ) benchmark = ofdm_mrrc_benchmark(options) runtime = benchmark r = gr.enable_realtime_scheduling() if r != gr.RT_OK: print "Couldn't enable realtime scheduling" else: print "Enabled realtime scheduling" try: if options.dot_graph: string_benchmark = runtime.dot_graph() filetx = os.path.expanduser('benchmark_mrrc_ofdm.dot') dot_file = open(filetx,'w') dot_file.write(string_benchmark) dot_file.close() runtime.run() #runtime.start() try: tx.txpath._control._id_source.ready() except: pass except KeyboardInterrupt: runtime.stop() runtime.wait() if options.measure: print "min",tx.m.get_min() print "max",tx.m.get_max() print "avg",tx.m.get_avg()
def main(): parser = OptionParser(conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") ofdm_tx.add_options(parser, expert_grp) transmit_path.add_options(parser, expert_grp) fusb_options.add_options(expert_grp) parser.add_option( "-c", "--cfg", action="store", type="string", default=None, help="Specifiy configuration file, default: none", config="false" ) (options, args) = parser.parse_args() if options.cfg is not None: (options,args) = parser.parse_args(files=[options.cfg]) print "Using configuration file %s" % ( options.cfg ) tx = ofdm_tx(options) runtime = tx r = gr.enable_realtime_scheduling() if r != gr.RT_OK: print "Couldn't enable realtime scheduling" else: print "Enabled realtime scheduling" try: orb = CORBA.ORB_init(sys.argv,CORBA.ORB_ID) string_tx = runtime.dot_graph() dot_file = open("text_tx.dot",'w') dot_file.write(string_tx) dot_file.close() runtime.start() try: tx.txpath._control._id_source.ready() except: pass orb.run() except KeyboardInterrupt: runtime.stop() runtime.wait() if options.measure: print "min",tx.m.get_min() print "max",tx.m.get_max() print "avg",tx.m.get_avg()
def main(): logger = logging.getLogger("suw") logger.setLevel(logging.DEBUG) # logfilename = "suw_" + strftime("%Y%m%d%H%M%S",gmtime()) + ".log" # fh = logging.FileHandler(logfilename) # fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") # fh.setFormatter(formatter) # ch.setFormatter(formatter) # logger.addHandler(fh) logger.addHandler(ch) # logger.info("Log filename is %s" %(logfilename)) parser = OptionParser(conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") resource_manager.add_options(parser, expert_grp) parser.add_option("-c", "--cfg", action="store", type="string", default=None, help="Specifiy configuration file, default: none", config="false") (options, args) = parser.parse_args() if options.cfg is not None: (options, args) = parser.parse_args(files=[options.cfg]) print "Using configuration file %s" % (options.cfg) start_resource_manager(resource_manager, "PA", options)
def main(): logger = logging.getLogger("suw") logger.setLevel(logging.DEBUG) # logfilename = "suw_" + strftime("%Y%m%d%H%M%S",gmtime()) + ".log" # fh = logging.FileHandler(logfilename) # fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") # fh.setFormatter(formatter) # ch.setFormatter(formatter) # logger.addHandler(fh) logger.addHandler(ch) # logger.info("Log filename is %s" %(logfilename)) parser = OptionParser(conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") resource_manager.add_options(parser, expert_grp) parser.add_option( "-c", "--cfg", action="store", type="string", default=None, help="Specifiy configuration file, default: none", config="false", ) (options, args) = parser.parse_args() if options.cfg is not None: (options, args) = parser.parse_args(files=[options.cfg]) print "Using configuration file %s" % (options.cfg) start_resource_manager(resource_manager, "PA", options)
def __init__(self): return OptionParser.__init__(self, option_class=ListOption)
def add_option(self, *args, **kwargs): # if kwargs['action'] == 'store': # kwargs['action'] = 'callback' # kwargs['callback'] = Parser.parse_dict return OptionParser.add_option(self, *args, **kwargs)