diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m
index 0478fbc4abddd0adab20e523f213b2f92a988086..deae6b52e1482d482299c7737f3818a3fc2ad9cc 100644
--- a/matlab/TCV/gdat_tcv.m
+++ b/matlab/TCV/gdat_tcv.m
@@ -143,9 +143,9 @@ if nargin>=1
     % means mdsopen(shot) already performed or not shot asked for
     try
       if isempty(mdsipmex(8))
-	shot_mds = shot;
+        shot_mds = shot;
       else
-	shot_mds = mdsipmex(2,'$SHOT');
+        shot_mds = mdsipmex(2,'$SHOT');
       end
     catch
       shot_mds = shot;
@@ -156,18 +156,18 @@ if nargin>=1
     if ischar(shot) || isempty(shot)
       if gdat_params.nverbose>=1
         if isstruct(data_request) && isfield(data_request,'data_request')
-	  if ~strcmp(data_request.data_request,'ids')
-	    warning(['shot cannot be opened with ' data_request.data_request]);
-	    return
-	  end
+          if ~strcmp(data_request.data_request,'ids')
+            warning(['shot cannot be opened with ' data_request.data_request]);
+            return
+          end
         elseif ischar(data_request)
-	  if ~strcmp(data_request,'ids')
-	    warning(['shot cannot be opened with ' data_request]);
-	    return
-	  end
+          if ~strcmp(data_request,'ids')
+            warning(['shot cannot be opened with ' data_request]);
+            return
+          end
         else
           warning(['shot cannot be opened']);
-	  return
+          return
         end
       end
     end
@@ -321,7 +321,7 @@ else
 end
 gdat_data.gdat_params.liuqe = liuqe_version;
 liuqe_matlab = 1; % now default should be matlab liuqe nodes
-if liuqe_version<0 || (liuqe_version > 10 && liuqe_version < 20)
+if (liuqe_version > 10 && liuqe_version < 20)
   liuqe_matlab = 0;
 end
 liuqe_version_eff = mod(liuqe_version,10);
@@ -354,7 +354,7 @@ end
 % should replace all above by just psitbx_str...
 liuqe_matlab = 1;
 switch liuqe_version
- case {-1}, liuqe_ext=''; psitbx_str='FBTE'; liuqe_matlab = 0;
+ case {-1}, liuqe_ext=''; psitbx_str='FBTE';
  case {1,21}, liuqe_ext=''; psitbx_str='LIUQE.M';
  case {11}, liuqe_ext=''; psitbx_str='LIUQE';liuqe_matlab = 0;
  case {2, 3, 22, 23}, liuqe_ext=['_' num2str(mod(liuqe_version,10))]; psitbx_str=['LIUQE.M' num2str(mod(liuqe_version,10))];
@@ -1247,7 +1247,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
             xx=repmat(reshape(gdat_data.dim{1},length(gdat_data.dim{1}),1),1,size(gdat_data.eqdsk(itime).psi,2));
             yy=repmat(reshape(gdat_data.dim{2},1,length(gdat_data.dim{2})),size(gdat_data.eqdsk(itime).psi,1),1);
             aa = interpos2Dcartesian(gdat_data.eqdsk(itime).rmesh,gdat_data.eqdsk(itime).zmesh ...
-	  ,gdat_data.eqdsk(itime).psi,xx,yy,-1,-1);
+          ,gdat_data.eqdsk(itime).psi,xx,yy,-1,-1);
             gdat_data.data(:,:,itime) = aa;
           end
         else
@@ -1525,7 +1525,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       end
     elseif ~iscell(gdat_data.gdat_params.source)
       if ischar(gdat_data.gdat_params.source)
-	gdat_data.gdat_params.source = lower(gdat_data.gdat_params.source);
+        gdat_data.gdat_params.source = lower(gdat_data.gdat_params.source);
         if ~any(strmatch(gdat_data.gdat_params.source,lower(sources_avail)))
           if (gdat_params.nverbose>=1)
             warning(['source= ' gdat_data.gdat_params.source ' is not part of the available sources: ' sprintf('''%s'' ',sources_avail{:})]);
@@ -1571,160 +1571,229 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       data_fullpath = '';
       ec_help = '';
       % EC
+
+      % fill ec_inputs from write_pgyro
+      [~,time,pgyro,pgyro_ecrh,gyro2launcher,freq2launcher,~,~] = write_pgyro(shot,'doplots',0);
+
+      ec_inputs.pgyro.data = pgyro;
+      ec_inputs.pgyro.t = time;
+      ec_inputs.pgyro.units = 'W';
+      ec_inputs.pgyro.label = 'Power injected per launcher ; last index is total';
+      ec_inputs.pgyro.x = 1:numel(pgyro(1,:));
+      ec_inputs.pgyro.dim = {ec_inputs.pgyro.x, ec_inputs.pgyro.t};
+      launchers_label = cellfun(@num2str, num2cell(1:size(pgyro,2)-1),'UniformOutput',false);
+      launchers_label{end+1} = 'tot';
+      ec_inputs.pgyro.dimunits = {launchers_label, 's'};
+
+      ec_inputs.launchers_active.data = zeros(numel(pgyro_ecrh),1);
+      for ii =1:numel(pgyro_ecrh)
+        if ~isempty(pgyro_ecrh{ii}.data); ec_inputs.launchers_active.data(ii) = 1; end
+      end
+      ec_inputs.launchers_active.label = 'Active launchers in the shot (1:active, 0:inactive)';
+
+      ec_inputs.gyro2launcher.data = gyro2launcher;
+      ec_inputs.gyro2launcher.label = 'Gyrotron connected to launcher';
+
+      ec_inputs.freq2launcher.data = freq2launcher;
+      ec_inputs.freq2launcher.label = 'Frequency in launcher';
+      ec_inputs.freq2launcher.units = 'Hz';
+
+      gdat_data.ec.ec_inputs = ec_inputs;
+
+      % introduce flag to check whether ec_data could be retrieved successfully
+      filled_successfully = false;
+
       if strcmp(lower(source_icd.ec),'toray')
-        if isempty(gdat_data.gdat_params.trialindx)
+        try % fill ec_data from TORAY via astra_tcv_exp outputs
           % centralized function for toray nodes
           [pabs_gyro,icdtot,pow_dens,currentdrive_dens,rho_dep_pow,drho_pow,...
-            pmax,icdmax,currentdrive_dens_w2,rho_dep_icd,drho_icd,...
-            ~,power_integrated,currentdrive_integrated] = ...
-            astra_tcv_EC_exp(shot,[],[],[],[],[],[],1);
-        else
-          % centralized function for toray nodes
-          [pabs_gyro,icdtot,pow_dens,currentdrive_dens,rho_dep_pow,drho_pow,...
-            pmax,icdmax,currentdrive_dens_w2,rho_dep_icd,drho_icd,...
-            ~,power_integrated,currentdrive_integrated] = ...
+            pmax,icdmax,currentdrive_dens_w2,rho_dep_icd,drho_icd,~,power_integrated,currentdrive_integrated] = ...
             astra_tcv_EC_exp(shot,[],[],[],[],[],gdat_data.gdat_params.trialindx,1);
-        end
-        if gdat_data.mapping_for.tcv.gdat_timedim ==2
-          tgrid_to_change = {'pabs_gyro','icdtot','pow_dens','currentdrive_dens','rho_dep_pow','drho_pow','pmax', ...
-                             'icdmax','currentdrive_dens_w2','rho_dep_icd','drho_icd'};
-          for i=1:length(tgrid_to_change)
-            eval([tgrid_to_change{i} '.tgrid = reshape(' tgrid_to_change{i} '.tgrid,1,numel(' tgrid_to_change{i} '.tgrid));']);
+          if gdat_data.mapping_for.tcv.gdat_timedim ==2
+            tgrid_to_change = {'pabs_gyro','icdtot','pow_dens','currentdrive_dens','rho_dep_pow','drho_pow','pmax', ...
+                               'icdmax','currentdrive_dens_w2','rho_dep_icd','drho_icd'};
+            for i=1:length(tgrid_to_change)
+              eval([tgrid_to_change{i} '.tgrid = reshape(' tgrid_to_change{i} '.tgrid,1,numel(' tgrid_to_change{i} '.tgrid));']);
+            end
+          end
+          ec_help = 'from toray icdint with extracting of effective Icd for given launcher depending on nb rays used';
+          % All EC related quantities, each substructure should have at least fields data,x,t,units,dim,dimunits,label to be copied onto gdat_data
+
+          launchers_label = cellfun(@num2str, num2cell(1:size(pabs_gyro.data,1)),'UniformOutput',false);
+          launchers_label{end+1} = 'tot';
+          launchers_grid = [1:size(pabs_gyro.data,1)+1]';
+
+          % power deposition related:
+          ec_data.p_abs_plasma.data = pabs_gyro.data * 1e6;
+          ec_data.p_abs_plasma.data(end+1,:) = sum(ec_data.p_abs_plasma.data,1,'omitnan');
+          ec_data.p_abs_plasma.label = [strrep(pabs_gyro.comment,'MW','W') ' ; last index is total'];
+          ec_data.p_abs_plasma.units = 'W';
+          ec_data.p_abs_plasma.x = launchers_grid;
+          ec_data.p_abs_plasma.t =pabs_gyro.tgrid;
+          ec_data.p_abs_plasma.dim = {ec_data.p_abs_plasma.x, ec_data.p_abs_plasma.t};
+          ec_data.p_abs_plasma.dimunits = {launchers_label, 's'};
+          %
+          ec_data.p_dens.data = pow_dens.data * 1e6;
+          ec_data.p_dens.data(:,end+1,:) = sum(ec_data.p_dens.data,2,'omitnan');
+          ec_data.p_dens.label = [strrep(pow_dens.comment,'MW','W') ' ; last index is total'];
+          ec_data.p_dens.units = 'W/m^3';
+          ec_data.p_dens.x = pow_dens.rgrid';
+          ec_data.p_dens.rhotor_norm = ec_data.p_dens.x;
+          ec_data.p_dens.t = pow_dens.tgrid;
+          ec_data.p_dens.dim = {ec_data.p_dens.x, launchers_grid, ec_data.p_dens.t};
+          ec_data.p_dens.dimunits = {'rhotor_norm', launchers_label, 's'};
+          %
+          ec_data.p_integrated.data = power_integrated.data * 1e6;
+          ec_data.p_integrated.data(:,end+1,:) = sum(ec_data.p_integrated.data,2,'omitnan');
+          ec_data.p_integrated.label = [strrep(power_integrated.comment,'MW','W') ' ; last index is total'];
+          ec_data.p_integrated.units = 'W';
+          ec_data.p_integrated.x = power_integrated.rgrid';
+          ec_data.p_integrated.rhotor_norm = ec_data.p_integrated.x;
+          ec_data.p_integrated.t = power_integrated.tgrid;
+          ec_data.p_integrated.dim = {ec_data.p_integrated.x, launchers_grid, ec_data.p_integrated.t};
+          ec_data.p_integrated.dimunits = {'rhotor_norm', launchers_label, 's'};
+          %
+          ec_data.max_pow_dens.data = pmax.data * 1e6;
+          ec_data.max_pow_dens.label = strrep(pmax.comment,'MW','W');
+          ec_data.max_pow_dens.units = 'W/m^3';
+          ec_data.max_pow_dens.x = [];
+          ec_data.max_pow_dens.t = pmax.tgrid;
+          ec_data.max_pow_dens.dim = {ec_data.max_pow_dens.t};
+          ec_data.max_pow_dens.dimunits = {'s'};
+          %
+          ec_data.rho_max_pow_dens.data = rho_dep_pow.data;
+          ec_data.rho_max_pow_dens.label = rho_dep_pow.comment;
+          ec_data.rho_max_pow_dens.units = 'rhotor_norm';
+          ec_data.rho_max_pow_dens.x = [];
+          ec_data.rho_max_pow_dens.t = rho_dep_pow.tgrid;
+          ec_data.rho_max_pow_dens.dim = {ec_data.rho_max_pow_dens.t};
+          ec_data.rho_max_pow_dens.dimunits = {'s'};
+          %
+          ec_data.width_pow_dens.data = drho_pow.data;
+          ec_data.width_pow_dens.label = drho_pow.comment;
+          ec_data.width_pow_dens.units = 'rhotor_norm';
+          ec_data.width_pow_dens.x = [];
+          ec_data.width_pow_dens.t = drho_pow.tgrid;
+          ec_data.width_pow_dens.dim = {ec_data.width_pow_dens.t};
+          ec_data.width_pow_dens.dimunits = {'s'};
+
+          % current drive deposition related:
+          ec_data.cd_tot.data = icdtot.data * 1e6;
+          ec_data.cd_tot.data(end+1,:) = sum(ec_data.cd_tot.data,1,'omitnan');
+          ec_data.cd_tot.label = [strrep(icdtot.comment,'MA','A') ' ; last index is total'];
+          ec_data.cd_tot.units = 'A';
+          ec_data.cd_tot.x = launchers_grid;
+          ec_data.cd_tot.t = icdtot.tgrid;
+          ec_data.cd_tot.dim = {ec_data.cd_tot.x, ec_data.cd_tot.t};
+          ec_data.cd_tot.dimunits = {launchers_label, 's'};
+          %
+          ec_data.cd_dens.data = currentdrive_dens.data * 1e6;
+          ec_data.cd_dens.data(:,end+1,:) = sum(ec_data.cd_dens.data,2,'omitnan');
+          ec_data.cd_dens.label = [strrep(currentdrive_dens.comment,'MA','A') ' ; last index is total'];
+          ec_data.cd_dens.units = 'A/m^2';
+          ec_data.cd_dens.x = currentdrive_dens.rgrid';
+          ec_data.cd_dens.rhotor_norm = ec_data.cd_dens.x;
+          ec_data.cd_dens.t = currentdrive_dens.tgrid;
+          ec_data.cd_dens.dim = {ec_data.cd_dens.x, launchers_grid, ec_data.cd_dens.t};
+          ec_data.cd_dens.dimunits = {'rhotor_norm', launchers_label, 's'};
+          %
+          ec_data.cd_integrated.data = currentdrive_integrated.data * 1e6;
+          ec_data.cd_integrated.data(:,end+1,:) = sum(ec_data.cd_integrated.data,2,'omitnan');
+          ec_data.cd_integrated.label = [strrep(currentdrive_integrated.comment,'MA','A') ' ; last index is total'];
+          ec_data.cd_integrated.units = 'A';
+          ec_data.cd_integrated.x = currentdrive_integrated.rgrid';
+          ec_data.cd_integrated.rhotor_norm = ec_data.cd_integrated.x;
+          ec_data.cd_integrated.t = currentdrive_integrated.tgrid;
+          ec_data.cd_integrated.dim = {ec_data.cd_integrated.x, launchers_grid, ec_data.cd_integrated.t};
+          ec_data.cd_integrated.dimunits = {'rhotor_norm', launchers_label, 's'};
+          %
+          ec_data.max_cd_dens.data = icdmax.data * 1e6;
+          ec_data.max_cd_dens.label = strrep(icdmax.comment,'MA','A');
+          ec_data.max_cd_dens.units = 'A/m^2';
+          ec_data.max_cd_dens.x = [];
+          ec_data.max_cd_dens.t = icdmax.tgrid;
+          ec_data.max_cd_dens.dim = {ec_data.max_cd_dens.t};
+          ec_data.max_cd_dens.dimunits = {'s'};
+          %
+          ec_data.rho_max_cd_dens.data = rho_dep_icd.data;
+          ec_data.rho_max_cd_dens.label = rho_dep_icd.comment;
+          ec_data.rho_max_cd_dens.units = 'rhotor_norm';
+          ec_data.rho_max_cd_dens.x = [];
+          ec_data.rho_max_cd_dens.t = rho_dep_icd.tgrid;
+          ec_data.rho_max_cd_dens.dim = {ec_data.rho_max_cd_dens.t};
+          ec_data.rho_max_cd_dens.dimunits = {'s'};
+          %
+          ec_data.width_cd_dens.data = drho_icd.data;
+          ec_data.width_cd_dens.label = drho_icd.comment;
+          ec_data.width_cd_dens.units = 'rhotor_norm';
+          ec_data.width_cd_dens.x = [];
+          ec_data.width_cd_dens.t = drho_icd.tgrid;
+          ec_data.width_cd_dens.dim = {ec_data.width_cd_dens.t};
+          ec_data.width_cd_dens.dimunits = {'s'};
+          %
+          ec_data.cd_dens_doublewidth.data = currentdrive_dens_w2.data * 1e6;
+          ec_data.cd_dens_doublewidth.label = [strrep(currentdrive_dens_w2.comment,'MA','A') ' ; last index is total'];
+          for subfields={'x','rhotor_norm','t','dim','dimunits','units'}
+            ec_data.cd_dens_doublewidth.(subfields{1}) = ec_data.cd_dens.(subfields{1});
           end
+
+          gdat_data.ec.ec_data = ec_data;
+          filled_successfully = true; %set flag to true
+        catch ME
+          warning(ME.identifier,'Problem retrieving TORAY data. \nError message: %s',ME.message);
+          % try to identify cause of the error
+          if ~check_nodes_filled(shot,'toray')
+            if ~any(ec_inputs.launchers_active.data,1)
+              msg = 'write_pyro(shot) found NO active launchers, maybe there was no EC in this shot?';
+            else
+              msg = 'write_pyro(shot) found active launchers, but TORAY nodes are no filled, check hldsi(shot), and (ask to) relaunch TORAY.';
+            end
+          elseif ~isempty(gdat_data.gdat_params.trialindx)
+            msg = 'Is the trial index filled? Check TORAY nodes with hdlsi(shot).';
+          else
+            msg = 'Unknown problem retrieving ec_data.';
+          end
+          warning(msg);
+          gdat_data.ec.help = msg;
         end
-        ec_help = 'from toray icdint with extracting of effective Icd for given launcher depending on nb rays used';
-        % All EC related quantities, each substructure should have at least fields data,x,t,units,dim,dimunits,label to be copied onto gdat_data
-        if size(pabs_gyro.data,1)>9
-          launchers_label = {'1','2','3','4','5','6','7','8','9','10','11','tot'};
+      else
+        msg  = ['source_icd.ec = ' source_icd.ec ' not yet implemented, ask O. Sauter'];
+        disp(msg);
+        gdat_data.ec.help = msg;
+      end
+
+      % depending if ec_data could be completely retrieved, setup the final gdat output
+      if filled_successfully
+        if isempty(ec_data.cd_tot.data) || isempty(ec_data.cd_tot.t) || ischar(ec_data.cd_tot.data)
+          if (gdat_params.nverbose>=1)
+            warning(['problems loading data for ' source_icd.ec ...
+                      ' for data_request= ' data_request_eff]);
+          end
         else
-          launchers_label = {'1','2','3','4','5','6','7','8','9','tot'};
-        end
-        launchers_grid = [1:size(pabs_gyro.data,1)+1]';
-        
-        % power deposition related:
-        ec_data.p_abs_plasma.data = pabs_gyro.data * 1e6;
-        ec_data.p_abs_plasma.data(end+1,:) = sum(ec_data.p_abs_plasma.data,1,'omitnan');
-        ec_data.p_abs_plasma.label = [strrep(pabs_gyro.comment,'MW','W') ' ; last index is total'];
-        ec_data.p_abs_plasma.units = 'W';
-        ec_data.p_abs_plasma.x = launchers_grid;
-        ec_data.p_abs_plasma.t =pabs_gyro.tgrid;
-        ec_data.p_abs_plasma.dim = {ec_data.p_abs_plasma.x, ec_data.p_abs_plasma.t};
-        ec_data.p_abs_plasma.dimunits = {launchers_label, 's'};
-        %
-        ec_data.p_dens.data = pow_dens.data * 1e6;
-        ec_data.p_dens.data(:,end+1,:) = sum(ec_data.p_dens.data,2,'omitnan');
-        ec_data.p_dens.label = [strrep(pow_dens.comment,'MW','W') ' ; last index is total'];
-        ec_data.p_dens.units = 'W/m^3';
-        ec_data.p_dens.x = pow_dens.rgrid';
-        ec_data.p_dens.rhotor_norm = ec_data.p_dens.x;
-        ec_data.p_dens.t = pow_dens.tgrid;
-        ec_data.p_dens.dim = {ec_data.p_dens.x, launchers_grid, ec_data.p_dens.t};
-        ec_data.p_dens.dimunits = {'rhotor_norm', launchers_label, 's'};
-        %
-        ec_data.p_integrated.data = power_integrated.data * 1e6;
-        ec_data.p_integrated.data(:,end+1,:) = sum(ec_data.p_integrated.data,2,'omitnan');
-        ec_data.p_integrated.label = [strrep(power_integrated.comment,'MW','W') ' ; last index is total'];
-        ec_data.p_integrated.units = 'W';
-        ec_data.p_integrated.x = power_integrated.rgrid';
-        ec_data.p_integrated.rhotor_norm = ec_data.p_integrated.x;
-        ec_data.p_integrated.t = power_integrated.tgrid;
-        ec_data.p_integrated.dim = {ec_data.p_integrated.x, launchers_grid, ec_data.p_integrated.t};
-        ec_data.p_integrated.dimunits = {'rhotor_norm', launchers_label, 's'};
-        %
-        ec_data.max_pow_dens.data = pmax.data * 1e6;
-        ec_data.max_pow_dens.label = strrep(pmax.comment,'MW','W');
-        ec_data.max_pow_dens.units = 'W/m^3';
-        ec_data.max_pow_dens.x = [];
-        ec_data.max_pow_dens.t = pmax.tgrid;
-        ec_data.max_pow_dens.dim = {ec_data.max_pow_dens.t};
-        ec_data.max_pow_dens.dimunits = {'s'};
-        %
-        ec_data.rho_max_pow_dens.data = rho_dep_pow.data;
-        ec_data.rho_max_pow_dens.label = rho_dep_pow.comment;
-        ec_data.rho_max_pow_dens.units = 'rhotor_norm';
-        ec_data.rho_max_pow_dens.x = [];
-        ec_data.rho_max_pow_dens.t = rho_dep_pow.tgrid;
-        ec_data.rho_max_pow_dens.dim = {ec_data.rho_max_pow_dens.t};
-        ec_data.rho_max_pow_dens.dimunits = {'s'};
-        %
-        ec_data.width_pow_dens.data = drho_pow.data;
-        ec_data.width_pow_dens.label = drho_pow.comment;
-        ec_data.width_pow_dens.units = 'rhotor_norm';
-        ec_data.width_pow_dens.x = [];
-        ec_data.width_pow_dens.t = drho_pow.tgrid;
-        ec_data.width_pow_dens.dim = {ec_data.width_pow_dens.t};
-        ec_data.width_pow_dens.dimunits = {'s'};
-        
-        % current drive deposition related:
-        ec_data.cd_tot.data = icdtot.data * 1e6;
-        ec_data.cd_tot.data(end+1,:) = sum(ec_data.cd_tot.data,1,'omitnan');
-        ec_data.cd_tot.label = [strrep(icdtot.comment,'MA','A') ' ; last index is total'];
-        ec_data.cd_tot.units = 'A';
-        ec_data.cd_tot.x = launchers_grid;
-        ec_data.cd_tot.t = icdtot.tgrid;
-        ec_data.cd_tot.dim = {ec_data.cd_tot.x, ec_data.cd_tot.t};
-        ec_data.cd_tot.dimunits = {launchers_label, 's'};
-        %
-        ec_data.cd_dens.data = currentdrive_dens.data * 1e6;
-        ec_data.cd_dens.data(:,end+1,:) = sum(ec_data.cd_dens.data,2,'omitnan');
-        ec_data.cd_dens.label = [strrep(currentdrive_dens.comment,'MA','A') ' ; last index is total'];
-        ec_data.cd_dens.units = 'A/m^2';
-        ec_data.cd_dens.x = currentdrive_dens.rgrid';
-        ec_data.cd_dens.rhotor_norm = ec_data.cd_dens.x;
-        ec_data.cd_dens.t = currentdrive_dens.tgrid;
-        ec_data.cd_dens.dim = {ec_data.cd_dens.x, launchers_grid, ec_data.cd_dens.t};
-        ec_data.cd_dens.dimunits = {'rhotor_norm', launchers_label, 's'};        
-        %
-        ec_data.cd_integrated.data = currentdrive_integrated.data * 1e6;
-        ec_data.cd_integrated.data(:,end+1,:) = sum(ec_data.cd_integrated.data,2,'omitnan');
-        ec_data.cd_integrated.label = [strrep(currentdrive_integrated.comment,'MA','A') ' ; last index is total'];
-        ec_data.cd_integrated.units = 'A';
-        ec_data.cd_integrated.x = currentdrive_integrated.rgrid';
-        ec_data.cd_integrated.rhotor_norm = ec_data.cd_integrated.x;
-        ec_data.cd_integrated.t = currentdrive_integrated.tgrid;
-        ec_data.cd_integrated.dim = {ec_data.cd_integrated.x, launchers_grid, ec_data.cd_integrated.t};
-        ec_data.cd_integrated.dimunits = {'rhotor_norm', launchers_label, 's'};
-        %
-        ec_data.max_cd_dens.data = icdmax.data * 1e6;
-        ec_data.max_cd_dens.label = strrep(icdmax.comment,'MA','A');
-        ec_data.max_cd_dens.units = 'A/m^2';
-        ec_data.max_cd_dens.x = [];
-        ec_data.max_cd_dens.t = icdmax.tgrid;
-        ec_data.max_cd_dens.dim = {ec_data.max_cd_dens.t};
-        ec_data.max_cd_dens.dimunits = {'s'};
-        %
-        ec_data.rho_max_cd_dens.data = rho_dep_icd.data;
-        ec_data.rho_max_cd_dens.label = rho_dep_icd.comment;
-        ec_data.rho_max_cd_dens.units = 'rhotor_norm';
-        ec_data.rho_max_cd_dens.x = [];
-        ec_data.rho_max_cd_dens.t = rho_dep_icd.tgrid;
-        ec_data.rho_max_cd_dens.dim = {ec_data.rho_max_cd_dens.t};
-        ec_data.rho_max_cd_dens.dimunits = {'s'};
-        %
-        ec_data.width_cd_dens.data = drho_icd.data;
-        ec_data.width_cd_dens.label = drho_icd.comment;
-        ec_data.width_cd_dens.units = 'rhotor_norm';
-        ec_data.width_cd_dens.x = [];
-        ec_data.width_cd_dens.t = drho_icd.tgrid;
-        ec_data.width_cd_dens.dim = {ec_data.width_cd_dens.t};
-        ec_data.width_cd_dens.dimunits = {'s'};
-        %
-        ec_data.cd_dens_doublewidth.data = currentdrive_dens_w2.data * 1e6;
-        ec_data.cd_dens_doublewidth.label = [strrep(currentdrive_dens_w2.comment,'MA','A') ' ; last index is total'];
-        for subfields={'x','rhotor_norm','t','dim','dimunits','units'}
-          ec_data.cd_dens_doublewidth.(subfields{1}) = ec_data.cd_dens.(subfields{1});
+          % now default is icdtot, will depend on request and data_out param of some kind
+          data_fullpath = ['from toray nodes using astra_tcv_EC_exp(shot), all results in .ec_data, subfield=' field_for_main_data ...
+                           'in ec.data, .x, .t, .dim, .dimunits, .label, .units'];
+          for subfields={'data','x','t','units','dim','dimunits','label'}
+            gdat_data.ec.(subfields{1}) = gdat_data.ec.ec_data.(field_for_main_data).(subfields{1});
+          end
+          gdat_data.ec.data_fullpath = data_fullpath;
+          gdat_data.ec.help = ec_help;
+          % add to main, assume 1st one so just use this time base and x base
+          % should find launcher tot index
+          gdat_data.data(end+1,:) = gdat_data.ec.data(end,:);
+          gdat_data.t = gdat_data.ec.t;
+          if ischar(gdat_data.label); gdat_data.label = []; end  % label was defined in tcv_mapping_request as char so replace 1st time
+          gdat_data.label{end+1}=gdat_data.ec.label;
         end
-        
-      else
-        disp(['source_icd.ec = ' source_icd.ec ' not yet implemented, ask O. Sauter'])
+
+      else %~filled_successfully
+
+        % fill ec_data empty
         ec_data.p_abs_plasma = [];
-        ec_data.p_abs_plasma(end+1,:) = [];
         ec_data.p_abs_plasma_label = [];
         ec_data.p_dens = [];
-        ec_data.p_dens(end+1,:) = [];
         ec_data.p_dens_label = [];
         ec_data.p_integrated = [];
-        ec_data.p_integrated(end+1,:) = [];
         ec_data.p_integrated_label = [];
         ec_data.max_pow_dens = [];
         ec_data.max_pow_dens_label = [];
@@ -1734,13 +1803,10 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
         ec_data.width_pow_dens_label = [];
         % current drive deposition related:
         ec_data.cd_tot = [];
-        ec_data.cd_tot(end+1,:) = [];
         ec_data.cd_tot_label = [];
         ec_data.cd_dens = [];
-        ec_data.cd_dens(:,end+1,:) = [];
         ec_data.cd_dens_label = [];
         ec_data.cd_integrated = [];
-        ec_data.cd_integrated(:,end+1,:) = [];
         ec_data.cd_integrated_label = [];
         ec_data.max_cd_dens = [];
         ec_data.max_cd_dens_label = [];
@@ -1751,34 +1817,11 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
         ec_data.cd_dens_doublewidth = [];
         ec_data.cd_dens_doublewidth_label = [];
         ec_data.rho_tor_norm = [];
-        ec_data.t = [];
-        ec_data.launchers = [];
         gdat_data.ec.ec_data = ec_data;
         return
       end
-      gdat_data.ec.ec_data = ec_data;
-      if isempty(icdtot.data) || isempty(icdtot.tgrid) || ischar(icdtot.data)
-        if (gdat_params.nverbose>=1)
-          warning(['problems loading data for ' source_icd.ec ...
-                    ' for data_request= ' data_request_eff]);
-        end
-      else
-        % now default is icdtot, will depend on request and data_out param of some kind
-        data_fullpath = ['from toray nodes using astra_tcv_EC_exp(shot), all results in .ec_data, subfield=' field_for_main_data ...
-                         'in ec.data, .x, .t, .dim, .dimunits, .label, .units'];
-        for subfields={'data','x','t','units','dim','dimunits','label'}
-          gdat_data.ec.(subfields{1}) = gdat_data.ec.ec_data.(field_for_main_data).(subfields{1});
-        end
-        gdat_data.ec.data_fullpath = data_fullpath;
-        gdat_data.ec.help = ec_help;
-        % add to main, assume 1st one so just use this time base and x base
-        % should find launcher tot index
-        gdat_data.data(end+1,:) = gdat_data.ec.data(end,:);
-        gdat_data.t = gdat_data.ec.t;
-        if ischar(gdat_data.label); gdat_data.label = []; end;  % label was defined in tcv_mapping_request as char so replace 1st time
-        gdat_data.label{end+1}=gdat_data.ec.label;
-      end
-    end
+
+    end % end filling ec
     %
     if any(strmatch('nb',gdat_data.gdat_params.source))
       NBH_in_TCV = 0;
@@ -2458,7 +2501,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       gdat_data.gdat_params.source = sources_avail;
     elseif ~iscell(gdat_data.gdat_params.source)
       if ischar(gdat_data.gdat_params.source)
-	gdat_data.gdat_params.source = lower(gdat_data.gdat_params.source);
+        gdat_data.gdat_params.source = lower(gdat_data.gdat_params.source);
         if ~any(strmatch(gdat_data.gdat_params.source,lower(sources_avail)))
           if (gdat_params.nverbose>=1)
             warning(['source= ' gdat_data.gdat_params.source ' is not part of the available sources: ' sprintf('''%s'' ',sources_avail{:})]);
@@ -2721,6 +2764,16 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       nodenameeff=[begstr 'q_psi' substr_liuqe];
     end
     tracetdi=tdi(nodenameeff);
+    if liuqe_matlab==1 && liuqe_version_eff==-1
+      % may have problems with dim{1} being indices instead of rhopol
+      if max(tracetdi.dim{1}) > 2
+        nodenameeff_rho = strrep(nodenameeff,'q_psi','rho');
+        rho_eff = mdsvalue(nodenameeff_rho);
+        if numel(tracetdi.dim{1}) == numel(rho_eff)
+          tracetdi.dim{1}(:) = rho_eff; % it is not sqrt(linspace...) anymore, hence take rho itself
+        end
+      end
+    end
     if isempty(tracetdi.data) || isempty(tracetdi.dim)  % || ischar(tracetdi.data) (to add?)
       if (gdat_params.nverbose>=1); warning(['problems loading data for ' nodenameeff ' for data_request= ' data_request_eff]); end
       if (gdat_params.nverbose>=3); disp(['rerun LIUQE?']); end
@@ -3164,10 +3217,6 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
     else
       nodenameeff=['tcv_eq("vol","' psitbx_str '")'];
     end
-    if liuqe_version_eff==-1
-      data_request_eff = 'volume'; % only LCFS
-      nodenameeff=[begstr 'volume' substr_liuqe];
-    end
     tracetdi=tdi(nodenameeff);
     if (isempty(tracetdi.data) || isempty(tracetdi.dim)) && liuqe_matlab==0
       % try to run psitbxput
@@ -3175,6 +3224,15 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       psitbxput(psitbxput_version,shot);
       ishot = mdsopen(shot);
       tracetdi=tdi(nodenameeff);
+    elseif liuqe_matlab==1 && liuqe_version_eff==-1
+      % may have problems with dim{1} being indices instead of rhopol
+      if max(tracetdi.dim{1}) > 2
+        nodenameeff_rho = 'tcv_eq("rho","FBTE")';
+        rho_eff = mdsvalue(nodenameeff_rho);
+        if numel(tracetdi.dim{1}) == numel(rho_eff)
+          tracetdi.dim{1}(:) = rho_eff;
+        end
+      end
     end
     if isempty(tracetdi.data) || isempty(tracetdi.dim) || ischar(tracetdi.data)
       return
diff --git a/matlab/TCV/tcv_requests_mapping.m b/matlab/TCV/tcv_requests_mapping.m
index 1bcfcdd585d6c136231618b0c2cdf8598272e301..4a8106952f5deae885cf6ef0a58e182a3b314e42 100644
--- a/matlab/TCV/tcv_requests_mapping.m
+++ b/matlab/TCV/tcv_requests_mapping.m
@@ -141,8 +141,8 @@ switch lower(data_request)
   mapping.label = 'gap hfs/lfs';
   mapping.method = 'expression';
   mapping.expression = ['params_eff = gdat_data.gdat_params;params_eff.data_request=''tcv_eq("r_contour","LIUQE.M")'';' ...
-                   'gdat_tmp=gdat_tcv([],params_eff);aa_data(1,:)=min(gdat_tmp.data,[],1)-0.624;' ...
-                    'aa_data(2,:)=1.136-max(gdat_tmp.data,[],1);gdat_tmp.data=aa_data;gdat_tmp.x=[1:2];gdat_tmp.dim{1}=gdat_tmp.x;' ...
+                   'gdat_tmp=gdat_tcv([],params_eff);aa_data(1,:)=min(gdat_tmp.data,[],1)-0.624;aa_data(1,[aa_data(1,:)<0]) = 0.;' ...
+                    'aa_data(2,:)=1.1376-max(gdat_tmp.data,[],1);aa_data(2,[aa_data(2,:)<0]) = 0.;gdat_tmp.data=aa_data;gdat_tmp.x=[1:2];gdat_tmp.dim{1}=gdat_tmp.x;' ...
                    'gdat_tmp.dimunits{1}={''HFS'',''LFS''};gdat_tmp.units=''m'';'];
  case {'gas', 'gas_flux', 'gas_request', 'gas_feedforward','gas_valve'}
   mapping.timedim = 1;
diff --git a/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m b/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m
index 21daeea081f4acd531c1ed6d3cc7b3f85a109299..a230c9351cf0fb4a1dadfbec902eb2903aed5d5f 100644
--- a/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m
+++ b/matlab/TCV_IMAS/tcv_get_ids_core_profiles.m
@@ -5,7 +5,7 @@ function [ids_core_profiles,ids_core_profiles_description,varargout] = ...
 %     tcv_get_ids_core_profiles(shot,ids_equil_empty,gdat_params,varargin);
 %
 %
-% gdat_params: gdat_data.gdat_params to get all params passed from original call, 
+% gdat_params: gdat_data.gdat_params to get all params passed from original call,
 %              in particular error_bar options
 %
 % error_bar: from gdat_params.error_bar
@@ -89,9 +89,9 @@ ids_core_profiles.vacuum_toroidal_field.r0 = vacuum_toroidal_field.b0.r0;
 ids_core_profiles.vacuum_toroidal_field.b0 = interpos(63,vacuum_toroidal_field.b0.t,vacuum_toroidal_field.b0.data,ids_core_profiles.time,-1);
 ids_core_profiles_description.vacuum_toroidal_field = [vacuum_toroidal_field_desc.b0 ' on ids_core_profiles.time, with interpos(63)'];
 
-%% global_quantities 
-% data into local global_quantities.* structure with correct end names and 
-% global_quantities_desc.* with description. 
+%% global_quantities
+% data into local global_quantities.* structure with correct end names and
+% global_quantities_desc.* with description.
 % Use temp.* and temp_desc.* structures for temporary data
 
 params_eff.data_request='ip';
@@ -365,6 +365,7 @@ for it=1:length(ids_core_profiles.time)
   ids_core_profiles.profiles_1d{it}.conductivity_parallel = signeo.data(:,it);
   temp_1d_desc.conductivity_parallel = signeo.label;
 end
+
 %% add descriptions for profiles_1d
 ids_core_profiles_description.profiles_1d = temp_1d_desc;
 
diff --git a/matlab/TCV_IMAS/tcv_get_ids_core_sources.m b/matlab/TCV_IMAS/tcv_get_ids_core_sources.m
index 0a4a3963561d525534f70d06fad32f4b9fce50a3..527be19cf8921f6682b775503b83537f6cd3cf23 100644
--- a/matlab/TCV_IMAS/tcv_get_ids_core_sources.m
+++ b/matlab/TCV_IMAS/tcv_get_ids_core_sources.m
@@ -32,100 +32,189 @@ ids_core_sources_description = [];
 source_template = ids_core_sources.source{1};
 profiles_template = source_template.profiles_1d{1};
 globals_template = source_template.global_quantities{1};
-%% get time grid and data from gdat 
+%% get time grid and data from gdat
 ohm_gdat = gdat(shot,'ohm_data');
 powers_gdat = gdat(shot,'powers');
 % fix time grid to ohm time grid, same as bs
-t_grid = ohm_gdat.t; n_t = numel(t_grid); t_spacing = mean(diff(t_grid));
 
 last_index = 0;
 %% initialize source from template
 % ohm
+ohm_t_grid = powers_gdat.ohm.t; ohm_n_t = numel(ohm_t_grid);
+
 id_ohm.description = 'Source from ohmic heating';
 id_ohm.index = 7; id_ohm.name = 'ohmic';
-ids_core_sources.source{1} = source_template;
-ids_core_sources.source{1}.identifier = id_ohm;
-ids_core_sources.source{1}.profiles_1d(1:n_t) = {profiles_template};
-ids_core_sources.source{1}.global_quantities(1:n_t) = {globals_template};
+ids_core_sources.source{last_index+1} = source_template;
+ids_core_sources.source{last_index+1}.identifier = id_ohm;
+ids_core_sources.source{last_index+1}.profiles_1d(1:ohm_n_t) = {profiles_template};
+ids_core_sources.source{last_index+1}.global_quantities(1:ohm_n_t) = {globals_template};
 ohm_data = ohm_gdat.ohm.ohm_data;
 
 %fill profiles for times n t_grid
-for ii = 1:n_t
+
+for ii = 1:ohm_n_t
   % ohm
   % 1d_profiles
-  ids_core_sources.source{1}.profiles_1d{ii}.time = t_grid(ii);
-  ids_core_sources.source{1}.profiles_1d{ii}.j_parallel = ...
+  ids_core_sources.source{last_index+1}.profiles_1d{ii}.time = ohm_t_grid(ii);
+  ids_core_sources.source{last_index+1}.profiles_1d{ii}.j_parallel = ...
     ohm_data.cd_dens.data(:,ii)';
   % globals
-  ids_core_sources.source{1}.global_quantities{ii}.time = t_grid(ii);
-  ids_core_sources.source{1}.global_quantities{ii}.power = powers_gdat.ohm.data(ii);
+  ids_core_sources.source{last_index+1}.global_quantities{ii}.time = ohm_t_grid(ii);
+  ids_core_sources.source{last_index+1}.global_quantities{ii}.power = powers_gdat.ohm.data(ii);
 end
-last_index = last_index+1;
+
+last_index = last_index+1;  % add if statement to only increment if ohmic source has been added
+
 %% bs
+bs_gdat = gdat(shot,'bs_data'); bs_data = bs_gdat.bs.bs_data;
+bs_t_grid = bs_gdat.bs.t; bs_n_t = numel(bs_t_grid);
+
 id_bs.description = 'Bootstrap current';
-id_bs.index = 13; id_bs.name = 'bootstrap_cuurent';
+id_bs.index = 13; id_bs.name = 'bootstrap_current';
 ids_core_sources.source{last_index+1} = source_template;
 ids_core_sources.source{last_index+1}.identifier = id_bs;
-ids_core_sources.source{last_index+1}.profiles_1d(1:n_t) = {profiles_template};
-ids_core_sources.source{last_index+1}.global_quantities(1:n_t) = {globals_template};
-% load data
-bs_gdat = gdat(shot,'bs_data'); bs_data = bs_gdat.bs.bs_data;
+ids_core_sources.source{last_index+1}.profiles_1d(1:ohm_n_t) = {profiles_template};
+ids_core_sources.source{last_index+1}.global_quantities(1:ohm_n_t) = {globals_template};
+
 
 % fill profiles for times n t_grid
-for ii = 1:n_t
-   ids_core_sources.source{last_index+1}.profiles_1d{ii}.j_parallel = ...
-    bs_data.cd_dens.data(:,ii)'; 
+for ii = 1:bs_n_t
+  ids_core_sources.source{last_index+1}.profiles_1d{ii}.time = bs_t_grid(ii);
+  ids_core_sources.source{last_index+1}.profiles_1d{ii}.j_parallel = ...
+    bs_data.cd_dens.data(:,ii)';
 end
-last_index = last_index+1;
+
+last_index = last_index+1;  % add if statement to only increment if bs source has been added
+
 %% ec
-% load data
-ec_gdat = gdat(shot,'ec_data'); ec_data = ec_gdat.ec.ec_data;
-ec_time = ec_data.cd_dens.t;
-
-nb_launchers = size(ec_gdat.ec.ec_data.rho_max_pow_dens.data,1);
-id_ec.description = 'Sources from electron cyclotron heating and current drive';
-id_ec.index = 3; id_ec.name = 'ec';
-for i = 1:nb_launchers
-    ids_core_sources.source{last_index+i} = source_template;
-    ids_core_sources.source{last_index+i}.identifier = id_ec;
-    ids_core_sources.source{last_index+i}.profiles_1d(1:n_t) = {profiles_template};
-    ids_core_sources.source{last_index+i}.global_quantities(1:n_t) = {globals_template};
-end
-% interpolate totals on t_grid
-ec_total_pow = interp1(ec_data.p_abs_plasma.t,ec_data.p_abs_plasma.data(nb_launchers+1,:),t_grid); %the index 10 works for shot 56044
-ec_total_pow(isnan(ec_total_pow)) = 0;
-ec_total_cur = interp1(ec_data.cd_tot.t,ec_data.cd_tot.data(nb_launchers+1,:),t_grid);
-ec_total_cur(isnan(ec_total_cur)) = 0;
-
-for i = 1:nb_launchers
-    for ii = 1:n_t
-    % ec, need to find matching time index\
-    ids_core_sources.source{last_index+i}.profiles_1d{ii}.time = t_grid(ii); % profiles time (should profiles time be ec_time?)
-    ids_core_sources.source{last_index+i}.global_quantities{ii}.time = t_grid(ii); % globals time
-    [~, ec_idx] = min(abs(ec_time-t_grid(ii)));
-    if ec_time(ec_idx) == t_grid(ii) % same grid 
-        % current density
-        ids_core_sources.source{last_index+i}.profiles_1d{ii}.j_parallel = ...
-          ec_data.cd_dens.data(:,end,ec_idx)';
-        % integrated current density
-        ids_core_sources.source{last_index+i}.profiles_1d{ii}.current_parallel_inside = ...
-          ec_data.cd_integrated.data(:,ii)';
-    
-    else
-        ids_core_sources.source{last_index+i}.profiles_1d{ii}.j_parallel = ...
-          zeros(1,numel(ec_data.cd_dens.x(1,:)))';
-        ids_core_sources.source{last_index+i}.profiles_1d{ii}.current_parallel_inside = ...
-          zeros(1,numel(ec_data.cd_integrated.x(1,:)))';
+ec_gdat = gdat(shot,'ec_data');
+
+if ~isempty(ec_gdat.ec.data) % if EC data available, fill sources
+
+  ec_data = ec_gdat.ec.ec_data; ec_inputs = ec_gdat.ec.ec_inputs;
+  % get tgrid from gdat ec_data
+  ec_data_tgrid = ec_data.p_dens.t; nt_ec_data = numel(ec_data_tgrid);
+
+  % get tgrid from gdat powers
+  ec_powers_tgrid = powers_gdat.ec.t; nt_ec_powers = numel(ec_powers_tgrid);
+
+  % retrieve active launcher information from ec_inputs
+  nb_launchers = numel(ec_inputs.launchers_active.data);
+  active_launchers = find(ec_inputs.launchers_active.data==1)';
+
+  % Setup structures for active launchers from template
+  main_desc = 'Source from electron cyclotron heating and current drive';
+  id_ec.index = 3; id_ec.name = 'ec';
+  for i_lau = active_launchers
+    id_ec.description = sprintf('L%i/G%i, %s',i_lau,ec_inputs.gyro2launcher.data(i_lau),main_desc);
+    ids_core_sources.source{last_index+i_lau} = source_template;
+    ids_core_sources.source{last_index+i_lau}.identifier = id_ec;
+    ids_core_sources.source{last_index+i_lau}.profiles_1d(1:nt_ec_powers) = {profiles_template};
+    ids_core_sources.source{last_index+i_lau}.global_quantities(1:nt_ec_powers) = {globals_template};
+  end
+
+  % get data for globals from gdat powers and fill in ids_structure
+  ec_total_pow = transpose(powers_gdat.ec.data(:,nb_launchers+1)); %use power from powers_gdat(injected ec power) instead of ec_data power
+  ec_total_pow(isnan(ec_total_pow)) = 0;
+  ec_total_cur = ec_data.cd_tot.data(nb_launchers+1,:);
+  ec_total_cur(isnan(ec_total_cur)) = 0;
+
+  for i_lau = active_launchers
+    for ii = 1:nt_ec_powers
+      ids_core_sources.source{last_index+i_lau}.global_quantities{ii}.time = ec_powers_tgrid(ii);
+      ids_core_sources.source{last_index+i_lau}.global_quantities{ii}.power = ec_total_pow(ii);
+      ids_core_sources.source{last_index+i_lau}.global_quantities{ii}.current_parallel = ec_total_cur(ii);
     end
-    % globals
-    ids_core_sources.source{last_index+i}.global_quantities{ii}.time = t_grid(ii);
-    ids_core_sources.source{last_index+i}.global_quantities{ii}.power = ec_total_pow(ii);
-    ids_core_sources.source{last_index+i}.global_quantities{ii}.current_parallel = ec_total_cur(ii);
+  end
+
+  % interpoating p_dens profiles from 'ec_data_tgrid' grid (toray tgrid) to 'ec_powers_tgrid' (powers tgrid)
+  p_dens        = ec_data.p_dens.data;
+  p_integrated  = ec_data.p_integrated.data;
+  cd_dens       = ec_data.cd_dens.data;
+  cd_integrated = ec_data.cd_integrated.data;
+
+  p_ec_injected = powers_gdat.ec.data;
+  ij = iround_os(ec_powers_tgrid,ec_data_tgrid);
+  sparse_p_ec_injected = p_ec_injected(ij,:); % injected ec power vals corresponding to ec_data_tgrid
+  n_rho = size(p_dens, 1);
+
+  % calculate normalised profiles on ec_data_tgrid grid
+  norm_p_dens        = zeros(n_rho,nb_launchers+1,nt_ec_data);
+  norm_p_integrated  = zeros(n_rho,nb_launchers+1,nt_ec_data);
+  norm_cd_dens       = zeros(n_rho,nb_launchers+1,nt_ec_data);
+  norm_cd_integrated = zeros(n_rho,nb_launchers+1,nt_ec_data);
+  for it = 1:nt_ec_data
+    norm_p_dens(:,:,it)        = p_dens(:,:,it)./sparse_p_ec_injected(it,:);
+    norm_p_integrated(:,:,it)  = p_integrated(:,:,it)./sparse_p_ec_injected(it,:);
+    norm_cd_dens(:,:,it)       = cd_dens(:,:,it)./sparse_p_ec_injected(it,:);
+    norm_cd_integrated(:,:,it) = cd_integrated(:,:,it)./sparse_p_ec_injected(it,:);
+  end
+
+  % interpolate normalised p_dens profiles on ec_powers_tgrid
+  interp_norm_p_dens        = zeros(n_rho,nb_launchers+1,nt_ec_powers);
+  interp_norm_p_integrated  = zeros(n_rho,nb_launchers+1,nt_ec_powers);
+  interp_norm_cd_dens       = zeros(n_rho,nb_launchers+1,nt_ec_powers);
+  interp_norm_cd_integrated = zeros(n_rho,nb_launchers+1,nt_ec_powers);
+  for i_lau = active_launchers
+    for irho = 1:n_rho
+      % get power and current density at each rho
+      trace_p_dens        = squeeze(norm_p_dens(irho,i_lau,:));
+      trace_p_integrated  = squeeze(norm_p_integrated(irho,i_lau,:));
+      trace_cd_dens       = squeeze(norm_cd_dens(irho,i_lau,:));
+      trace_cd_integrated = squeeze(norm_cd_integrated(irho,i_lau,:));
+      % interpolate on gdat powers tgrid
+      interp_norm_p_dens(irho,i_lau,:)        = interp1(ec_data_tgrid,trace_p_dens,ec_powers_tgrid);
+      interp_norm_p_integrated(irho,i_lau,:)  = interp1(ec_data_tgrid,trace_p_integrated,ec_powers_tgrid);
+      interp_norm_cd_dens(irho,i_lau,:)       = interp1(ec_data_tgrid,trace_cd_dens,ec_powers_tgrid);
+      interp_norm_cd_integrated(irho,i_lau,:) = interp1(ec_data_tgrid,trace_cd_integrated,ec_powers_tgrid);
     end
-end
+  end
 
+  % normalised & interpolated profiles * p_ec_injected on ec_powers_tgrid
+  interp_p_dens        = zeros(n_rho,nb_launchers+1,nt_ec_powers);
+  interp_p_integrated  = zeros(n_rho,nb_launchers+1,nt_ec_powers);
+  interp_cd_dens       = zeros(n_rho,nb_launchers+1,nt_ec_powers);
+  interp_cd_integrated = zeros(n_rho,nb_launchers+1,nt_ec_powers);
+  for it = 1:nt_ec_powers
+    interp_p_dens(:,:,it)        = interp_norm_p_dens(:,:,it).*p_ec_injected(it,:);
+    interp_p_integrated(:,:,it)  = interp_norm_p_integrated(:,:,it).*p_ec_injected(it,:);
+    interp_cd_dens(:,:,it)       = interp_norm_cd_dens(:,:,it).*p_ec_injected(it,:);
+    interp_cd_integrated(:,:,it) = interp_norm_cd_integrated(:,:,it).*p_ec_injected(it,:);
+  end
+
+  % fill profiles_1d with interpolated profiles
+  for i_lau = active_launchers
+    for ii = 1:nt_ec_powers
+      % time
+      ids_core_sources.source{last_index+i_lau}.profiles_1d{ii}.time = ec_powers_tgrid(ii);
+      % rhotor grid
+      ids_core_sources.source{last_index+i_lau}.profiles_1d{ii}.grid.rho_tor_norm = ...
+        ec_data.p_dens.rhotor_norm(1,:); % constant in time
+      % power density
+      ids_core_sources.source{last_index+i_lau}.profiles_1d{ii}.electrons.energy = ...
+        interp_p_dens(:,i_lau,ii);
+      % integrated power density
+      ids_core_sources.source{last_index+i_lau}.profiles_1d{ii}.electrons.power_inside = ...
+        interp_p_integrated(:,i_lau,ii);
+      % current density (to adapt to <J.B>/B0)
+      ids_core_sources.source{last_index+i_lau}.profiles_1d{ii}.j_parallel = ...
+        interp_cd_dens(:,i_lau,ii);
+      % integrated current density (to adapt to INTEGRAL(<J.B>/B0)*ds_phi)
+      ids_core_sources.source{last_index+i_lau}.profiles_1d{ii}.current_parallel_inside = ...
+        interp_cd_integrated(:,i_lau,ii);
+    end
+  end
 
-% nbi  
+  %add empty sources for rest of unsused launchers
+  if numel(ids_core_sources.source)-last_index ~= nb_launchers
+    ids_core_sources.source{last_index+nb_launchers} = [];
+  end
+
+  last_index = last_index+nb_launchers;
+
+end
+
+%% nbi
 id_nbi.description = 'Source from Neutral Beam Injection';
 id_nbi.index = 2; id_nbi.name = 'nbi';
 %ids_core_sources.source{} = source_template;
@@ -134,7 +223,7 @@ id_nbi.index = 2; id_nbi.name = 'nbi';
 %ids_core_sources.source{}.global_quantities(1:n_t) = {globals_template};
 
 
-% total  
+% total
 id_total.description = 'Total source; combines all sources';
 id_total.index = 1; id_total.name = 'total';
 %ids_core_sources.source{} = source_template;
@@ -143,51 +232,11 @@ id_total.index = 1; id_total.name = 'total';
 %ids_core_sources.source{}.global_quantities(1:n_t) = {globals_template};
 
 
-
-
-%% fill profiles for times n t_grid
-% for ii = 1:n_t
-%   % ohm
-%   % 1d_profiles
-%   ids_core_sources.source{1}.profiles_1d{ii}.time = t_grid(ii);
-%   ids_core_sources.source{1}.profiles_1d{ii}.j_parallel = ...
-%     ohm_data.cd_dens.data(:,ii)';
-%   % globals
-%   ids_core_sources.source{1}.global_quantities{ii}.time = t_grid(ii);
-%   ids_core_sources.source{1}.global_quantities{ii}.power = powers_gdat.ohm.data(ii);
-%     
-%   % ec, need to find matching time index\
-%   ids_core_sources.source{4}.profiles_1d{ii}.time = t_grid(ii); % profiles time (should profiles time be ec_time?)
-%   ids_core_sources.source{4}.global_quantities{ii}.time = t_grid(ii); % globals time
-%   [~, ec_idx] = min(abs(ec_time-t_grid(ii)));
-%   if ec_time(ec_idx) == t_grid(ii) % same grid 
-%     % current density
-%     ids_core_sources.source{4}.profiles_1d{ii}.j_parallel = ...
-%       ec_data.cd_dens.data(:,end,ec_idx)';
-%     % integrated current density
-%     ids_core_sources.source{4}.profiles_1d{ii}.current_parallel_inside = ...
-%       ec_data.cd_integrated.data(:,ii)';
-%     
-%   else
-%     ids_core_sources.source{4}.profiles_1d{ii}.j_parallel = ...
-%       zeros(1,numel(ec_data.cd_dens.x(1,:)))';
-%     ids_core_sources.source{4}.profiles_1d{ii}.current_parallel_inside = ...
-%       zeros(1,numel(ec_data.cd_integrated.x(1,:)))';
-%   end
-%   % globals
-%   ids_core_sources.source{4}.global_quantities{ii}.time = t_grid(ii);
-%   ids_core_sources.source{4}.global_quantities{ii}.power = ec_total_pow(ii);
-%   ids_core_sources.source{4}.global_quantities{ii}.current_parallel = ec_total_cur(ii);
-%   
-%   % bs
-%   ids_core_sources.source{2}.profiles_1d{ii}.j_parallel = ...
-%     bs_data.cd_dens.data(:,ii)';
-%     
-% end
-
 %% add descriptions for profiles_1d
 
-desc.source = 'available by now, 1:total, 3:ec, 7:ohm, 13:bootstrap';
+desc.source = 'available by now {source_index}: ohmic {1}, bootstrap {2}, ec {3+} for individual launchers (if present in shot)';
+desc.profiles_1d.electrons.energy = 'absorbed power density';
+desc.profiles_1d.electrons.power_inside = 'integrated absorbed power density';
 desc.profiles_1d.j_parallel = 'parallel current density';
 desc.profiles_1d.current_parallel_inside = 'integrated parallel current density';
 desc.globals.power = 'total power coupled to the plasma';
@@ -210,4 +259,4 @@ if ~isempty(which('ids_generic_cocos_nodes_transformation_symbolic'))
           gdat_params.cocos_out,gdat_params.ipsign_out,gdat_params.b0sign_out,gdat_params.ipsign_in,gdat_params.b0sign_in, ...
           gdat_params.error_bar,gdat_params.nverbose);
 
-end
\ No newline at end of file
+end
diff --git a/matlab/TCV_IMAS/tcv_get_ids_core_transport.m b/matlab/TCV_IMAS/tcv_get_ids_core_transport.m
index 8d0522c92c3fb713c926d294cbefddce64b7c283..89421f6b67f9dc1df5be26547c118a17c3614fe0 100644
--- a/matlab/TCV_IMAS/tcv_get_ids_core_transport.m
+++ b/matlab/TCV_IMAS/tcv_get_ids_core_transport.m
@@ -28,17 +28,15 @@ try params_eff_ref=rmfield(params_eff_ref,'source');catch;end % make sure no sou
 ids_core_transport_description = [];
 
 %%
+last_index = 0;
 
-% setup empty model structs (up to 3 for now)
-ids_core_transport.model(1:3) = ids_core_transport.model(1);
-
-% fill model(3) [name: transport solver, desc: output from transport solver]
+% fill model [name: transport solver, desc: output from transport solver]
 % setup model and profiles_1d
 comment = 'Output from a transport solver';
-ids_core_transport.model{3}.comment = comment;
-ids_core_transport.model{3}.name = comment;
-ids_core_transport.model{3}.identifier.index = 2;
-ids_core_transport.model{3}.name = 'transport_solver';
+ids_core_transport.model{last_index+1}.comment = comment;
+ids_core_transport.model{last_index+1}.name = comment;
+ids_core_transport.model{last_index+1}.identifier.index = 2;
+ids_core_transport.model{last_index+1}.name = 'transport_solver';
 
 % read data and setup time
 params_eff.data_request='\results::conf:chie';
@@ -53,14 +51,13 @@ end
 ids_core_transport.time = temp_1d.chie.t;
 ids_core_transport_description.time = ['from node' params_eff.data_request];
 
-ids_core_transport.model{3}.profiles_1d(1:length(ids_core_transport.time)) = ...
-  ids_core_transport.model{3}.profiles_1d(1);
-
-%% fill profiles_1d
+ids_core_transport.model{last_index+1}.profiles_1d(1:length(ids_core_transport.time)) = ...
+  ids_core_transport.model{last_index+1}.profiles_1d(1);
 
+% fill profiles_1d
 for it=1:length(ids_core_transport.time)
-  ids_core_transport.model{3}.profiles_1d{it}.time = ids_core_transport.time(it);
-  ids_core_transport.model{3}.profiles_1d{it}.electrons.energy.d = temp_1d.chie.data(:,it);
+  ids_core_transport.model{last_index+1}.profiles_1d{it}.time = ids_core_transport.time(it);
+  ids_core_transport.model{last_index+1}.profiles_1d{it}.electrons.energy.d = temp_1d.chie.data(:,it);
   temp_1d_desc.electrons.energy.d = temp_1d.chie.label;
 end