From 457bb620c0d8e64678701258349efd69fcc3c8de Mon Sep 17 00:00:00 2001
From: "Antonello, Dr. Massimiliano" <massimiliano.antonello@uni-hamburg.de>
Date: Fri, 25 Oct 2024 15:37:06 +0200
Subject: [PATCH] Now sumlab_auto can extract automatically the correct t_gate
 to be used from each file_name

---
 user/sumlab_auto.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/user/sumlab_auto.py b/user/sumlab_auto.py
index 37f590b..760cab0 100644
--- a/user/sumlab_auto.py
+++ b/user/sumlab_auto.py
@@ -70,9 +70,12 @@ print("=======================================\033[0m")
 # Loop thorough SORTED files in alphabetical order!
 files_to_fit = sorted(files_to_fit, key=lambda x: x[0])
 for i, (file, path) in enumerate(files_to_fit):
-    print("Fitting: \033[95m{:s}\033[0m".format(file))
     V = float(file.split('deg')[1].split('V')[0].replace('_', '.'))
-    f_tau_hmt = f_tau(V, V_bd_hmt, V_0_hmt)
+    if 'ns' in file:
+        t_gate = float(file.split('V')[1].split('ns')[0].replace('_', '.'))
+    print(f"Fitting: \033[95m{file}\033[0m (t_gate = {t_gate} ns)")
+
+    #f_tau_hmt = f_tau(V, V_bd_hmt, V_0_hmt)
 
     # Load files.
     data = np.loadtxt(path, skiprows=0)
@@ -83,7 +86,7 @@ for i, (file, path) in enumerate(files_to_fit):
                tau=tau,  # SLOW PULSE COMPONENT TIME CONSTANT (ns)
                t_gate=t_gate,  # GATE LENGTH (ns)
                t_0=t_0,  # INTEGRATION TIME BEFORE GATE (ns)
-               tau_R=f_tau_hmt*tau,
+               tau_R=0.65*tau, #WAS: tau_R=f_tau_hmt*tau,
                bin_0=bin_0,
                truncate_nsigma0_up=truncate_nsigma0_up,
                truncate_nsigma0_do=truncate_nsigma0_do,
-- 
GitLab