Skip to content

Commit

Permalink
disable I/O by default in Jupyter
Browse files Browse the repository at this point in the history
also, the first and last plotfile were not respecting io.do_io
  • Loading branch information
zingale committed Sep 6, 2024
1 parent 0bd2446 commit d18da47
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pyro/pyro_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,12 @@ def initialize_problem(self, problem_name, *, inputs_file=None, inputs_dict=None

self.rp.load_params(inputs_file, no_new=1)

# manually override the dovis and verbose defaults
# manually override the I/O, dovis, and verbose defaults
# for Jupyter, we want runtime vis disabled by default
if not self.from_commandline:
self.rp.set_param("vis.dovis", 0)
self.rp.set_param("driver.verbose", 0)
self.rp.set_param("io.do_io", 0)

if inputs_dict is not None:
for k, v in inputs_dict.items():
Expand Down Expand Up @@ -162,7 +163,10 @@ def run_sim(self):

# output the 0th data
basename = self.rp.get_param("io.basename")
self.sim.write(f"{basename}{self.sim.n:04d}")
do_io = self.rp.get_param("io.do_io")

if do_io:
self.sim.write(f"{basename}{self.sim.n:04d}")

if self.dovis:
plt.figure(num=1, figsize=(8, 6), dpi=100, facecolor='w')
Expand All @@ -172,10 +176,11 @@ def run_sim(self):
self.single_step()

# final output
if self.verbose > 0:
msg.warning("outputting...")
basename = self.rp.get_param("io.basename")
self.sim.write(f"{basename}{self.sim.n:04d}")
if do_io:
if self.verbose > 0:
msg.warning("outputting...")
basename = self.rp.get_param("io.basename")
self.sim.write(f"{basename}{self.sim.n:04d}")

tm_main.end()
# -------------------------------------------------------------------------
Expand Down

0 comments on commit d18da47

Please sign in to comment.