From 038c13312e75c8bc5e849dcac0cfe1844582c0c7 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <Olivier.Sauter@epfl.ch>
Date: Thu, 3 Feb 2022 13:41:43 +0100
Subject: [PATCH] add some info where it crashes in automatic anasrv run

---
 matlab/TCV/gdat_tcv.m | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m
index f84e5af6..d618cabb 100644
--- a/matlab/TCV/gdat_tcv.m
+++ b/matlab/TCV/gdat_tcv.m
@@ -3755,7 +3755,20 @@ end
 t_eq = t_psi(iround_os(t_psi,t_th));
 
 % Get PSI map
-psi = psitbxtcv(gdat_data.shot,t_eq,'*0',psitbx_str);
+% seems it has an error during automtic postshot but not when rerunning manually, hence add some info to log
+try
+  psi = psitbxtcv(gdat_data.shot,t_eq,'*0',psitbx_str);
+  aa=pp;
+catch ME
+  warning('problems with: psi = psitbxtcv(gdat_data.shot,t_eq,''*0'',psitbx_str);');
+  fprintf('\n%s%d\n','gdat_data.shot = ',gdat_data.shot);
+  whos t_eq
+  disp(['t_eq(1) = ' num2str(t_eq(1))])
+  psitbx_str
+  % try again
+  psi = psitbxtcv(gdat_data.shot,t_eq,'*0',psitbx_str);
+end
+
 % PSITBXTCV will have removed duplicate times
 i_psi = iround(psi.t,t_eq); % Mapping from psi times to TS times
 
-- 
GitLab