import csv


def extract_all_data(filename):
    """Get the basic data from the .dat files; the labels and v,t data"""
    # Open the filename in read mode with temporary storage
    with open(filename, 'r') as myarray:
        data = csv.reader(myarray, delimiter=' ')
        # Extract data into comma separated list
        data = [row for row in data]

    # Get time data at position 5
    t_data = [float(dat[5]) for dat in data]
    # Get Voltage data at position 1
    v_data = [float(dat[1]) for dat in data]
    gk = float(data[0][6])
    gcal = float(data[0][7])
    gsk = float(data[0][8])
    # return this data as two separate arrays and two floats
    return t_data, v_data, gk, gcal, gsk