axis=1) sims.append(tmp) return pandas.concat(sims, keys=range(len(sims))), len(sims) # read the data files def read_data(files): data = [] for infile in files: with open(infile, 'r') as file: tmp = pandas.read_csv(file, delimiter=' ', header=0, engine='python') tmp = tmp.set_index('time', drop=False).rename_axis(None, axis=0).drop('time', axis=1) data.append(tmp) return pandas.concat(data, keys=range(len(data))), len(data) if __name__ == '__main__': args = argsparser(**{'simulator': 'KaSim v3.5'}) data, len_data = read_data(args.data) # read data files sims, len_sims = read_sims(args.sims) # read sims files # calculate fitness doerror(args, data, len_data, sims, len_sims)
# read the data files def read_data(files): data = [] for infile in files: with open(infile, 'r') as file: tmp = pandas.read_csv(file, delimiter=',', header=0, engine='python') tmp = tmp.set_index('[T]', drop=False).rename_axis(None, axis=0).drop('[T]', axis=1) data.append(tmp) return pandas.concat(data, keys=range(len(data))), len(data) if __name__ == '__main__': args = argsparser(**{'simulator': 'KaSim v4'}) if args.lower is not None: args.lower, _ = read_data(args.lower) # read lower limit if set if args.upper is not None: args.upper, _ = read_data(args.upper) # read upper limit if set data, len_data = read_data(args.data) # read data files sims, len_sims = read_sims(args.sims) # read sims files doerror(args, data, len_data, sims, len_sims) # calculate fitness