MCPcopy Create free account
hub / github.com/NanoComp/meep / display_progress

Function display_progress

python/simulation.py:5518–5539  ·  view source on GitHub ↗
(t0, t, dt)

Source from the content-addressed store, hash-verified

5516
5517
5518def display_progress(t0, t, dt):
5519 t_0 = mp.wall_time()
5520 closure = {"tlast": mp.wall_time()}
5521
5522 def _disp(sim):
5523 t1 = mp.wall_time()
5524 if t1 - closure["tlast"] >= dt:
5525 msg_fmt = "Meep progress: {}/{} = {:.1f}% done in {:.1f}s, {:.1f}s to go"
5526 val1 = sim.meep_time() - t0
5527 val2 = val1 / (0.01 * t)
5528 val3 = t1 - t_0
5529 val4 = (val3 * (t / val1) - val3) if val1 != 0 else 0
5530
5531 if do_progress:
5532 sim.progress.value = val1
5533 sim.progress.description = f"{int(val2)}% done "
5534
5535 if verbosity.meep > 0:
5536 print(msg_fmt.format(val1, t, val2, val3, val4))
5537 closure["tlast"] = t1
5538
5539 return _disp
5540
5541
5542def data_to_str(d):

Callers 1

_run_untilMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected