def extractdata(line):

    """For each line, return the x and y values, check whether there is reference value
    and if so return the reference value, otherwise return a reference value of 1 """

    newArray = (line.split(','))  #
    if len(newArray) == 8:
        # convert the strings to floats
        xvalue = float(newArray[3])
        yvalue =  float(newArray[5])
        refvalue =  float(newArray[7])
        return xvalue, yvalue, refvalue
    if len(newArray) == 6:
        # convert the strings to floats
        xvalue = float(newArray[3])
        yvalue =  float(newArray[5])
        refvalue = 1
        return xvalue, yvalue, refvalue
    else:
        print("Houston, we have a problem, This line does not appear to be data!:")
        print(line)