Changeset 116


Ignore:
Timestamp:
Sep 20, 2012, 11:25:37 PM (5 years ago)
Author:
jdbonior21
Message:

only minor changes for ease of reading

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • data_collection/finite_acquisition_experiments/finite_test_case.py

    r110 r116  
    1212usrp.set_clock_source("external", 1)
    1313usrp.set_time_source("external", 1)
    14 usrp.set_clock_source("external", 2)
    15 usrp.set_time_source("external", 2)
     14usrp.set_clock_source("mimo", 2)
     15usrp.set_time_source("mimo", 2)
    1616usrp.set_time_unknown_pps(uhd.time_spec())
    1717usrp.set_samp_rate(204918)
  • sensors/variance_based_detection/multitone_rework_v1.0.py

    r115 r116  
    2828MEM = 20
    2929MEM_MEAN = 150
    30 MEM_d = 2
    31 MULTI_LAYER = False
    32 ELLIPTICAL = False
     30MEM_d = 1
     31MULTI_LAYER = True
     32ELLIPTICAL = True
    3333DATA_RECORD = True
     34VAR_RECORD = False
    3435PATH = 'A'
    35 
    36 YYYYMMDD = date.today().strftime("%Y%m%d")
    37 try:
    38         os.makedirs(YYYYMMDD)
    39 except OSError:
    40         pass
     36TRIAL = 1
     37
     38if VAR_RECORD == True or DATA_RECORD == True:
     39        YYYYMMDD = date.today().strftime("%Y%m%d")
     40        try:
     41                os.makedirs(YYYYMMDD)
     42        except OSError:
     43                pass
    4144
    4245if DATA_RECORD == True:
    43         RAW_FILE = YYYYMMDD + '/raw_MEMd_%d_MULTI_%s_ELLIP_%s_PATH_%s.out' % (MEM_d, MULTI_LAYER, ELLIPTICAL, PATH)
    44         FILTERED_FILE = YYYYMMDD + '/filtered_MEMd_%d_MULTI_%s_ELLIP_%s_PATH_%s.out' % (MEM_d, MULTI_LAYER, ELLIPTICAL, PATH)
     46        RAW_FILE = YYYYMMDD + '/raw_MEMd_%d_MULTI_%s_ELLIP_%s_PATH_%s_TRIAL_%d.out' % (MEM_d, MULTI_LAYER, ELLIPTICAL, PATH, TRIAL)
     47        FILTERED_FILE = YYYYMMDD + '/filtered_MEMd_%d_MULTI_%s_ELLIP_%s_PATH_%s_TRIAL_%d.out' % (MEM_d, MULTI_LAYER, ELLIPTICAL, PATH, TRIAL)
     48
     49if VAR_RECORD == True:
     50        VAR_FILE = YYYYMMDD + '/var_PATH_%s_TRIAL_%d.out' % (PATH, TRIAL)
    4551
    4652if MULTI_LAYER == True:
     
    5561                         [0.25, 0.25, 0.25, 0.25],
    5662                         [0.25, 0.25, 0.25, 0.25]])
    57         THRESHOLD = 3e-10 #3e-6
     63        THRESHOLD = 4e-10 #3e-6
    5864else:
    5965        w = numpy.array([[1, 1, 1, 1],
     
    112118
    113119#-----------------Set up data output files----------------#
     120print "Preparing data output files...\n"
     121
    114122if DATA_RECORD == True:
    115         print "Preparing data output files...\n"
    116123        RAW_OUT = open(RAW_FILE, 'w')
    117124        FILTER_OUT = open(FILTERED_FILE, 'w')
    118         #RAW_DATA = open('ellipsoid/raw_data_20120717_trial_B.out', 'w')
    119         print "complete.\n"
     125
     126if VAR_RECORD == True:
     127        VAR_OUT = open(VAR_FILE, 'w')
     128
     129print "complete.\n"
    120130
    121131#-----------------Set up our USRP devices-----------------#
     
    220230                exec('var_%d_C = numpy.var(var_data_%d_C)/math.pow(mu_%d_C, 0)' % (addr, addr, addr))
    221231                exec('var_%d_D = numpy.var(var_data_%d_D)/math.pow(mu_%d_D, 0)' % (addr, addr, addr))
    222                
     232
    223233                exec('total_%d = (var_%d_A * w[%d][0] + var_%d_B * w[%d][1] + var_%d_C * w[%d][2] + var_%d_D * w[%d][3])' % (addr, addr, n, addr, n, addr, n, addr, n))
    224234                exec('if total_%d >= THRESHOLD:\n    temp_x = total_%d * LOCX[%d]\n    temp_y = total_%d * LOCY[%d]\nelse:\n    total_%d = 0\n    temp_x = 0\n    temp_y = 0' % (addr, addr, n, addr, n, addr))
     
    229239
    230240        b += 1
     241
     242        if VAR_RECORD == True:
     243                time = datetime.now()
     244                VAR_OUT.write('%f,     %f,     %f,      %f,' % (var_112_A, var_112_B, var_112_C, var_112_D))
     245                VAR_OUT.write('%f,     %f,     %f,      %f,' % (var_113_A, var_113_B, var_113_C, var_113_D))
     246                VAR_OUT.write('%f,     %f,     %f,      %f,' % (var_114_A, var_114_B, var_114_C, var_114_D))
     247                VAR_OUT.write('%f,     %f,     %f,      %f,' % (var_115_A, var_115_B, var_115_C, var_115_D))
     248                VAR_OUT.write('%f,     %f,     %f,      %f,' % (var_116_A, var_116_B, var_116_C, var_116_D))
     249                VAR_OUT.write('%f,     %f,     %f,      %f,' % (var_117_A, var_117_B, var_117_C, var_117_D))
     250                VAR_OUT.write('%f,     %f,     %f,      %f,' % (var_118_A, var_118_B, var_118_C, var_118_D))
     251                VAR_OUT.write('%f,     %f,     %f,      %f,' % (var_119_A, var_119_B, var_119_C, var_119_D))
     252                VAR_OUT.write('%f,     %f,     %f,      %f,' % (var_105_A, var_105_B, var_105_C, var_105_D))
     253                VAR_OUT.write('%f,     %f,     %f,      %f,     %d.%d\n' % (var_110_A, var_110_B, var_110_C, var_110_D, time.second, time.microsecond))
    231254
    232255        print total_112, total_113, total_114, total_115, total_116, total_117, total_118, total_119, total_105, total_110
Note: See TracChangeset for help on using the changeset viewer.