Skip to content

Commit 4d3cbf7

Browse files
committed
Remove unused timing line parsing
1 parent c8ab2fb commit 4d3cbf7

File tree

2 files changed

+0
-39
lines changed

2 files changed

+0
-39
lines changed

cmdstanpy/utils/stancsv.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -141,30 +141,6 @@ def parse_hmc_adaptation_lines(
141141
return step_size, mass_matrix
142142

143143

144-
def parse_timing_lines(
145-
comment_lines: List[bytes],
146-
) -> Dict[str, float]:
147-
"""Parse the timing lines into a dictionary with key corresponding
148-
to the phase, e.g. Warm-up, Sampling, Total, and value the elapsed seconds
149-
"""
150-
out: Dict[str, float] = {}
151-
152-
cleaned_lines = (ln.lstrip(b"# ") for ln in comment_lines)
153-
in_timing_block = False
154-
for line in cleaned_lines:
155-
if line.startswith(b"Elapsed Time") and not in_timing_block:
156-
in_timing_block = True
157-
158-
if not in_timing_block:
159-
continue
160-
match = re.findall(r"([\d\.]+) seconds \((.+)\)", str(line))
161-
if match:
162-
seconds = float(match[0][0])
163-
phase = match[0][1]
164-
out[phase] = seconds
165-
return out
166-
167-
168144
def check_sampler_csv(
169145
path: str,
170146
is_fixed_param: bool = False,

test/test_stancsv.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,6 @@ def test_parse_comments_and_draws():
182182
assert draws_lines == [b"2\n", b"3\n"]
183183

184184

185-
def test_parsing_timing_lines():
186-
lines = [
187-
b"# \n",
188-
b"# Elapsed Time: 0.001332 seconds (Warm-up)\n",
189-
b"# 0.000249 seconds (Sampling)\n",
190-
b"# 0.001581 seconds (Total)\n",
191-
b"# \n",
192-
]
193-
out = stancsv.parse_timing_lines(lines)
194-
assert len(out) == 3
195-
assert out['Warm-up'] == 0.001332
196-
assert out['Sampling'] == 0.000249
197-
assert out['Total'] == 0.001581
198-
199-
200185
def test_parsing_adaptation_lines():
201186
lines = [
202187
b"# Adaptation terminated\n",

0 commit comments

Comments
 (0)