diff --git a/pyproject.toml b/pyproject.toml index fdae5b51..040be575 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,7 @@ dependencies = [ "matplotlib", # Plotting library, The. "cmcrameri", # Matplotlib colormaps using the palettes designed by Fabio Crameri. "h5py", # For reading Fluidity .h5part files. + "tqdm", # For progress bars (for long-running CLI scripts) ] [project.optional-dependencies] diff --git a/src/pydrex/io.py b/src/pydrex/io.py index 4aac4270..e85da3a0 100644 --- a/src/pydrex/io.py +++ b/src/pydrex/io.py @@ -26,6 +26,7 @@ import meshio import numpy as np import yaml +from tqdm import tqdm from pydrex import core as _core from pydrex import exceptions as _err @@ -80,7 +81,9 @@ def extract_h5part(file, phase, fabric, n_grains, output): fractions = np.empty((n_timesteps, n_grains)) strains = np.zeros(n_timesteps) - for t, k in enumerate(steps): + for t, k in enumerate( + tqdm(steps, desc=f"Extracting particle {particle_id}") + ): # Extract particle position. x[t] = f[f"{k}/x"][particle_id - 1] y[t] = f[f"{k}/y"][particle_id - 1]