Skip to content

Commit

Permalink
Merge pull request #720 from dirac-institute/simplify_progress_bar_code
Browse files Browse the repository at this point in the history
Remove the tqdm_utils.py file
  • Loading branch information
jeremykubica authored Sep 20, 2024
2 parents 36e739c + 136408d commit 5a5f0e8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/kbmod/reprojection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from kbmod import is_interactive
from kbmod.search import KB_NO_DATA, PSF, ImageStack, LayeredImage, RawImage
from kbmod.work_unit import WorkUnit
from kbmod.tqdm_utils import TQDMUtils
from kbmod.wcs_utils import append_wcs_to_hdu_header
from astropy.io import fits
import os
Expand All @@ -17,6 +16,7 @@

# The number of executors to use in the parallel reprojecting function.
MAX_PROCESSES = 8
_DEFAULT_TQDM_BAR = "{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}]"


def reproject_image(image, original_wcs, common_wcs):
Expand Down Expand Up @@ -197,7 +197,7 @@ def _reproject_work_unit(
stack = ImageStack()
for obstime_index, o_i in tqdm(
enumerate(zip(unique_obstimes, unique_obstime_indices)),
bar_format=TQDMUtils.DEFAULT_TQDM_BAR_FORMAT,
bar_format=_DEFAULT_TQDM_BAR,
desc="Reprojecting",
disable=not show_progress,
):
Expand Down Expand Up @@ -406,7 +406,7 @@ def _reproject_work_unit_in_parallel(
tqdm(
concurrent.futures.as_completed(future_reprojections),
total=len(future_reprojections),
bar_format=TQDMUtils.DEFAULT_TQDM_BAR_FORMAT,
bar_format=_DEFAULT_TQDM_BAR,
desc="Reprojecting",
disable=not show_progress,
)
Expand Down Expand Up @@ -538,7 +538,7 @@ def reproject_lazy_work_unit(
tqdm(
concurrent.futures.as_completed(future_reprojections),
total=len(future_reprojections),
bar_format=TQDMUtils.DEFAULT_TQDM_BAR_FORMAT,
bar_format=_DEFAULT_TQDM_BAR,
desc="Reprojecting",
disable=not show_progress,
)
Expand Down
4 changes: 0 additions & 4 deletions src/kbmod/tqdm_utils.py

This file was deleted.

8 changes: 5 additions & 3 deletions src/kbmod/work_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
wcs_to_dict,
)
from kbmod.reprojection_utils import invert_correct_parallax
from kbmod.tqdm_utils import TQDMUtils


_DEFAULT_WORKUNIT_TQDM_BAR = "{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}]"


logger = Logging.getLogger(__name__)
Expand Down Expand Up @@ -311,7 +313,7 @@ def from_fits(cls, filename, show_progress=None):
# Read in all the image files.
for i in tqdm(
range(num_images),
bar_format=TQDMUtils.DEFAULT_TQDM_BAR_FORMAT,
bar_format=_DEFAULT_WORKUNIT_TQDM_BAR,
desc="Loading images",
disable=not show_progress,
):
Expand Down Expand Up @@ -340,7 +342,7 @@ def from_fits(cls, filename, show_progress=None):
constituent_images = []
for i in tqdm(
range(n_constituents),
bar_format=TQDMUtils.DEFAULT_TQDM_BAR_FORMAT,
bar_format=_DEFAULT_WORKUNIT_TQDM_BAR,
desc="Loading WCS",
disable=not show_progress,
):
Expand Down

0 comments on commit 5a5f0e8

Please sign in to comment.