From 925a1bd174127c3f46e99bfd9816383e9e09dc19 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Fri, 16 Feb 2018 12:03:24 +0000
Subject: [PATCH] various minor bugs and open correctly fbte shots

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@9357 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/TCV/gdat_tcv.m             | 14 +++++++++-----
 crpptbx/TCV/tcv_help_parameters.m  |  2 +-
 crpptbx/TCV/tcv_requests_mapping.m |  4 ++--
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/crpptbx/TCV/gdat_tcv.m b/crpptbx/TCV/gdat_tcv.m
index 7e3cb5ba..cba8b5ff 100644
--- a/crpptbx/TCV/gdat_tcv.m
+++ b/crpptbx/TCV/gdat_tcv.m
@@ -305,7 +305,7 @@ ishot=NaN;
 if do_mdsopen_mdsclose
   % mdsdefaultserver tcv1.epfl.ch; % should be in tcv general path, but set-it in the meantime...
 %%%  if liuqe_version_eff==-1
-  if shot==-1
+  if shot==-1 || liuqe_version_eff==-1
     ishot = mdsopen('pcs', shot);
   else
     if length(data_request_eff)>7 && strcmp(data_request_eff(1:6),'\rtc::')
@@ -769,6 +769,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
     sub_nodes_units = {'eV','m/s','m/s','m^{-3}',''}; % first node is also copied into data, choose "default' one
     % use A. Karpushov routine to get profiles and then copy the data or the fitted profiles
     aa=CXRS_get_profiles; cxrs_params = aa.param;
+    gdat_data.cxrs_params.defaults = cxrs_params;
     cxrs_params.k_plot=0; cxrs_params.k_debug=0;
     % add params from gdat call
     params_eff = gdat_data.gdat_params;
@@ -1108,8 +1109,8 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
     recompute_psiscatvol_always = 1;
     if liuqe_version==-1; recompute_psiscatvol_always = 1; end
     if abs(zshift)<1e-5 && liuqe_matlab==0 && recompute_psiscatvol_always==0
-      psi_max=gdat([],['\results::thomson' edge_str_dot ':psi_max' substr_liuqe],'nverbose',gdat_params.nverbose);
-      psiscatvol=gdat([],['\results::thomson' edge_str_dot ':psiscatvol' substr_liuqe],'nverbose',gdat_params.nverbose);
+      psi_max=gdat_tcv([],['\results::thomson' edge_str_dot ':psi_max' substr_liuqe],'nverbose',gdat_params.nverbose);
+      psiscatvol=gdat_tcv([],['\results::thomson' edge_str_dot ':psiscatvol' substr_liuqe],'nverbose',gdat_params.nverbose);
     else
       % calculate new psiscatvol
       if liuqe_matlab==0
@@ -1401,8 +1402,11 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       gdat_data.ohm.data_fullpath = '\results::conf:ptot_ohm';
       gdat_data.ohm.help = ptot_ohm.help;
     else
-      ip=gdat([],'ip');
-      vloop=gdat([],'vloop');
+      params_eff = gdat_data.gdat_params;
+      params_eff.data_request='ip'; % to make sure to use input params like liuqe option
+      ip=gdat_tcv([],params_eff); %gdat_tcv to avoid plotting in case doplot=1 if using gdat and to save time
+      params_eff.data_request='vloop';
+      vloop=gdat_tcv([],params_eff);
       gdat_data.ohm.t = vloop.t;
       gdat_data.ohm.dim{1} = gdat_data.t;
       gdat_data.dimunits{1} = 's';
diff --git a/crpptbx/TCV/tcv_help_parameters.m b/crpptbx/TCV/tcv_help_parameters.m
index 2278708d..05790029 100644
--- a/crpptbx/TCV/tcv_help_parameters.m
+++ b/crpptbx/TCV/tcv_help_parameters.m
@@ -18,7 +18,7 @@ help_struct_all = struct(...
                     'Note shot value should not be in params so params can be used to load same data from another shot']  ...
     ,'machine', 'machine name like ''TCV'', ''AUG'', case insensitive' ...
     ,'doplot', '0 (default), if 1 calls gdat_plot for a new figure, -1 plot over current figure with hold all, see gdat_plot for details' ...
-    ,'liuqe','liuqe version 1 (default), 2, 3 for LIUQE1, 2, 3 resp. or -1 for model values (11, 12, 13 for liuqe_fortran)' ...
+    ,'liuqe','liuqe version 1 (default), 2, 3 for LIUQE1, 2, 3 resp. or -1 for model/FBTE values (11, 12, 13 for liuqe_fortran)' ...
     ,'nverbose','1 (default) displays warnings, 0: only errors, >=3: displays all extra information' ...
     );
 
diff --git a/crpptbx/TCV/tcv_requests_mapping.m b/crpptbx/TCV/tcv_requests_mapping.m
index c597b578..ecc6774e 100644
--- a/crpptbx/TCV/tcv_requests_mapping.m
+++ b/crpptbx/TCV/tcv_requests_mapping.m
@@ -102,7 +102,7 @@ switch lower(data_request)
   mapping.expression = '\tcv_shot::top.results.equil_1.results:delta_bot';
   mapping.expression = 'tcv_eq(''''delta_ed_bot'''',''''LIUQE.M'''')';
  case 'delta_rho'
-  mapping.timedim = 1;
+  mapping.timedim = 2;
   mapping.method = 'tdiliuqe';
   mapping.expression = '\tcv_shot::top.results.equil_1.results:delta';
   mapping.expression = 'tcv_eq(''''delta'''',''''LIUQE.M'''')';
@@ -154,7 +154,7 @@ switch lower(data_request)
   mapping.expression = '\tcv_shot::top.results.equil_1.results:kappa_edge';
   mapping.expression = 'tcv_eq(''''kappa_edge'''',''''LIUQE.M'''')';
  case 'kappa_rho'
-  mapping.timedim = 1;
+  mapping.timedim = 2;
   mapping.method = 'tdiliuqe';
   mapping.expression = '\tcv_shot::top.results.equil_1.results:kappa';
   mapping.expression = 'tcv_eq(''''kappa'''',''''LIUQE.M'''')';
-- 
GitLab