From fd460589c71c93c729c5555026ff1d694c178e4a Mon Sep 17 00:00:00 2001
From: Antoine Merle <antoine.merle@epfl.ch>
Date: Tue, 5 May 2020 18:17:39 +0200
Subject: [PATCH] Use z from thomson raw data when computing new psiscatvol.

---
 matlab/TCV/gdat_tcv.m | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m
index 6f1d4ca3..43686d66 100644
--- a/matlab/TCV/gdat_tcv.m
+++ b/matlab/TCV/gdat_tcv.m
@@ -1963,10 +1963,8 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
     end
     [gdat_data] = get_thomson_raw_data(shot,data_request_eff,gdat_data,gdat_data.gdat_params.edge,gdat_params.nverbose);
     % construct rho mesh
-    edge_str_ = '';
     edge_str_dot = '';
     if gdat_data.gdat_params.edge
-      edge_str_ = '_edge';
       edge_str_dot = '.edge';
     end
     if liuqe_matlab==1 && strcmp(substr_liuqe,'_1'); substr_liuqe = ''; end
@@ -1980,7 +1978,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       psiscatvol=gdat_tcv([],['\results::thomson' edge_str_dot ':psiscatvol' substr_liuqe],'nverbose',gdat_params.nverbose);
     else
       % calculate new psiscatvol
-      [psiscatvol,psi_max] = psi_scatvol_zshift(gdat_data, zshift, edge_str_dot, psitbx_str, gdat_params);
+      [psiscatvol,psi_max] = psi_scatvol_zshift(gdat_data, zshift, psitbx_str, gdat_params);
 
       % Add the results to the output of gdat
       gdat_data.psiscatvol = psiscatvol;
@@ -3537,17 +3535,16 @@ if any(strcmp(fieldnames(tracetdi),'units'))
 end
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-function [psiscatvol,psi_max] = psi_scatvol_zshift(gdat_data, zshift, system_str_dot, psitbx_str, gdat_params )
+function [psiscatvol,psi_max] = psi_scatvol_zshift(gdat_data, zshift, psitbx_str, gdat_params )
 % Input arguments:
 %   gdat_data: current structure containing TS data
 %   zshift: vertical shift of the equilibrium, can be a vector for time-dependent data
-%   system_str_dot: '' or '.edge' indicating thomson syste,
 %   psitbx_str: source for the equilibrium map, psitbx-style
 %   gdat_params: parameters for the gdat call % TODO: Why is it different from gdat_data.gdat_params?
 
 % Use psitbx
 t_th = gdat_data.t;
-th_z = mdsdata(['dim_of(\thomson' system_str_dot ':te,1)']); % TODO: Isn't this gdat_data.dim{1}?
+th_z = gdat_data.x;
 th_r = 0.9*ones(size(th_z));
 ntt = numel(t_th);
 nch = numel(th_z); % number of chords
-- 
GitLab