ZH: findks: introduce tqdm + suppress many figures warning

This commit is contained in:
Eric Teunis de Boone 2023-05-01 18:19:37 +02:00
parent 7eaa97d0cb
commit 208bd9a35d

View file

@ -20,6 +20,11 @@ import aa_generate_beacon as beacon
import lib
from lib import rit
try:
from tqdm import tqdm
except:
tqdm = lambda x: x
def find_best_period_shifts_summing_at_location(test_loc, antennas, allowed_ks, period=1, dt=None, period_shift_first_trace=0, plot_iteration_with_shifted_trace=None, fig_dir=None, fig_distinguish=None,snr_str=None, shower_plane_loc=None):
"""
Find the best sample_shift for each antenna by summing the antenna traces
@ -175,6 +180,8 @@ if __name__ == "__main__":
if os.name == 'posix' and "DISPLAY" not in os.environ:
matplotlib.use('Agg')
plt.rcParams.update({'figure.max_open_warning': 0})
atm = AtmoCal()
from scriptlib import MyArgumentParser
@ -427,9 +434,10 @@ if __name__ == "__main__":
yy = []
N_loc = len(maxima_per_loc)
for i, (x_, y_) in enumerate(product(x,y)):
for i, (x_, y_) in tqdm(enumerate(product(x,y)), total=N_loc, ):
tmp_fig_subdir = None
if i % 10 ==0:
if hasattr(tqdm, '__code__') and tqdm.__code__.co-name == '<lambda>':
print(f"Testing location {i} out of {N_loc}")
tmp_fig_subdir = fig_subdir