def result_integrate_intra(time_now):
    training_type = 'intra'
    span = len(proportional_list)
    fold_path = root_path + '/result_test1/proportional_integrate'
    new_fold(fold_path) 
    feature_type = 'TD4'
    norm = '_norm'

    subject_list = ['subject_' + str(i) for i in range(1, 6)]

    res_all = []
    blank_line = ['' for i in range(len(channel_pos_list))]
    res_all.append(blank_line)

    for action in action_lists:
        for subject in subject_list:
            res = []
            index = 2
            
            res_ind = 1

            data = result_load('250_100',feature_type, subject, norm, action, training_type)
            title = feature_type+'_'+subject+'_action_1-'+str(action)
            res_head = [title]
            res_head.extend(proportional_list)
            res.append(res_head)
            
            for i in range(len(channel_pos_list)):
                res_intra = [channel_pos_list[i]]
                # print res_intra
                res_intra.extend(map(float,data[index:index+span,4][:]))
                index += span
                res.append(res_intra)

            res_np = np.array(res)
            res_aver = ['average']
            for i in range(len(proportional_list)):
                res_aver.append(np.mean(map(float,res_np[res_ind:,i+1])))
            res.append(res_aver)
            # file_path = fold_path + '/prop_'+training_type+'_'+title+'_'+str(time_now)
            # log_result(res, file_path, 2)

            res_all.extend(res)
            res_all.append(blank_line)
            res_all.append(blank_line)
            res_all.append(blank_line)
            res_all.append(blank_line)
            res_all.append(blank_line)

    file_path = fold_path + '/prop_'+training_type+'_all_'+str(time_now)
    log_result(res_all, file_path, 2)
Пример #2
0
def result_integrate_intra(time_now):
    training_type = 'intra'
    feature_type = 'TD4'
    norm = '_norm'
    channel_pos_list = [
        'S0',  # 中心位置
        'U1',
        'U2',
        'D1',
        'D2',
        'L1',
        'L2',
        'R1',
        'R2'
    ]  # 上 下 左 右

    # action = 7
    # subject='subject_1'
    action_lists = [7, 9, 11]
    subject_list = ['subject_' + str(i) for i in range(1, 6)]
    res_all = []
    blank_line = ['' for i in range(len(channel_pos_list) + 1)]
    for i in range(5):
        res_all.append(blank_line)

    fold_path = root_path + '/result/cca_analyse'
    new_fold(fold_path)

    for action in action_lists:
        for subject in subject_list:
            data = result_load('250_100', feature_type, subject, norm, action,
                               training_type)

            title = feature_type + '_' + subject + '_action_1-' + str(action)
            res = []
            res_head = [title]
            res_head.extend(channel_pos_list[1:])
            res_head.append('Average')
            res.append(res_head)

            index = 3
            span = len(channel_pos_list) - 1

            res_intra = ['intra']
            temp = map(float, data[index:index + span, 4][:])
            res_intra.extend(temp)
            res_intra.append(np.mean(temp))
            res.append(res_intra)

            index += span
            res_center = ['center']
            temp = map(float, data[index:index + span, 4][:])
            res_center.extend(temp)
            res_center.append(np.mean(temp))
            res.append(res_center)

            index += span
            res_group = ['group']
            temp = map(float, data[index:index + span, 4][:])
            res_group.extend(temp)
            res_group.append(np.mean(temp))
            res.append(res_group)

            for i in range(6):
                n_components = 6 + i * 2
                index += span
                res_CCA = ['CCA_' + str(n_components)]
                temp = map(float, data[index:index + span, 4][:])
                res_CCA.extend(temp)
                res_CCA.append(np.mean(temp))
                res.append(res_CCA)

            res_all.extend(res)
            for j in range(10):
                res_all.append(blank_line)

    file_path = fold_path + '/' + feature_type + '_' + training_type + '_' + time_now
    log_result(res_all, file_path, 2)
Пример #3
0
def result_integrate_intra(time_now):
    training_type = 'intra'
    feature_type = 'TD4'
    norm = '_norm'
    channel_pos_list = ['S0',                                             # 中心位置
                    'U1', 'U2', 'D1', 'D2', 'L1', 'L2', 'R1', 'R2']  # 上 下 左 右

    # action = 7
    # subject='subject_1'
    action_lists = [7, 9, 11]
    subject_list = ['subject_' + str(i) for i in range(1, 6)]
    res_all = []
    blank_line = ['' for i in range(len(channel_pos_list)+1)]
    for i in range(5):
        res_all.append(blank_line)

    
    fold_path = root_path + '/result/cca_analyse'
    new_fold(fold_path)
    
    for action in action_lists:
        for subject in subject_list:
            data = result_load('250_100',feature_type, subject, norm, action, training_type)
            
            title = feature_type+'_'+subject+'_action_1-'+str(action)
            res = []
            res_head = [title]
            res_head.extend(channel_pos_list[1:])
            res_head.append('Average')
            res.append(res_head)
            
            index = 3
            span = len(channel_pos_list)-1

            res_intra = ['intra']
            temp = map(float, data[index:index+span,4][:])
            res_intra.extend(temp)
            res_intra.append(np.mean(temp))
            res.append(res_intra)
            
            index += span
            res_center = ['center']
            temp = map(float, data[index:index+span,4][:])
            res_center.extend(temp)
            res_center.append(np.mean(temp))
            res.append(res_center)

            index += span
            res_group = ['group']
            temp = map(float, data[index:index+span,4][:])
            res_group.extend(temp)
            res_group.append(np.mean(temp))
            res.append(res_group)

            for i in range(6):
                n_components =  6+i*2
                index += span
                res_CCA = ['CCA_'+str(n_components)]
                temp = map(float, data[index:index+span,4][:])
                res_CCA.extend(temp)
                res_CCA.append(np.mean(temp))
                res.append(res_CCA)

            res_all.extend(res)
            for j in range(10):
                res_all.append(blank_line)

    file_path = fold_path + '/' + feature_type+'_'+training_type+'_'+time_now
    log_result(res_all, file_path, 2)