Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: ensure logging is done on last iteration #27

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions fftvis/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
)
Expand Down
Loading