Try out tqdm

This commit is contained in:
Eric Teunis de Boone 2023-04-19 20:34:30 +02:00
parent 04858ea01a
commit b415786806

View file

@ -6,6 +6,11 @@ from scipy import signal, interpolate
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
try:
from tqdm import tqdm
except:
tqdm = lambda x: x
rng = np.random.default_rng() rng = np.random.default_rng()
class Waveform: class Waveform:
@ -105,15 +110,16 @@ def template_downsampler(template_signal, trace, template_t, trace_t, offset):
if __name__ == "__main__": if __name__ == "__main__":
import os import os
import matplotlib import matplotlib
import sys
if os.name == 'posix' and "DISPLAY" not in os.environ: if os.name == 'posix' and "DISPLAY" not in os.environ:
matplotlib.use('Agg') matplotlib.use('Agg')
template_dt = 5e-2 # ns
bp_freq = (30e-3, 80e-3) # GHz bp_freq = (30e-3, 80e-3) # GHz
template_dt = 5e-2 # ns
template_length = 100 # ns template_length = 100 # ns
noise_sigma_factor = 1e1 # keep between 10 and 0.1 noise_sigma_factor = 1e0 # keep between 10 and 0.1
N_residuals = 50*3 N_residuals = 50*3 if len(sys.argv) < 2 else int(sys.argv[1])
antenna_dt = 2 # ns antenna_dt = 2 # ns
antenna_timelength = 2048 # ns antenna_timelength = 2048 # ns
@ -144,7 +150,7 @@ if __name__ == "__main__":
# Find difference between true and templated times # Find difference between true and templated times
# #
time_residuals = np.zeros(N_residuals) time_residuals = np.zeros(N_residuals)
for j in range(N_residuals): for j in tqdm(range(N_residuals)):
do_plots = j==0 do_plots = j==0
# receive at antenna # receive at antenna