Skip to content

Commit

Permalink
Switch to tqdm.autonotebook, refactor tqdm call
Browse files Browse the repository at this point in the history
  • Loading branch information
aknierim committed Jan 20, 2025
1 parent 9756ec8 commit 5c1afce
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pyvisgen/simulation/visibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import torch
import toma
from tqdm import tqdm
from tqdm.autonotebook import tqdm

import pyvisgen.simulation.scan as scan

Expand Down Expand Up @@ -176,9 +176,13 @@ def _batch_loop(
Visibilities dataclass object.
"""
batches = torch.arange(bas[:].shape[1]).split(batch_size)

if show_progress:
batches = tqdm(batches)
batches = tqdm(
batches,
position=0,
disable=not show_progress,
desc="Computing visibilities",
postfix=f"Batchsize: {batch_size}",
)

for p in batches:
bas_p = bas[:][:, p]
Expand Down

0 comments on commit 5c1afce

Please sign in to comment.