Changeset 408

Show
Ignore:
Timestamp:
07/30/09 22:42:42 (15 years ago)
Author:
trnewman
Message:

Added exception so code defaults to random channel selection if cross import fails.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/cognitive_engines/DSA_CE/examples/gnuradio-examples/benchmark_dsa.py

    r407 r408  
    1414from receive_path import receive_path 
    1515 
    16 # import cross 
    17 from cross import * 
    18  
     16 
     17 
     18try: 
     19    from cross import * 
     20    cross_import = True 
     21except ImportError: 
     22    cross_import = False 
    1923 
    2024global sync_status,mode,ch,traffic_flag,n_rcvd, n_right 
     
    8286 
    8387                if cross == True: 
    84   
    8588                        if hop_freq == 462562500: 
    8689                                channel = 1 
     
    257260 
    258261        if options_rx.cross == True: 
    259                 print "[[ Using the CROSS DSA Cognitive Engine ]]\n" 
     262                if cross_import == False: 
     263                        print "\n\n[[ CROSS Import failed..  Defaulting to RANDOM channel selection ]]" 
     264                        print "[[ Using the RANDOM channel selection algorithm ]]\n\n" 
     265                        options_rx.cross = False 
     266                else: 
     267                        print "[[ Using the CROSS DSA Cognitive Engine ]]" 
    260268        else: 
    261                 print "[[ Using the RANDOM channel selection algorithm ]]\n" 
     269                print "[[ Using the RANDOM channel selection algorithm ]]\n\n" 
    262270                 
    263271        # build the graph 
     
    278286        hop_freq = options_tx.tx_freq #  = options_rx.rx_freq...same for tx and rx side 
    279287         
    280  
    281288        # Scan all channels first for inital data 
    282289        time.sleep(0.1)