Beispiel #1
0
import analysis_utils as a

if __name__ == "__main__":

    path_to_files = '/Volumes/Plata1/Shared/Ariel/fiorentini_data/'
    file_name = sys.argv[1]
    p, l, data_rec = a.get_data('%s/%s' % (path_to_files, file_name))
    fix_idx = np.where(data_rec['task'] == 'fixation')

    per_idx = np.where(data_rec['task'] == 'periphery')
    fix_idx = np.where(data_rec['task'] == 'fixation')
    c = data_rec['correct']
    amp = data_rec['contrast']

    th_per = a.analyze(amp[per_idx], c[per_idx])
    th_fix = a.analyze(amp[fix_idx], c[fix_idx])

    x, y = th_per[4], th_per[5]
    fig = plt.figure()
    ax = fig.add_subplot(1, 2, 1)
    ax.plot(x, y, 'o')
    x_for_plot = np.linspace(np.min(x), np.max(x), 100)

    ax.plot(x_for_plot, a.weibull(x_for_plot, th_per[0], th_per[3]))

    fig.suptitle('Periphery task:thresh=%1.2f, slope=%1.2f' %
                 (th_per[0], th_per[3]))

    staircase = amp[per_idx]
            correct_this_block = correct_this_run[block_type == i]
            if i == 'A':
                if p['task'] == ' Annulus ':
                    contrast_this_block = contrast_this_block - p[' annulus_contrast']
                for n in range(trials_per_condition):
                    contrast_A[n+(trials_per_condition*file_idx)] *= contrast_this_block[n]
                    correct_A[n+(trials_per_condition*file_idx)] *= correct_this_block[n]
                #print contrast_this_block, correct_this_block
                block_file_stem = file_stem + '_' + labelit[idx_block]
                fig_name_A = 'data/analyzed_data/%s.png'%(block_file_stem)
        else:
                contrast_this_block = contrast_this_block[p[' trials_per_dummy']:]
                correct_this_block = correct_this_block[p[' trials_per_dummy']:]
                for n in range(trials_per_condition):
                    contrast_B[n+(trials_per_condition*file_idx)] *= contrast_this_block[n]
                    correct_B[n+(trials_per_condition*file_idx)] *= correct_this_block[n]
                block_file_stem = file_stem + '_' + labelit[idx_block]
                fig_name_B = 'data/analyzed_data/%s.png'%(block_file_stem)
            #fig_name = 'data/analyzed_data/%s.png'%(file_stem)

    th,lower,upper = ana.analyze(contrast_A, correct_A, guess, flake, slope, fig_name_A)
    print "Threshold estimate: %s, CI: [%s,%s]"%(th, lower, upper)
    th,lower,upper = ana.analyze(contrast_B, correct_B, guess, flake, slope, fig_name_B)
    print "Threshold estimate: %s, CI: [%s,%s]"%(th, lower, upper)





 
        correct_this_run = data_rec['correct']
        block_type = data_rec['block_type']
        print p[' trials_per_dummy']
        for n in range(trials_per_condition):
            if n >= p[' trials_per_dummy']:
                contrast[n+(trials_per_condition*file_idx)] *= contrast_this_run[n]
                correct[n+(trials_per_condition*file_idx)] *= correct_this_run[n]
        if not os.path.exists('data/analyzed_data'):
            os.mkdir('data/analyzed_data')
        labelit = ['annulus_on','annulus_off']
        for idx_block,i in enumerate(['A','B']):
            contrast_this_block = contrast_this_run[block_type == i]
            correct_this_block = correct_this_run[block_type == i]
            if i == 'A':
                if p['task'] == ' Annulus ':
                    contrast_this_block = contrast_this_block - p[' annulus_contrast']
            else:
                print i
                contrast_this_block = contrast_this_block[p[' trials_per_dummy']:]
                correct_this_block = correct_this_block[p[' trials_per_dummy']:]
            block_file_stem = file_stem + '_' + labelit[idx_block]
            fig_name = 'data/analyzed_data/%s.png'%(block_file_stem)
            th,lower,upper = ana.analyze(contrast_this_block, correct_this_block, guess, flake, slope, fig_name)


            print "Threshold estimate: %s, CI: [%s,%s]"%(th, lower, upper)



 
Beispiel #4
0
import analysis_utils as a

if __name__ == "__main__":

    path_to_files = "/Volumes/Plata1/Shared/Ariel/fiorentini_data/"
    file_name = sys.argv[1]
    p, l, data_rec = a.get_data("%s/%s" % (path_to_files, file_name))
    fix_idx = np.where(data_rec["task"] == "fixation")

    per_idx = np.where(data_rec["task"] == "periphery")
    fix_idx = np.where(data_rec["task"] == "fixation")
    c = data_rec["correct"]
    amp = data_rec["contrast"]

    th_per = a.analyze(amp[per_idx], c[per_idx])
    th_fix = a.analyze(amp[fix_idx], c[fix_idx])

    x, y = th_per[4], th_per[5]
    fig = plt.figure()
    ax = fig.add_subplot(1, 2, 1)
    ax.plot(x, y, "o")
    x_for_plot = np.linspace(np.min(x), np.max(x), 100)

    ax.plot(x_for_plot, a.weibull(x_for_plot, th_per[0], th_per[3]))

    fig.suptitle("Periphery task:thresh=%1.2f, slope=%1.2f" % (th_per[0], th_per[3]))

    staircase = amp[per_idx]

    ax = fig.add_subplot(1, 2, 2)