import csv


def readAIAresponse(csvFile):
    """Obtains the SDO/AIA responses from a .csv file.
    
    Parameters
    ----------
    csvFile : str
        The .csv file with the SDO/AIA responses in it. First line should be labels for each 
        column as a comma seperated string, e.g. row1=['logt, A94, A171'].
            
    Returns
    -------
    A dictionary with the responses where the keys are determined by the labels for each column.
    """
    
    with open(csvFile) as csvfile:
        readCSV = csv.reader(csvfile, delimiter=',')
        resp = {}
        for c,row in enumerate(readCSV):
            if c == 0:
                for t in row[0].split(sep=", "):
                    resp[t]=[] # find and make the keys from the first row of the .csv file
            else:
                for a, key in enumerate(resp.keys()):
                    resp[key].append(float(row[a])) # match each key to its index in the row
        
    return resp