From 6875559234c1f45142431dd6106d27664a5c3565 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <Olivier.Sauter@epfl.ch>
Date: Wed, 18 Sep 2019 16:16:46 +0200
Subject: [PATCH] correct power and energy node for NBH

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

diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m
index 7e6419d9..4c3b1737 100644
--- a/matlab/TCV/gdat_tcv.m
+++ b/matlab/TCV/gdat_tcv.m
@@ -1991,11 +1991,10 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
         end
       end
       if NBH_in_TCV
-        nodenameeff = '\ATLAS::NBH.DATA.MAIN_ADC:DATA';
+        nodenameeff = '\results::NBH:POWR_TCV';
         nbh_data_tdi = tdi(nodenameeff);
         if ~isempty(nbh_data_tdi.data) && ~ischar(nbh_data_tdi.data) && ~isempty(nbh_data_tdi.dim)
-          index_for_tot_pow = 37;
-          nbi_neutral_power_tot = nbh_data_tdi.data(:,index_for_tot_pow).*1e6; % in W
+          nbi_neutral_power_tot = nbh_data_tdi.data.*1e6; % in W
           nbi_neutral_power_tot = max(nbi_neutral_power_tot,0.);
           gdat_data.nbi.data = nbi_neutral_power_tot; % at this stage p_gyro is in kW'
           gdat_data.nbi.units = 'W';
@@ -2003,11 +2002,13 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
           gdat_data.nbi.dimunits{1}=nbh_data_tdi.dimunits{1};
           gdat_data.nbi.t=gdat_data.nbi.dim{1};
           gdat_data.nbi.x=[];
-          gdat_data.nbi.data_fullpath=[nodenameeff ', index ' num2str(index_for_tot_pow) ', CLC NEUTRAL POWER'];
+          gdat_data.nbi.data_fullpath=[nodenameeff];
           gdat_data.nbi.label='P_{nbi}';
           gdat_data.nbi.help = nbh_data_tdi.help;
-          index_for_energy = 33;
-          gdat_data.nbi.energy = nbh_data_tdi.data(:,index_for_energy);
+          nodenameeff2 = '\results::nbh:energy';
+          gdat_data.nbi.data_fullpath=[nodenameeff ' *1e6 for W; and ' nodenameeff2 ' *1e3 for eV'];
+          nbh_energy_data_tdi = tdi(nodenameeff2);
+          gdat_data.nbi.energy = nbh_energy_data_tdi.data*1e3; % for eV
           % add to main with linear interpolation and 0 for extrapolated values
           ij=[isfinite(gdat_data.nbi.data)];
           gdat_data.data(:,end+1) = interpos(-21,gdat_data.nbi.t(ij),gdat_data.nbi.data(ij),gdat_data.t);
-- 
GitLab