Skip to content

Commit

Permalink
Add verbose input to the model
Browse files Browse the repository at this point in the history
  • Loading branch information
Sosnowsky committed May 3, 2024
1 parent 1891d20 commit 4146760
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion blobmodel/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(
labels: str = "off",
label_border: float = 0.75,
one_dimensional: bool = False,
verbose: bool = True,
) -> None:
"""
Initialize the 2D Model of propagating blobs.
Expand Down Expand Up @@ -74,6 +75,8 @@ def __init__(
one_dimensional : bool, optional
If True, the perpendicular shape of the blobs will be discarded.
Parameters for the y-component (Ny and Ly) will be overwritten to Ny=1, Ly=0.
verbose : bool, optional
If True, print a loading bar.
Raises
------
Expand Down Expand Up @@ -122,6 +125,7 @@ def __init__(
self._labels = labels
self._label_border = label_border
self._reset_fields()
self._verbose = verbose

def __str__(self) -> str:
"""
Expand Down Expand Up @@ -193,7 +197,8 @@ def make_realization(
t_drain=self.t_drain,
)

for blob in tqdm(self._blobs, desc="Summing up Blobs"):
iterable = tqdm(self._blobs, desc="Summing up Blobs") if self._verbose else self._blobs
for blob in iterable:
self._sum_up_blobs(blob, speed_up, error)

dataset = self._create_xr_dataset()
Expand Down

0 comments on commit 4146760

Please sign in to comment.