예제 #1
0
def test_posneg_offset():
    # make sure that you can use a positive or a negative offset
    ds, es = pandas_dfs_from_asc(paths['mono250'])
    fixations = es.EFIX[3:-1]
    ext = extract_events(ds, fixations, duration=500, offset=-250, units=TIME_UNITS)
    ext = extract_events(ds, fixations, duration=500, offset=250, units=TIME_UNITS)
    assert(True)
예제 #2
0
파일: test_extract.py 프로젝트: beOn/cili
def test_extracted__bino250_cols():
    ds, es = pandas_dfs_from_asc(paths['bino250'])
    rs = es.ESACC[:-3]
    ext = extract_events(ds, rs, duration=40, offset=0, units=TIME_UNITS)
    test_cols = ['x_l', 'y_l', 'pup_l', 'x_r',
                 'y_r', 'pup_r', 'samp_warns', 'orig_idx']
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #3
0
def test_binoRemote250_cols():
    ds, es = pandas_dfs_from_asc(paths['binoRemote250'])
    test_cols = [
        'x_l', 'y_l', 'pup_l', 'x_r', 'y_r', 'pup_r', 'samp_warns', 'targ_x',
        'targ_y', 'targ_dist', 'remote_warns'
    ]
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #4
0
def test_esacc_fields():
    ds, es = pandas_dfs_from_asc(paths['binoRemote500'])
    test_fields = [
        'name', 'eye', 'last_onset', 'duration', 'x_start', 'y_start', 'x_end',
        'y_end', 'vis_angle', 'peak_velocity'
    ]
    assert_array_equal(es.ESACC.columns.values, test_fields)
예제 #5
0
def test_timeunit_extract_underbounds():
    ds, es = pandas_dfs_from_asc(paths['mono1000'])
    ext = extract_events(ds,
                         es.EFIX,
                         offset=-10000,
                         duration=3000,
                         units=TIME_UNITS)
예제 #6
0
def test_extracted_monoRemote500_cols():
    ds, es = pandas_dfs_from_asc(paths['monoRemote500'])
    rs = es.ESACC[:-3]
    ext = extract_events(ds, rs, duration=500, offset=0, units=TIME_UNITS)
    test_cols = ['x_l', 'y_l', 'pup_l', 'samp_warns', 'targ_x', 'targ_y', 'targ_dist',
        'remote_warns', 'orig_idx']
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #7
0
def test_extracted_bino1000_cols():
    ds, es = pandas_dfs_from_asc(paths['bino1000'])
    rs = es.ESACC[:-3]
    ext = extract_events(ds, rs, duration=500, offset=0, units=TIME_UNITS)
    test_cols = [
        'x_l', 'y_l', 'pup_l', 'x_r', 'y_r', 'pup_r', 'samp_warns', 'orig_idx'
    ]
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #8
0
파일: util.py 프로젝트: psysungeng/cili
def get_0_percentage(asc_path):
    from cili.util import pandas_dfs_from_asc
    import pandas as pd
    # grab the data
    ds, _ = pandas_dfs_from_asc(asc_path)
    p_fields = [f for f in ds.columns if f in PUP_FIELDS]
    if len(p_fields) == 0:
        return 1.  # if you can't find a pupil field, we'll call that "bad"
    return (float(len(ds[ds[p_fields[0]] == 0])) / float(len(ds)))
예제 #9
0
def test_extracted_monoRemote250_cols():
    ds, es = pandas_dfs_from_asc(paths['monoRemote250'])
    rs = es.EFIX[:-3]
    ext = extract_events(ds, rs, duration=500, offset=0, units=TIME_UNITS)
    test_cols = [
        'x_l', 'y_l', 'pup_l', 'samp_warns', 'targ_x', 'targ_y', 'targ_dist',
        'remote_warns', 'orig_idx'
    ]
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #10
0
파일: util.py 프로젝트: beOn/cili
def get_0_percentage(asc_path):
    from cili.util import pandas_dfs_from_asc
    import pandas as pd
    # grab the data
    ds, _ = pandas_dfs_from_asc(asc_path)
    p_fields = [f for f in ds.columns if f in PUP_FIELDS]
    if len(p_fields) == 0:
        return 1.  # if you can't find a pupil field, we'll call that "bad"
    return (float(len(ds[ds[p_fields[0]] == 0])) / float(len(ds)))
예제 #11
0
def test_borrowed_fields():
    ds, es = pandas_dfs_from_asc(paths['binoRemote500'])
    rs = es.ESACC[:-3]
    ext = extract_events(ds,
                         rs,
                         duration=500,
                         offset=0,
                         units=TIME_UNITS,
                         borrow_attributes=['peak_velocity'])
    assert_true('peak_velocity' in ext.columns)
예제 #12
0
def test_posneg_offset():
    # make sure that you can use a positive or a negative offset
    ds, es = pandas_dfs_from_asc(paths['mono250'])
    fixations = es.EFIX[3:-1]
    ext = extract_events(ds,
                         fixations,
                         duration=500,
                         offset=-250,
                         units=TIME_UNITS)
    ext = extract_events(ds,
                         fixations,
                         duration=500,
                         offset=250,
                         units=TIME_UNITS)
    assert (True)
예제 #13
0
def test_esacc_fields():
    ds, es = pandas_dfs_from_asc(paths["binoRemote500"])
    test_fields = [
        "name",
        "eye",
        "last_onset",
        "duration",
        "x_start",
        "y_start",
        "x_end",
        "y_end",
        "vis_angle",
        "peak_velocity",
    ]
    assert_array_equal(es.ESACC.columns.values, test_fields)
예제 #14
0
def test_binoRemote250_cols():
    ds, es = pandas_dfs_from_asc(paths["binoRemote250"])
    test_cols = [
        "x_l",
        "y_l",
        "pup_l",
        "x_r",
        "y_r",
        "pup_r",
        "samp_warns",
        "targ_x",
        "targ_y",
        "targ_dist",
        "remote_warns",
    ]
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #15
0
파일: util.py 프로젝트: psysungeng/cili
def load_eyelink_dataset(file_name):
    """ Parses eyelink data to return samples and events.

    For now, we can only parse events from .asc files. If you hand us a .txt,
    we'll parse out the samples, but not the events.

    Parameters
    ----------
    file_name (string)
        The .asc or .txt file you'd like to parse.

    Returns
    -------
    (Samples object, Events object (or None))
    """
    root, ext = os.path.splitext(file_name)
    if ext == '.asc':
        s, e = pandas_dfs_from_asc(file_name)
    elif ext in ['.txt']:
        s = load_tdf(file_name)
        e = None
    else:
        raise ValueError("only .asc and .txt files supported at the moment...")
    return s, e
예제 #16
0
파일: util.py 프로젝트: beOn/cili
def load_eyelink_dataset(file_name):
    """ Parses eyelink data to return samples and events.

    For now, we can only parse events from .asc files. If you hand us a .txt,
    we'll parse out the samples, but not the events.

    Parameters
    ----------
    file_name (string)
        The .asc or .txt file you'd like to parse.

    Returns
    -------
    (Samples object, Events object (or None))
    """
    root, ext = os.path.splitext(file_name)
    if ext == '.asc':
        s, e = pandas_dfs_from_asc(file_name)
    elif ext in ['.txt']:
        s = load_tdf(file_name)
        e = None
    else:
        raise ValueError("only .asc and .txt files supported at the moment...")
    return s, e
예제 #17
0
def test_eblink_fields():
    ds, es = pandas_dfs_from_asc(paths["binoRemote500"])
    test_fields = ["name", "eye", "last_onset", "duration"]
    assert_array_equal(es.EBLINK.columns.values, test_fields)
예제 #18
0
def test_efix_fields():
    ds, es = pandas_dfs_from_asc(paths["binoRemote500"])
    test_fields = ["name", "eye", "last_onset", "duration", "x_pos", "y_pos", "p_size"]
    assert_array_equal(es.EFIX.columns.values, test_fields)
예제 #19
0
def test_load_asc_binoRemote250():
    pandas_dfs_from_asc(paths['binoRemote250'])
예제 #20
0
def test_efix_fields():
    ds, es = pandas_dfs_from_asc(paths['binoRemote500'])
    test_fields = [
        'name', 'eye', 'last_onset', 'duration', 'x_pos', 'y_pos', 'p_size'
    ]
    assert_array_equal(es.EFIX.columns.values, test_fields)
예제 #21
0
def test_load_asc_monoRemote500():
    pandas_dfs_from_asc(paths["monoRemote500"])
예제 #22
0
def test_load_asc_binoRemote250():
    pandas_dfs_from_asc(paths["binoRemote250"])
예제 #23
0
def test_msg_fields():
    ds, es = pandas_dfs_from_asc(paths["binoRemote500"])
    test_fields = ["name", "label", "content"]
    assert_array_equal(es.MSG.columns.values, test_fields)
예제 #24
0
def test_msg_fields():
    ds, es = pandas_dfs_from_asc(paths['binoRemote500'])
    test_fields = ['name', 'label', 'content']
    assert_array_equal(es.MSG.columns.values, test_fields)
예제 #25
0
파일: test_util.py 프로젝트: beOn/cili
def test_binoRemote250_cols():
    ds, es = pandas_dfs_from_asc(paths['binoRemote250'])
    test_cols = ['x_l', 'y_l', 'pup_l', 'x_r', 'y_r', 'pup_r',
                 'samp_warns', 'targ_x', 'targ_y', 'targ_dist', 'remote_warns']
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #26
0
def test_timeunit_extract_samplecount_250():
    ds, es = pandas_dfs_from_asc(paths['mono250'])
    fixations = es.EFIX[:-2]
    sc_time_test(ds, fixations, 250, 400)
예제 #27
0
def test_bino1000_cols():
    ds, es = pandas_dfs_from_asc(paths['bino1000'])
    test_cols = ['x_l', 'y_l', 'pup_l', 'x_r', 'y_r', 'pup_r', 'samp_warns']
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #28
0
def test_load_asc_monoRemote500():
    pandas_dfs_from_asc(paths['monoRemote500'])
예제 #29
0
def test_load_asc_mono250():
    pandas_dfs_from_asc(paths['mono250'])
예제 #30
0
def test_start_fields():
    ds, es = pandas_dfs_from_asc(paths["binoRemote500"])
    test_fields = ["name", "eye", "types"]
    assert_array_equal(es.START.columns.values, test_fields)
예제 #31
0
def test_mono2000_idx():
    ds, es = pandas_dfs_from_asc(paths['mono2000'])
    diffs = np.diff(ds.index)
    diffs = np.unique(diffs[diffs < 100])
    assert_equal(diffs, 4)
예제 #32
0
def test_eblink_fields():
    ds, es = pandas_dfs_from_asc(paths['binoRemote500'])
    test_fields = ['name', 'eye', 'last_onset', 'duration']
    assert_array_equal(es.EBLINK.columns.values, test_fields)
예제 #33
0
def test_start_fields():
    ds, es = pandas_dfs_from_asc(paths['binoRemote500'])
    test_fields = ['name', 'eye', 'types']
    assert_array_equal(es.START.columns.values, test_fields)
예제 #34
0
def test_load_asc_bino1000():
    pandas_dfs_from_asc(paths["bino1000"])
예제 #35
0
def test_timeunit_extract_samplecount_1000():
    ds, es = pandas_dfs_from_asc(paths['mono1000'])
    fixations = es.EFIX[:-1]
    sc_time_test(ds, fixations, 1000, 500)
    sc_time_test(ds, fixations, 1000, 1000)
예제 #36
0
def test_load_asc_mono250():
    pandas_dfs_from_asc(paths["mono250"])
예제 #37
0
파일: test_util.py 프로젝트: beOn/cili
def test_load_asc_monoRemote250():
    pandas_dfs_from_asc(paths['monoRemote250'])
예제 #38
0
def test_bino1000_cols():
    ds, es = pandas_dfs_from_asc(paths["bino1000"])
    test_cols = ["x_l", "y_l", "pup_l", "x_r", "y_r", "pup_r", "samp_warns"]
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #39
0
def test_end_fields():
    ds, es = pandas_dfs_from_asc(paths['binoRemote500'])
    test_fields = ['name', 'types', 'x_res', 'y_res']
    assert_array_equal(es.END.columns.values, test_fields)
예제 #40
0
def test_negative_duration():
    ds, es = pandas_dfs_from_asc(paths['mono250'])
    fixations = es.EFIX[:-1]
    ext = extract_events(ds, fixations, duration=-1000, units=TIME_UNITS)
예제 #41
0
def test_load_asc_bino1000():
    pandas_dfs_from_asc(paths['bino1000'])
예제 #42
0
파일: test_util.py 프로젝트: beOn/cili
def test_bino1000_cols():
    ds, es = pandas_dfs_from_asc(paths['bino1000'])
    test_cols = ['x_l', 'y_l', 'pup_l', 'x_r', 'y_r', 'pup_r', 'samp_warns']
    assert_array_equal(test_cols, ds.columns.tolist())
예제 #43
0
def test_borrowed_fields():
    ds, es = pandas_dfs_from_asc(paths['binoRemote500'])
    rs = es.ESACC[:-3]
    ext = extract_events(ds, rs, duration=500, offset=0, units=TIME_UNITS,
        borrow_attributes=['peak_velocity'])
    assert_true('peak_velocity' in ext.columns)
예제 #44
0
def test_sampleunit_extract_samplecount_2000():
    ds, es = pandas_dfs_from_asc(paths['mono2000'])
    fixations = es.EFIX[:-1]
    sc_samp_test(ds, fixations, 350)
    sc_samp_test(ds, fixations, 700)
예제 #45
0
def test_negative_duration():
    ds, es = pandas_dfs_from_asc(paths['mono250'])
    fixations = es.EFIX[:-1]
    ext = extract_events(ds, fixations, duration=-1000, units=TIME_UNITS)
예제 #46
0
def test_sampleunit_extract_samplecount_2000():
    ds, es = pandas_dfs_from_asc(paths['mono2000'])
    fixations = es.EFIX[:-1]
    sc_samp_test(ds, fixations, 350)
    sc_samp_test(ds, fixations, 700)
예제 #47
0
파일: test_util.py 프로젝트: beOn/cili
def test_load_asc_mono2000():
    pandas_dfs_from_asc(paths['mono2000'])
예제 #48
0
def test_mono2000_idx():
    ds, es = pandas_dfs_from_asc(paths["mono2000"])
    diffs = np.diff(ds.index)
    diffs = np.unique(diffs[diffs < 100])
    assert_equal(diffs, 4)
예제 #49
0
def test_event_types():
    # make sure the full list of events is there
    ds, es = pandas_dfs_from_asc(paths['binoRemote500'])
    test_evs = ['END', 'EFIX', 'EBLINK', 'START', 'ESACC', 'MSG']
    assert_array_equal(list(es.dframes.keys()), test_evs)
예제 #50
0
def test_timeunit_extract_samplecount_1000():
    ds, es = pandas_dfs_from_asc(paths['mono1000'])
    fixations = es.EFIX[:-1]
    sc_time_test(ds, fixations, 1000, 500)
    sc_time_test(ds, fixations, 1000, 1000)
예제 #51
0
파일: test_util.py 프로젝트: beOn/cili
def test_load_asc_bino250():
    pandas_dfs_from_asc(paths['bino250'])
예제 #52
0
def test_timeunit_extract_overbounds():
    ds, es = pandas_dfs_from_asc(paths['mono1000'])
    ext = extract_events(ds, es.EFIX, duration=3000, units=TIME_UNITS)
예제 #53
0
def test_end_fields():
    ds, es = pandas_dfs_from_asc(paths["binoRemote500"])
    test_fields = ["name", "types", "x_res", "y_res"]
    assert_array_equal(es.END.columns.values, test_fields)
예제 #54
0
def test_event_types():
    # make sure the full list of events is there
    ds, es = pandas_dfs_from_asc(paths["binoRemote500"])
    test_evs = ["END", "EFIX", "EBLINK", "START", "ESACC", "MSG"]
    assert_array_equal(es.dframes.keys(), test_evs)
예제 #55
0
파일: test_util.py 프로젝트: beOn/cili
def test_load_asc_binoRemote500():
    pandas_dfs_from_asc(paths['binoRemote500'])