From 5cc16420a63a5cae082f249d01c37530ea36a0f1 Mon Sep 17 00:00:00 2001
From: Antoine Merle <antoine.merle@epfl.ch>
Date: Fri, 11 Oct 2019 12:15:27 +0200
Subject: [PATCH] Add psiscatvol and psi_max structures to the gdat output.

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

diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m
index b60c26ca..b332400d 100644
--- a/matlab/TCV/gdat_tcv.m
+++ b/matlab/TCV/gdat_tcv.m
@@ -1717,8 +1717,8 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       % Compute psi at TS positions
       psi_ts = psitbxf2f(psi,pgrid);
       psiscatvol.data = squeeze(psi_ts.x(:,i_psi));
-      psiscatvol.dim{1} = t_th;
-      psiscatvol.dim{2} = gdat_data.x;
+      psiscatvol.dim{1} = gdat_data.x;
+      psiscatvol.dim{2} = t_th;
       % NOTE: we should probably not include time points where equilibrium time is far from TS time.
       
       % Compute psi_axis at TS times
@@ -1729,6 +1729,11 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       % psitbx adds some Newton iterations so again complex numbers are possible
       psi_norm = psitbxp2p(psi,'01');
       psi_max.data = psi_norm.psimag(i_psi);
+      psi_max.dim = {t_th};
+      
+      % Add the results to the output of gdat
+      gdat_data.psiscatvol = psiscatvol;
+      gdat_data.psi_max = psi_max;
     end
     if ~isempty(psiscatvol.data) && ~ischar(psiscatvol.data) && ~isempty(psi_max.data) && ~ischar(psi_max.data)
       rho = sqrt(1.-psiscatvol.data./repmat(psi_max.data(:).',[size(psiscatvol.data,1),1]));
-- 
GitLab