예제 #1
0
                                                                     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)
예제 #2
0
    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 = io.StringIO(
                file.read()
                [1:])  # remove the # at the beginning of simulations files
            tmp = pandas.read_csv(tmp,
                                  delim_whitespace=True,
                                  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': 'BNG2'})
    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)
예제 #3
0
        sims[ind].set_index('compartment', append=True, inplace=True)
        sims[ind] = sims[ind].reorder_levels(['compartment', 'time'])

    return pandas.concat(sims, keys=range(len(sims))), len(sims)


# read the data files
def read_data(files):
    data = []
    for ind, infile in enumerate(files):
        with open(infile, 'r') as input:
            data.append(
                pandas.read_csv(input, delimiter=' ',
                                engine='python').set_index('time'))

        # mark each data file with the corresponding compartment
        name = list(data[ind].columns)[0]
        data[ind]['compartment'] = name
        data[ind].set_index('compartment', append=True, inplace=True)
        data[ind] = data[ind].reorder_levels(['compartment', 'time'])

    return pandas.concat(data, keys=range(len(data))), len(data)


if __name__ == '__main__':
    args = argsparser(**{'simulator': 'PISKaS v1.3'})
    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)
예제 #4
0
                                                                     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': 'NFsim'})
    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)
예제 #5
0
# 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='\t',
                                  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': 'Tellurium v2.1.5'})

    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