Skip to content

Commit

Permalink
Merge branch 'develop' into ci/try-numpy-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Jan 19, 2024
2 parents 0f80fe4 + 078c43a commit 3f8998e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions cmdstanpy/stanfit/mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,12 @@ def _assemble_draws(self) -> None:
self._metric[chain, i, :] = [
float(x) for x in xs
]
else: # unit_e changed in 2.34 to have an extra line
pos = fd.tell()
line = fd.readline().strip()
if not line.startswith('#'):
fd.seek(pos)

# process draws
for i in range(sampling_iter_start, num_draws):
line = fd.readline().strip()
Expand Down
10 changes: 8 additions & 2 deletions cmdstanpy/utils/stancsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,16 @@ def scan_hmc_params(
raise ValueError(
'line {}: invalid step size: {}'.format(lineno, step_size)
) from e
if metric == 'unit_e':
return lineno
before_metric = fd.tell()
line = fd.readline().strip()
lineno += 1
if metric == 'unit_e':
if line.startswith("# No free parameters"):
return lineno
else:
fd.seek(before_metric)
return lineno - 1

if not (
(
metric == 'diag_e'
Expand Down

0 comments on commit 3f8998e

Please sign in to comment.