Ejemplo n.º 1
0
def PCER_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved, retrieval_latency) = reward_retrieval(timecode, eventcode)
    cue_iti_responding(timecode, eventcode, 'StartTrial', 'EndTrial', 'PokeOn1')
    (ind_dur, tot_dur, ind_dur_iti, tot_dur_iti) = cue_responding_duration(timecode, eventcode, 'StartTrial',
                                                                           'EndTrial', 'PokeOn1', 'PokeOff1')
    total_pokes = total_head_pokes(eventcode)
    (all_cue_length_poke_rates, all_iti_length_poke_rates, subtracted_poke_rates) = \
        response_rate_across_cue_iti(timecode, eventcode, 'StartTrial', 'EndTrial', 'PokeOn1')
    new_cols = ['Subject'] + ['Cue_' + str(i + 1) for i in range(len(all_cue_length_poke_rates))] + \
               ['ITI_' + str(i + 1) for i in range(len(all_cue_length_poke_rates))] + \
               ['ES_' + str(i + 1) for i in range(len(all_cue_length_poke_rates))]
    across_cue_df = pd.DataFrame([([loaded_file['Subject']]+all_cue_length_poke_rates+all_iti_length_poke_rates+subtracted_poke_rates)],
                                 columns=new_cols)

    df2 = pd.DataFrame([[loaded_file['Subject'], int(i + 1), float(dippers), float(dippers_retrieved),
                         float(retrieval_latency), float(ind_dur), float(tot_dur), float(total_pokes)]],
                       columns=column_list)
    df2 = pd.merge(df2, across_cue_df, how='left', on=['Subject'])

    return df2
def CI_training_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved,
     retrieval_latency) = reward_retrieval(timecode, eventcode)
    (A_responding, A_iti) = cue_iti_responding(timecode, eventcode,
                                               'ExcitorATrialStart',
                                               'ExcitorATrialEnd', 'PokeOn1')
    (B_responding, B_iti) = cue_iti_responding(timecode, eventcode,
                                               'ExcitorBTrialStart',
                                               'ExcitorBTrialEnd', 'PokeOn1')

    df2 = pd.DataFrame([[
        loaded_file['Subject'], loaded_file['MSN'],
        int(i + 1),
        float(A_responding),
        float(A_iti),
        float(B_responding),
        float(B_iti),
        float(dippers),
        float(dippers_retrieved),
        float(retrieval_latency)
    ]],
                       columns=column_list)

    return df2
def crf_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved,
     retrieval_latency) = reward_retrieval(timecode, eventcode)
    (left_presses, right_presses,
     total_presses) = lever_pressing(eventcode, 'LPressOn', 'RPressOn')

    df2 = pd.DataFrame([[
        str(loaded_file['Subject'][1:]),
        int(i + 1),
        float(dippers),
        float(dippers_retrieved),
        float(retrieval_latency),
        float(left_presses),
        float(right_presses),
        float(total_presses)
    ]],
                       columns=column_list)

    return df2
def PIT_test_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (csplus_presses, csmin_presses,
     total_presses) = lever_pressing(eventcode, 'ActivePress', 'InactivePress')

    file_keys = list(loaded_file.keys())
    for constant in [
            'File', 'Start Date', 'End Date', 'Subject', 'Experiment', 'Group',
            'Box', 'Start Time', 'End Time', 'MSN', 'W'
    ]:
        file_keys.remove(constant)

    # All that's left in the list file_keys should be any group labels.
    group_ids = []
    for group in file_keys:
        group_ids.append(loaded_file[group])

    df2 = pd.DataFrame([[
        loaded_file['Subject'],
        int(i + 1),
        float(csplus_presses),
        float(csmin_presses), *group_ids
    ]],
                       columns=column_list + file_keys)
    return df2
def LI_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """

    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (A_dur_individual, A_dur_total, AITI_dur_individual,
     AITI_dur_total) = cue_responding_duration(timecode, eventcode,
                                               'ExcitorATrialStart',
                                               'ExcitorATrialEnd', 'PokeOn1',
                                               'PokeOff1')
    (B_dur_individual, B_dur_total, BITI_dur_individual,
     BITI_dur_total) = cue_responding_duration(timecode, eventcode,
                                               'ExcitorBTrialStart',
                                               'ExcitorBTrialEnd', 'PokeOn1',
                                               'PokeOff1')

    df2 = pd.DataFrame([[
        loaded_file['Subject'], loaded_file['MSN'],
        int(i + 1),
        float(A_dur_total),
        float(AITI_dur_total), (float(A_dur_total) - float(AITI_dur_total)),
        float(B_dur_total),
        float(BITI_dur_total), (float(B_dur_total) - float(BITI_dur_total))
    ]],
                       columns=column_list)

    return df2
def pavCA(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved, retrieval_latency) = reward_retrieval(timecode, eventcode)
    if loaded_file['MSN'] == 'PavCA_LeftUnpaired_2020' or loaded_file['MSN'] == 'PavCA_RightUnpaired_2020':
        (inactive_poke, inactive_iti_poke, trials_w_poke) = cue_iti_responding_PavCA(timecode, eventcode, 'NoRewardTrialStart', 'NoRewardTrialEnd', 'PokeOn1')
        (inactive_press, inactive_iti_press, trials_w_press) = cue_iti_responding_PavCA(timecode, eventcode, 'NoRewardTrialStart', 'NoRewardTrialEnd', 'InactivePress')
        poke_lat = lever_press_latency_PavCA(timecode, eventcode, 'NoRewardTrialStart', 'PokeOn1', 10)
        press_lat = lever_press_latency_PavCA(timecode, eventcode, 'NoRewardTrialStart', 'InactivePress', 10)
        poke = inactive_poke
        press = inactive_press
        prob_poke = trials_w_poke / 35
        prob_press = trials_w_press / 35
        iti_poke = inactive_iti_poke
    elif loaded_file['MSN'] == 'PavCA_LeftPaired_2020' or loaded_file['MSN'] == 'PavCA_RightPaired_2020':
        (active_poke, active_iti_poke, trials_w_poke) = cue_iti_responding_PavCA(timecode, eventcode, 'RewardTrialStart', 'RewardTrialEnd', 'PokeOn1')
        (active_press, active_iti_press, trials_w_press) = cue_iti_responding_PavCA(timecode, eventcode, 'RewardTrialStart', 'RewardTrialEnd', 'ActivePress')
        poke_lat = lever_press_latency_PavCA(timecode, eventcode, 'RewardTrialStart', 'PokeOn1', 10)
        press_lat = lever_press_latency_PavCA(timecode, eventcode, 'RewardTrialStart', 'ActivePress', 10)
        poke = active_poke
        press = active_press
        prob_poke = trials_w_poke / 35
        prob_press = trials_w_press / 35
        iti_poke = active_iti_poke
    df2 = pd.DataFrame([[loaded_file['Subject'], int(i + 1), float(dippers), float(iti_poke), float(poke),
                         float(press), float(prob_poke), float(prob_press), float(poke_lat), float(press_lat)]],
                       columns=column_list)

    return df2
def trough_train_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved, retrieval_latency) = reward_retrieval(timecode, eventcode)
    (ind_dur, tot_dur, ind_dur_iti, tot_dur_iti) = cue_responding_duration(timecode, eventcode, 'StartSession', 'EndSession', "PokeOn1", "PokeOff1")
    # ITI is meaningless here because we are using the whole session
    total_pokes = total_head_pokes(eventcode)

    file_keys = list(loaded_file.keys())
    for constant in ['File', 'Start Date', 'End Date', 'Subject', 'Experiment', 'Group', 'Box', 'Start Time', 'End Time', 'MSN', 'W']:
        file_keys.remove(constant)

    # All that's left in the list file_keys should be any group labels. 
    group_ids = []
    for group in file_keys:
        group_ids.append(loaded_file[group])

    df2 = pd.DataFrame([[loaded_file['Subject'], int(i + 1), float(dippers), float(dippers_retrieved),
                         float(retrieval_latency), float(ind_dur), float(tot_dur), float(total_pokes), *group_ids]],
                       columns=column_list+file_keys)

    return df2
Ejemplo n.º 8
0
def RVI_Go_NoGo_P1(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (small_go_trials, large_go_trials, small_go_success,
     large_go_success) = (eventcode.count('GoTrialBegSmallReward'),
                          eventcode.count('GoTrialBegLargeReward'),
                          eventcode.count('GoTrialSuccessSmallReward'),
                          eventcode.count('GoTrialSuccessLargeReward'))
    small_go_latency = lever_press_latency(timecode, eventcode,
                                           'GoTrialBegSmallReward',
                                           'GoTrialSuccessSmallReward')
    large_go_latency = lever_press_latency(timecode, eventcode,
                                           'GoTrialBegLargeReward',
                                           'GoTrialSuccessLargeReward')

    df2 = pd.DataFrame([[
        loaded_file['Subject'],
        int(i + 1),
        float(small_go_trials),
        float(large_go_trials),
        float(small_go_success),
        float(large_go_success),
        float(small_go_latency),
        float(large_go_latency)
    ]],
                       columns=column_list)

    return df2
def Go_NoGo(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved, retrieval_latency) = reward_retrieval(timecode, eventcode)
    (go_trials, nogo_trials) = count_go_nogo_trials(eventcode)
    (successful_go_trials, successful_nogo_trials) = num_successful_go_nogo_trials(eventcode)
    go_latency = lever_press_lat_gng(timecode, eventcode, 'LLeverOn', 'SuccessfulGoTrial') + \
                 lever_press_lat_gng(timecode, eventcode, 'RLeverOn', 'SuccessfulGoTrial')

    file_keys = list(loaded_file.keys())
    for constant in ['File', 'Start Date', 'End Date', 'Subject', 'Experiment', 'Group', 'Box', 'Start Time', 'End Time', 'MSN', 'W']:
        file_keys.remove(constant)

    # All that's left in the list file_keys should be any group labels. 
    group_ids = []
    for group in file_keys:
        group_ids.append(loaded_file[group])

    df2 = pd.DataFrame([[loaded_file['Subject'], int(i + 1), float(dippers),
                         float(successful_go_trials) / float(go_trials),
                         (float(nogo_trials) - float(successful_nogo_trials)) / float(nogo_trials),
                         float(successful_go_trials) / float(go_trials) - float(successful_nogo_trials) / float(nogo_trials),
                         float(go_latency), *group_ids]],
                       columns=column_list+file_keys)

    return df2
Ejemplo n.º 10
0
def crf_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved,
     retrieval_latency) = reward_retrieval(timecode, eventcode)
    (left_presses, right_presses,
     total_presses) = lever_pressing(eventcode, 'LPressOn', 'RPressOn')

    #    Use this code for latencies and rates
    #
    #    if 'LLeverOn' in eventcode:
    #        press_latency = lever_press_latency(timecode, eventcode, 'LLeverOn', 'LPressOn')
    #        (lever_press_rate, iti_rate) = cue_iti_responding(timecode, eventcode, 'StartSession', 'EndSession', 'LPressOn')
    #    elif 'RLeverOn' in eventcode:
    #        press_latency = lever_press_latency(timecode, eventcode, 'RLeverOn', 'RPressOn')
    #        (lever_press_rate, iti_rate) = cue_iti_responding(timecode, eventcode, 'StartSession', 'EndSession', 'RPressOn')

    df2 = pd.DataFrame([[
        loaded_file['Subject'],
        int(i + 1),
        float(dippers),
        float(dippers_retrieved),
        float(retrieval_latency),
        float(left_presses),
        float(right_presses),
        float(total_presses)
    ]],
                       columns=column_list)

    return df2
Ejemplo n.º 11
0
def crf_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved,
     retrieval_latency) = reward_retrieval(timecode, eventcode)
    (left_presses, right_presses,
     total_presses) = lever_pressing(eventcode, 'LPressOn', 'RPressOn')

    start_time = datetime.datetime.strptime(
        f'{loaded_file["Start Date"]} {loaded_file["Start Time"]}',
        '%m/%d/%y %H:%M:%S')
    end_time = datetime.datetime.strptime(
        f'{loaded_file["End Date"]} {loaded_file["End Time"]}',
        '%m/%d/%y %H:%M:%S')
    sess_length = end_time - start_time
    sess_length = sess_length.seconds

    #    Use this code for latencies and rates
    #
    #    if 'LLeverOn' in eventcode:
    #        press_latency = lever_press_latency(timecode, eventcode, 'LLeverOn', 'LPressOn')
    #        (lever_press_rate, iti_rate) = cue_iti_responding(timecode, eventcode, 'StartSession', 'EndSession', 'LPressOn')
    #    elif 'RLeverOn' in eventcode:
    #        press_latency = lever_press_latency(timecode, eventcode, 'RLeverOn', 'RPressOn')
    #        (lever_press_rate, iti_rate) = cue_iti_responding(timecode, eventcode, 'StartSession', 'EndSession', 'RPressOn')

    file_keys = list(loaded_file.keys())
    for constant in [
            'File', 'Start Date', 'End Date', 'Subject', 'Experiment', 'Group',
            'Box', 'Start Time', 'End Time', 'MSN', 'W'
    ]:
        file_keys.remove(constant)

    # All that's left in the list file_keys should be any group labels.
    group_ids = []
    for group in file_keys:
        group_ids.append(loaded_file[group])

    df2 = pd.DataFrame([[
        loaded_file['Subject'],
        int(i + 1),
        float(dippers),
        float(dippers_retrieved),
        float(retrieval_latency),
        float(left_presses),
        float(right_presses),
        float(total_presses),
        float(sess_length), *group_ids
    ]],
                       columns=column_list + file_keys)

    return df2
Ejemplo n.º 12
0
def CI_retardation_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (X_dur_individual, X_dur_total, XITI_dur_individual, XITI_dur_total) = cue_responding_duration(timecode, eventcode, 'InhibitorTrialStart', 'InhibitorTrialEnd', 'PokeOn1', 'PokeOff1')
    df2 = pd.DataFrame([[loaded_file['Subject'], loaded_file['tts'], loaded_file['CI'], int(i + 1),
                         float(X_dur_total), float(XITI_dur_total)]], columns=column_list)

    return df2
Ejemplo n.º 13
0
def trough_train_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved, retrieval_latency) = reward_retrieval(timecode, eventcode)

    df2 = pd.DataFrame([[loaded_file['Subject'], int(i + 1), float(dippers), float(dippers_retrieved),
                         float(retrieval_latency)]], columns=column_list)

    return df2
Ejemplo n.º 14
0
def habit_extinction_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (left_presses, right_presses, total_presses) = lever_pressing(eventcode, 'LPressOn', 'RPressOn')
    pressing_across_test = bin_by_time(timecode, eventcode, (5 * 60), ['LPressOn', 'RPressOn'])

    df2 = pd.DataFrame([[loaded_file['Subject'], loaded_file['Sex'], int(i + 1), loaded_file['Training'],
                         float(total_presses), pressing_across_test]], columns=column_list)
    bins_df = df2['Bins'].apply(pd.Series)
    bins_df = bins_df.rename(columns=lambda x: (x + 1) * 5)
    df2 = pd.concat([df2[:], bins_df[:]], axis=1)
    return df2
Ejemplo n.º 15
0
def CI_summation_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (B_responding, B_iti) = cue_iti_responding(timecode, eventcode, 'ExcitorBTrialStart', 'ExcitorBTrialEnd', 'PokeOn1')
    (inhibitor_responding, inhibitor_iti) = cue_iti_responding(timecode, eventcode, 'InhibitorTrialStart', 'InhibitorTrialEnd', 'PokeOn1')
    (B_responding_5, B_iti_5) = binned_responding(timecode, eventcode, 'ExcitorBTrialStart', 'ExcitorBTrialEnd', 'PokeOn1', 5)
    (inhibitor_responding_5, inhibitor_iti_5) = binned_responding(timecode, eventcode, 'InhibitorTrialStart', 'InhibitorTrialEnd', 'PokeOn1', 5)
    df2 = pd.DataFrame([[loaded_file['Subject'], loaded_file['MSN'], int(i + 1), float(B_responding),
                         float(B_iti), float(inhibitor_responding), float(inhibitor_iti), float(B_responding_5),
                         float(B_iti_5), float(inhibitor_responding_5), float(inhibitor_iti_5)]], columns=column_list)

    return df2
Ejemplo n.º 16
0
def PIT_training_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """

    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (A_dur_individual, A_dur_total, AITI_dur_individual,
     AITI_dur_total) = cue_responding_duration(timecode, eventcode,
                                               'ExcitorATrialStart',
                                               'ExcitorATrialEnd', 'PokeOn1',
                                               'PokeOff1')
    (B_dur_individual, B_dur_total, BITI_dur_individual,
     BITI_dur_total) = cue_responding_duration(timecode, eventcode,
                                               'ExcitorBTrialStart',
                                               'ExcitorBTrialEnd', 'PokeOn1',
                                               'PokeOff1')

    file_keys = list(loaded_file.keys())
    for constant in [
            'File', 'Start Date', 'End Date', 'Subject', 'Experiment', 'Group',
            'Box', 'Start Time', 'End Time', 'MSN', 'W'
    ]:
        file_keys.remove(constant)

    # All that's left in the list file_keys should be any group labels.
    group_ids = []
    for group in file_keys:
        group_ids.append(loaded_file[group])

    df2 = pd.DataFrame([[
        loaded_file['Subject'], loaded_file['MSN'],
        int(i + 1),
        float(A_dur_total),
        float(AITI_dur_total),
        float(B_dur_total),
        float(BITI_dur_total),
        float(A_dur_total - AITI_dur_total),
        float(B_dur_total - BITI_dur_total), *group_ids
    ]],
                       columns=column_list + file_keys)

    return df2
Ejemplo n.º 17
0
def Go_NoGo(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved,
     retrieval_latency) = reward_retrieval(timecode, eventcode)
    (go_trials, nogo_trials) = count_go_nogo_trials(eventcode)
    (successful_go_trials,
     successful_nogo_trials) = num_successful_go_nogo_trials(eventcode)
    df2 = pd.DataFrame([[
        loaded_file['Subject'], loaded_file['tts'],
        int(i + 1),
        float(dippers),
        float(go_trials),
        float(successful_go_trials)
    ]],
                       columns=column_list)

    return df2
Ejemplo n.º 18
0
def crf_function(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved,
     retrieval_latency) = reward_retrieval(timecode, eventcode)
    (large_rewards, small_rewards) = num_switch_trials(eventcode)
    (forced_latency) = lever_press_latency_Switch(timecode, eventcode)

    df2 = pd.DataFrame([[
        loaded_file['Subject'], loaded_file['MSN'],
        int(i + 1),
        float(dippers),
        float(large_rewards),
        float(small_rewards),
        float(forced_latency)
    ]],
                       columns=column_list)

    return df2
def signtracking(loaded_file, i):
    """
    :param loaded_file: file output from operant box
    :param i: number of days analyzing
    :return: data frame of all analysis extracted from file (one animal)
    """
    (timecode, eventcode) = extract_info_from_file(loaded_file, 500)
    (dippers, dippers_retrieved,
     retrieval_latency) = reward_retrieval(timecode, eventcode)
    (inactive_poke,
     inactive_iti_poke) = cue_iti_responding(timecode, eventcode,
                                             'NoRewardTrialStart',
                                             'NoRewardTrialEnd', 'PokeOn1')
    (inactive_press, inactive_iti_press) = cue_iti_responding(
        timecode, eventcode, 'NoRewardTrialStart', 'NoRewardTrialEnd',
        'InactivePress')
    (active_poke,
     active_iti_poke) = cue_iti_responding(timecode, eventcode,
                                           'RewardTrialStart',
                                           'RewardTrialEnd', 'PokeOn1')
    (active_press,
     active_iti_press) = cue_iti_responding(timecode, eventcode,
                                            'RewardTrialStart',
                                            'RewardTrialEnd', 'ActivePress')

    df2 = pd.DataFrame([[
        loaded_file['Subject'],
        int(i + 1),
        float(dippers),
        float(inactive_poke),
        float(inactive_press),
        float(active_poke),
        float(active_press)
    ]],
                       columns=column_list)

    return df2
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt

import numpy as np
import tkinter as tk
from tkinter.filedialog import askopenfilename

# opening data file
root = tk.Tk()
root.withdraw()
file = askopenfilename()
loaded_file = load_file(file)

# data transformed into lists of time- and eventcodes
(timecode, eventcode) = extract_info_from_file(loaded_file, 500)

# user input for how many events of each type (On/Off and discrete) to plot
long_events = input("How many behavioral On/Off events do you want to show?")
long_events = int(long_events)
short_events = input("How many discrete events would you like to show?")
short_events = int(short_events)

fig, ax = plt.subplots()

y = 1

# for-loop plotting On/Off events
for a in range(0, long_events):
    # user input for correct event title, then getting list of indices for event
    event1 = input(
def test_extract_info_from_file():
    (dictionary) = load_file("../operantanalysis/sampledata/!2018-11-27_08h39m.Subject _0001.txt")
    (timecode, eventcode) = extract_info_from_file(dictionary, 500)
    assert len(timecode) == len(eventcode)
    assert all(map(lambda x: x >= 0, timecode))