Skip to content

Commit d16271a

Browse files
committed
more cleanup
1 parent 6e28bc9 commit d16271a

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

cmdstanpy/model.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,14 +1303,13 @@ def _run_cmdstan(
13031303
)
13041304
while proc.poll() is None:
13051305
if proc.stdout is not None:
1306-
lines = proc.stdout.readlines()
1307-
for line in lines:
1308-
fd_out.write(line)
1309-
line = line.strip()
1310-
if show_console and len(line) > 1:
1311-
print('chain {}: {}'.format(idx + 1, line))
1312-
if show_progress and progress_hook is not None:
1313-
progress_hook(line)
1306+
line = proc.stdout.readline()
1307+
fd_out.write(line)
1308+
line = line.strip()
1309+
if show_console and len(line) > 1:
1310+
print('chain {}: {}'.format(idx + 1, line))
1311+
if show_progress and progress_hook is not None:
1312+
progress_hook(line)
13141313
if show_progress and progress_hook is not None:
13151314
progress_hook("Done")
13161315

cmdstanpy/utils.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -961,12 +961,11 @@ def do_command(
961961
)
962962
while proc.poll() is None:
963963
if proc.stdout is not None:
964-
lines = proc.stdout.readlines()
965-
for line in lines:
966-
if fd_out is not None:
967-
fd_out.write(line)
968-
if pbar is not None:
969-
pbar(line.strip())
964+
line = proc.stdout.readline()
965+
if fd_out is not None:
966+
fd_out.write(line)
967+
if pbar is not None:
968+
pbar(line.strip())
970969

971970
stdout, _ = proc.communicate()
972971
if stdout:

cmdstanpy_tutorial.ipynb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,9 @@
308308
"metadata": {},
309309
"outputs": [],
310310
"source": [
311-
"%matplotlib inline\n",
312-
"import pandas as pd\n",
313-
"\n",
314311
"vars = fit.stan_variables()\n",
315312
"for (k,v) in vars.items():\n",
316-
" print(k, v.shape)\n",
317-
"\n",
318-
"thetas = fit.stan_variable(var='theta')\n",
319-
"pd.DataFrame(data=thetas).plot.density()"
313+
" print(k, v.shape)"
320314
]
321315
},
322316
{

0 commit comments

Comments
 (0)