From b7a29de567fecfcb61e828b2478d7a53fdf57c22 Mon Sep 17 00:00:00 2001
From: Antonia Frank <antonia.frank@epfl.ch>
Date: Fri, 31 May 2024 11:47:56 +0200
Subject: [PATCH] Add trial index for loading current densities with gdat

---
 matlab/TCV/gdat_tcv.m | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m
index a6118f64..18f7a95d 100644
--- a/matlab/TCV/gdat_tcv.m
+++ b/matlab/TCV/gdat_tcv.m
@@ -1850,7 +1850,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       data_fullpath = '';
       ohm_help = '';
       if strcmp(lower(source_icd.ohm),'ibs')
-        ohm_data.cd_tot = gdat_tcv(shot,'\results::ibs:iohm');
+        ohm_data.cd_tot = gdat_tcv(shot,'\results::ibs:iohm','trialindx',gdat_params.trialindx);
         if gdat_data.mapping_for.tcv.gdat_timedim ==2
           tgrid_to_change = {'ohm_data.cd_tot.t','ohm_data.cd_tot.dim{1}'};
           for i=1:length(tgrid_to_change)
@@ -1859,7 +1859,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
         end
         ohm_data.cd_tot.data = ohm_data.cd_tot.data';
         ohm_data.cd_tot.units = strrep(ohm_data.cd_tot.units,'kA','A');
-        ohm_data.cd_dens = gdat_tcv(shot,'\results::ibs:johmav'); % =jtild=<j.B> / R0 / <Bphi/R>, with Bphi=F(psi)/R
+        ohm_data.cd_dens = gdat_tcv(shot,'\results::ibs:johmav','trialindx',gdat_params.trialindx); % =jtild=<j.B> / R0 / <Bphi/R>, with Bphi=F(psi)/R
         if gdat_data.mapping_for.tcv.gdat_timedim ==2
           tgrid_to_change = {'ohm_data.cd_dens.t','ohm_data.cd_dens.dim{2}'};
           for i=1:length(tgrid_to_change)
@@ -1897,7 +1897,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       data_fullpath = '';
       bs_help = '';
       if strcmp(lower(source_icd.bs),'ibs')
-        bs_data.cd_tot = gdat_tcv(shot,'\results::ibs:ibs');
+        bs_data.cd_tot = gdat_tcv(shot,'\results::ibs:ibs','trialindx',gdat_params.trialindx);
         if gdat_data.mapping_for.tcv.gdat_timedim ==2
           tgrid_to_change = {'bs_data.cd_tot.t','bs_data.cd_tot.dim{1}'};
           for i=1:length(tgrid_to_change)
@@ -1906,7 +1906,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
         end
         bs_data.cd_tot.data = bs_data.cd_tot.data';
         bs_data.cd_tot.units = strrep(bs_data.cd_tot.units,'kA','A');
-        bs_data.cd_dens = gdat_tcv(shot,'\results::ibs:jbsav'); % =jtild=<j.B> / R0 / <Bphi/R>, with Bphi=F(psi)/R
+        bs_data.cd_dens = gdat_tcv(shot,'\results::ibs:jbsav','trialindx',gdat_params.trialindx); % =jtild=<j.B> / R0 / <Bphi/R>, with Bphi=F(psi)/R
         if gdat_data.mapping_for.tcv.gdat_timedim ==2
           tgrid_to_change = {'bs_data.cd_dens.t','bs_data.cd_dens.dim{2}'};
           for i=1:length(tgrid_to_change)
-- 
GitLab