Beispiel #1
0
def _read_log(fname):
    """
    Read a log file 'fname' to produce instance of Config and Records.
    """

    print(f'Reading data from: {fname}')

    cf = Config()
    rs = Records()

    with open(fname, 'r') as f:
        cf.readin(f)
        skip_lines(3, f)
        rs.runs = [int(f.readline().split()[2])]
        rs.seed = [int(f.readline().split()[2])]
        rs.lattice_dims = [int(x) for x in f.readline().split()[2:]]
        skip_lines(4, f)
        while True:
            r = Records.read(f)
            if r == '' or r[0] == '\n':
                break
            rs.add(r)

    print(f'read in: {len(rs.inds)} records')

    return cf, rs