Exemplo n.º 1
0
def test_failing_compile_practice_data():
    practice_path_7 = os.path.join(MOCK_DATA_DIR, 'practice', '7.csv')
    df = compile_data.get_csv_as_dataframe(practice_path_7)
    data = compile_data.compile_practice_data(df)
    assert data['id'] == 7
    assert data['passed_practice'] == False
    assert data['time_practice_ms'] == 334489
Exemplo n.º 2
0
def get_csv_as_df(stage, pid):
    """Take an experiment stage and participant ID and return a pandas
    data frame.
    """
    csv_path = os.path.join(MOCK_DATA_DIR, stage, '{}.csv'.format(pid))
    df = compile_data.get_csv_as_dataframe(csv_path)
    return df
Exemplo n.º 3
0
def test_passing_compile_practice_data():
    df = compile_data.get_csv_as_dataframe(PRACTICE_PATH_1)
    data = compile_data.compile_practice_data(df)
    assert data['id'] == 1
    assert data['passed_practice'] == True
    assert data['time_practice_blk1_ms'] == 33045
    assert data['time_practice_blk2_ms'] == 83144
    assert data['time_practice_ms'] == 151671
Exemplo n.º 4
0
def test_extract_sart_blocks_with_2_practice():
    # NOTE: tests out get_csv_as_dataframe() from compile_data
    csv_path = _csv_path('practice', '003')
    df = compile_data.get_csv_as_dataframe(csv_path)
    blocks = compile_data.extract_sart_blocks(df)
    assert len(blocks) == 2
    for b in blocks:
        assert isinstance(b, compile_data.pd.DataFrame)
    # number of trials
    assert len(blocks[0].index.values) == 5
    assert len(blocks[1].index.values) == 15