import os def parse_dataset(dataset_name): assert(os.path.exists(dataset_name)) f = open(dataset_name, 'r') lines = f.readlines() f.close() time = [] frequency = [] amplitude = [] for i in range(len(lines)): l = lines[i].strip() if len(l) > 0 and l[0] is not '#': temp = list(map(float, l.split())) time.append(temp[0]) frequency.append(temp[1]) amplitude.append(temp[2]) return time, frequency, amplitude