Example #1
0
def test__get_correct_rts_blk4():
    pid = "104"
    sart_block = get_sart_trial_block(pid, 3)
    df = compile_data._add_anticipation_errors(sart_block)
    rts = compile_data._get_correct_rts(df)
    assert len(rts) == 49
    assert compile_data.np.mean(rts) == 353.36734693877548
Example #2
0
def test__get_correct_rts_blk1():
    pid = "104"
    sart_block = get_sart_trial_block(pid)
    df = compile_data._add_anticipation_errors(sart_block)
    rts = compile_data._get_correct_rts(df)
    assert len(rts) == 71
    assert compile_data.np.mean(rts) == 288.6056338028169
Example #3
0
def test__add_anticipation_errors_to_df():
    pid = "104"
    df = get_sart_trial_block(pid)
    df_anticip = compile_data._add_anticipation_errors(df)
    assert 'anticipate_error' in df_anticip
    anticipated = list(df_anticip.anticipate_error)
    assert anticipated.count(True) == 6
Example #4
0
def test__calculate_nogo_error_rt_avgs_011():
    pid = "011"
    df = get_sart_trial_block(pid)
    df = compile_data._add_anticipation_errors(df)
    df['nogo_error'] = compile_data._calculate_go_errors(df, 'no_go')
    assert list(df['nogo_error']).count(True) == 4

    adjacent_rts = compile_data._calculate_nogo_error_rt_avgs(df)
    assert adjacent_rts['prev4_avg'] == 381.444444444
    assert adjacent_rts['num_prev4_rts'] == 9
    assert adjacent_rts['next4_avg'] == 391.875
    assert adjacent_rts['num_next4_rts'] == 8
Example #5
0
def test__calculate_nogo_error_rt_avgs_104():
    pid = "104"
    df = get_sart_trial_block(pid)
    df = compile_data._add_anticipation_errors(df)
    df['nogo_error'] = compile_data._calculate_go_errors(df, 'no_go')
    assert list(df['nogo_error']).count(True) == 4

    adjacent_rts = compile_data._calculate_nogo_error_rt_avgs(df)
    assert adjacent_rts['prev4_avg'] == 254.4375
    assert adjacent_rts['num_prev4_rts'] == 16
    assert adjacent_rts['next4_avg'] == 224.1875
    assert adjacent_rts['num_next4_rts'] == 16
Example #6
0
def test___calculate_go_errors():
    pid = "104"
    df = get_sart_trial_block(pid)

    # check known values
    assert list(df.correct.values).count(False) == 5

    df = compile_data._add_anticipation_errors(df)

    # check known values
    assert list(df.anticipate_error.values).count(True) == 6
    assert list(df.correct.values).count(False) == 11

    go_errors = compile_data._calculate_go_errors(df, 'go')
    assert isinstance(go_errors, compile_data.pd.Series)
    assert list(go_errors).count(True) == 1
    nogo_errors = compile_data._calculate_go_errors(df, 'no_go')
    assert isinstance(nogo_errors, compile_data.pd.Series)
    assert list(nogo_errors).count(True) == 4