Definition at line 16 of file TurnDataReader.py.
◆ __init__()
def python.TurnDataReader.TurnDataReader.__init__ |
( |
|
self, |
|
|
|
infile = None |
|
) |
| |
◆ readData()
def python.TurnDataReader.TurnDataReader.readData |
( |
|
self | ) |
|
Definition at line 29 of file TurnDataReader.py.
32 if self.infile
is None:
33 print(
'TurnDataReader.readData() called with infile == None!')
38 f =
open(self.infile,
'r')
40 print(
'Error opening file', self.infile)
50 matchlb = re.compile(
r'^([0-9]+) (\S+) (\S+)$')
53 matchalg = re.compile(
r'^(\S+)$')
58 for line
in f.readlines():
60 if self.verbose:
print(line, end=
' ')
62 m = matchlb.search(line)
64 if self.verbose:
print(
'Found data record match:', m.group(1), m.group(2), m.group(3))
69 if m.group(2) ==
'nan':
72 counts =
float(m.group(2))
74 if m.group(3) ==
'nan':
77 turns =
float(m.group(3))
81 print(
'TurnDataReader.readData() found data record with no algorithm defined in', self.infile)
86 if lb
not in self.data:
87 self.data[lb] = dict()
89 self.data[lb][algId] = (turns, counts)
92 print(
'Alg:', algId,
'LB:', lb,
'Turns:', turns,
'Counts:', counts)
95 m = matchalg.search(line)
97 if self.verbose:
print(
'Found new algorithm:', m.group(1))
102 print(
'TurnDataReader.readData() found unrecognized algorithm name in', self.infile)
◆ data
python.TurnDataReader.TurnDataReader.data |
◆ infile
python.TurnDataReader.TurnDataReader.infile |
◆ verbose
python.TurnDataReader.TurnDataReader.verbose |
The documentation for this class was generated from the following file: