From 93def1358d8d2774f9968b416728c545529d745d Mon Sep 17 00:00:00 2001 From: Steven Murray Date: Wed, 18 Sep 2024 19:26:50 +0200 Subject: [PATCH] ui: ensure logging is done on last iteration --- fftvis/simulate.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fftvis/simulate.py b/fftvis/simulate.py index 68154b8..50abb07 100644 --- a/fftvis/simulate.py +++ b/fftvis/simulate.py @@ -299,10 +299,7 @@ def simulate( # Have up to 100 reports as it iterates through time. report_chunk = ntimes // max_progress_reports + 1 pr = psutil.Process() - tstart = time.time() mlast = pr.memory_info().rss - plast = tstart - highest_peak = logutils.memtrace(highest_peak) with Progress() as progress: @@ -311,6 +308,9 @@ def simulate( "Simulating Times", total=ntimes, visible=live_progress ) + tstart = time.time() + plast = tstart + # Loop over time samples for ti, eq2top in enumerate(eq2tops): # Convert to topocentric coordinates @@ -459,7 +459,7 @@ def simulate( # Baselines were provided, so we can just add the visibilities vis[ti] = np.swapaxes(_vis, 2, 0) - if not (ti % report_chunk or ti == ntimes - 1): + if not (ti % report_chunk) or ti == ntimes - 1: plast, mlast = logutils.log_progress( tstart, plast, ti + 1, ntimes, pr, mlast )