Пример #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
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
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
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
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
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
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
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
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
def test_load_asc_binoRemote500():
    pandas_dfs_from_asc(paths['binoRemote500'])