From 48fc7999ce7422fbc84fa0f61d5ea3400b69cbc8 Mon Sep 17 00:00:00 2001 From: Remco de Boer Date: Fri, 19 Feb 2021 00:22:50 +0100 Subject: [PATCH] fix: add option to disable tqdm in minuit --- src/tensorwaves/optimizer/minuit.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tensorwaves/optimizer/minuit.py b/src/tensorwaves/optimizer/minuit.py index 78a40a2a3..1eda638ed 100644 --- a/src/tensorwaves/optimizer/minuit.py +++ b/src/tensorwaves/optimizer/minuit.py @@ -2,6 +2,7 @@ """Minuit2 adapter to the `iminuit.Minuit` package.""" +import logging import time from datetime import datetime from typing import Dict, Iterable, Optional, Union @@ -84,7 +85,9 @@ def optimize( # pylint: disable=too-many-locals parameter_handler = ParameterFlattener(initial_parameters) flattened_parameters = parameter_handler.flatten(initial_parameters) - progress_bar = tqdm() + progress_bar = tqdm( + disable=logging.getLogger().level > logging.WARNING + ) n_function_calls = 0 def update_parameters(pars: list) -> None: